When parsing raw LaTeX commands, include trailing space.
Otherwise things like `\noindent foo` break and turn into `\noindentfoo`. Affects `-f latex+raw_tex` and `-f markdown` (and other formats that allow `raw_tex`). Closes #1773.
This commit is contained in:
parent
e51b32a475
commit
f4a452f891
3 changed files with 9 additions and 3 deletions
|
@ -435,7 +435,7 @@ section (ident, classes, kvs) lvl = do
|
|||
|
||||
inlineCommand :: PandocMonad m => LP m Inlines
|
||||
inlineCommand = try $ do
|
||||
name <- anyControlSeq
|
||||
(name, raw') <- withRaw anyControlSeq
|
||||
guard $ name /= "begin" && name /= "end"
|
||||
guard $ not $ isBlockCommand name
|
||||
exts <- getOption readerExtensions
|
||||
|
@ -444,7 +444,7 @@ inlineCommand = try $ do
|
|||
let raw = do
|
||||
rawargs <- withRaw
|
||||
(skipangles *> skipopts *> option "" dimenarg *> many braced)
|
||||
let rawcommand = '\\' : name ++ star ++ snd rawargs
|
||||
let rawcommand = raw' ++ star ++ snd rawargs
|
||||
transformed <- applyMacros' rawcommand
|
||||
if transformed /= rawcommand
|
||||
then parseFromString inlines transformed
|
||||
|
|
6
test/command/1773.md
Normal file
6
test/command/1773.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
```
|
||||
% pandoc -f latex+raw_tex -t native
|
||||
\noindent hi
|
||||
^D
|
||||
[Para [RawInline (Format "latex") "\\noindent ",Str "hi"]]
|
||||
```
|
|
@ -261,7 +261,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
|
|||
,Header 1 ("latex",[],[]) [Str "LaTeX"]
|
||||
,BulletList
|
||||
[[Para [Cite [Citation {citationId = "smith.1899", citationPrefix = [], citationSuffix = [Str "22-23"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cite[22-23]{smith.1899}"]]]
|
||||
,[Para [RawInline (Format "latex") "\\doublespacing"]]
|
||||
,[Para [RawInline (Format "latex") "\\doublespacing\n"]]
|
||||
,[Para [Math InlineMath "2+2=4"]]
|
||||
,[Para [Math InlineMath "x \\in y"]]
|
||||
,[Para [Math InlineMath "\\alpha \\wedge \\omega"]]
|
||||
|
|
Loading…
Reference in a new issue