git.iko.soy/typeable/pandoc
on master help sign in
Fixed regression in LateX tokenization.
044d58bJohn MacFarlane
src/Text/Pandoc/Readers/LaTeX.hs+2−2
@@ -320,7 +320,7 @@ totoks pos t =
320 : totoks (incSourceColumn pos (1 + T.length cs)) rest'
320 : totoks (incSourceColumn pos (1 + T.length cs)) rest'
321 | c == '\\' ->
321 | c == '\\' ->
322 case T.uncons rest of
322 case T.uncons rest of
323− Nothing -> [Tok pos Symbol (T.singleton c)]
323+ Nothing -> [Tok pos (CtrlSeq " ") "\\"]
324 Just (d, rest')
324 Just (d, rest')
325 | isLetterOrAt d ->
325 | isLetterOrAt d ->
326 -- \makeatletter is common in macro defs;
326 -- \makeatletter is common in macro defs;
@@ -338,7 +338,7 @@ totoks pos t =
338 Just ('\n', r2)
338 Just ('\n', r2)
339 -> (T.pack "\n",
339 -> (T.pack "\n",
340 T.span isSpaceOrTab r2)
340 T.span isSpaceOrTab r2)
341− _ -> (mempty, (w1, r1))
341+ _ -> (mempty, (mempty, r1))
342 in case T.uncons r3 of
342 in case T.uncons r3 of
343 Just ('\n', _) ->
343 Just ('\n', _) ->
344 Tok pos (CtrlSeq " ") ("\\" <> w1)
344 Tok pos (CtrlSeq " ") ("\\" <> w1)
test/command/4159.mdnew file+8
@@ -0,0 +1,8 @@
1+```
2+% pandoc -f markdown -t native
3+\newcommand{\gen}{a\ Gen\ b}
4+abc
5+^D
6+[RawBlock (Format "latex") "\\newcommand{\\gen}{a\\ Gen\\ b}"
7+,Para [Str "abc"]]
8+```