git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: fixed pos calculation in tokenizing escaped space.
commit485535464df27f5c2e2dd144650af318bde239c1 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 13 Jan 2018, 22:04 (9 years ago) parent50b64bc
1 file changed+6−3
src/Text/Pandoc/Readers/LaTeX.hs+6−3
src/Text/Pandoc/Readers/LaTeX.hs+6−3
@@ -333,13 +333,16 @@ totoks pos t =
333333 -> (T.pack "\n",
334334 T.span isSpaceOrTab r2)
335335 _ -> (mempty, (mempty, r1))
336+ ws = "\\" <> w1 <> w2 <> w3
336337 in case T.uncons r3 of
337338 Just ('\n', _) ->
338339 Tok pos (CtrlSeq " ") ("\\" <> w1)
339− : totoks (incSourceColumn pos 1) r1
340+ : totoks (incSourceColumn pos (T.length ws))
341+ r1
340342 _ ->
341− Tok pos (CtrlSeq " ") ("\\" <> w1 <> w2 <> w3)
342− : totoks (incSourceColumn pos 1) r3
343+ Tok pos (CtrlSeq " ") ws
344+ : totoks (incSourceColumn pos (T.length ws))
345+ r3
343346 | otherwise ->
344347 Tok pos (CtrlSeq (T.singleton d)) (T.pack [c,d])
345348 : totoks (incSourceColumn pos 2) rest'