diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-10-21 17:33:42 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-10-21 17:33:42 -0700 |
commit | e63aafd62004e3424da46de75c78ba4dc7562af4 (patch) | |
tree | 67a23947d75932ba8309042ccb7f2dcee7e3e401 /src/Text | |
parent | d84624f7754df5b260e86e61ae4d6a59318d18b9 (diff) | |
download | pandoc-e63aafd62004e3424da46de75c78ba4dc7562af4.tar.gz |
Fix definition lists with internal links in terms (closes #1032).
This fix puts braces around a term that contains an internal
link, to avoid problems with square brackets.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 20a6ac9a9..72b0bde6d 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -513,8 +513,15 @@ listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) . defListItemToLaTeX :: ([Inline], [[Block]]) -> State WriterState Doc defListItemToLaTeX (term, defs) = do term' <- inlineListToLaTeX term + -- put braces around term if it contains an internal link, + -- since otherwise we get bad bracket interactions: \item[\hyperref[..] + let isInternalLink (Link _ ('#':_,_)) = True + isInternalLink _ = False + let term'' = if any isInternalLink term + then braces term' + else term' def' <- liftM vsep $ mapM blockListToLaTeX defs - return $ "\\item" <> brackets term' $$ def' + return $ "\\item" <> brackets term'' $$ def' -- | Craft the section header, inserting the secton reference, if supplied. sectionHeader :: Bool -- True for unnumbered |