mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
LaTeX writer: avoid \_ in bibliography variable.
Since underscores are common in filenames, and pandoc will
render strings to variables using default LaTeX escaping, we
special-case `bibliography`, under the assumption that this variable
will be used in the context of the `\bibliography{..}` command,
which accepts unescaped underscores.
Closes #11152.
This commit is contained in:
@@ -215,7 +215,15 @@ pandocToLaTeX options (Pandoc meta blocks) = do
|
||||
_ -> [])
|
||||
$ lookupMetaInlines "nocite" meta
|
||||
|
||||
let context = defField "toc" (writerTableOfContents options) $
|
||||
-- see #7414, avoid escaped underscores
|
||||
let unescapeUnderscore = T.replace "\\_" "_"
|
||||
let bibliography' = map unescapeUnderscore <$>
|
||||
getField "bibliography" metadata
|
||||
|
||||
let context = (case bibliography' of
|
||||
Nothing -> id
|
||||
Just xs -> resetField "bibliography" xs) $
|
||||
defField "toc" (writerTableOfContents options) $
|
||||
defField "lof" (writerListOfFigures options) $
|
||||
defField "lot" (writerListOfTables options) $
|
||||
defField "toc-depth" (tshow
|
||||
|
||||
@@ -98,7 +98,7 @@ Pandoc
|
||||
[ Para [ Str "Code in a block quote:" ]
|
||||
, CodeBlock
|
||||
( "" , [ "" ] , [] )
|
||||
"sub status {\nprint \"working\";\n}\n"
|
||||
"sub status {\n print \"working\";\n}\n"
|
||||
, Para [ Str "A list:" ]
|
||||
, OrderedList
|
||||
( 1 , Decimal , Period )
|
||||
|
||||
Reference in New Issue
Block a user