diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-08-25 20:48:38 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-08-25 20:48:38 -0700 |
commit | e7a4bcc6fed37afbba423e4c41df6043d7158b3f (patch) | |
tree | 8c6e59c1dcb6749262e87ba701b1dce736ab1123 /src/Text/Pandoc/Writers | |
parent | a68805bebd172b107e75fe330698cbc7eee7f75a (diff) | |
parent | 5f09cf7ff033ae11c5094fe39f8cd2ac11657229 (diff) | |
download | pandoc-e7a4bcc6fed37afbba423e4c41df6043d7158b3f.tar.gz |
Merge pull request #961 from nougad/add_latex_listings_label
Write id for code block to label attr in latex when listing is used
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 6a781ddec..37ca60ce3 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -309,7 +309,7 @@ blockToLaTeX (BlockQuote lst) = do _ -> do contents <- blockListToLaTeX lst return $ "\\begin{quote}" $$ contents $$ "\\end{quote}" -blockToLaTeX (CodeBlock (_,classes,keyvalAttr) str) = do +blockToLaTeX (CodeBlock (identifier,classes,keyvalAttr) str) = do opts <- gets stOptions case () of _ | isEnabled Ext_literate_haskell opts && "haskell" `elem` classes && @@ -340,7 +340,11 @@ blockToLaTeX (CodeBlock (_,classes,keyvalAttr) str) = do [ (if key == "startFrom" then "firstnumber" else key) ++ "=" ++ attr | - (key,attr) <- keyvalAttr ] + (key,attr) <- keyvalAttr ] ++ + (if identifier == "" + then [] + else [ "label=" ++ identifier ]) + else [] printParams | null params = empty |