git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: fixed pos calculation in tokenizing escaped space.
4855354John MacFarlane
src/Text/Pandoc/Readers/LaTeX.hs+6−3
@@ -333,13 +333,16 @@ totoks pos t =
333 -> (T.pack "\n",
333 -> (T.pack "\n",
334 T.span isSpaceOrTab r2)
334 T.span isSpaceOrTab r2)
335 _ -> (mempty, (mempty, r1))
335 _ -> (mempty, (mempty, r1))
336+ ws = "\\" <> w1 <> w2 <> w3
336 in case T.uncons r3 of
337 in case T.uncons r3 of
337 Just ('\n', _) ->
338 Just ('\n', _) ->
338 Tok pos (CtrlSeq " ") ("\\" <> w1)
339 Tok pos (CtrlSeq " ") ("\\" <> w1)
339− : totoks (incSourceColumn pos 1) r1
340+ : totoks (incSourceColumn pos (T.length ws))
341+ r1
340 _ ->
342 _ ->
341− Tok pos (CtrlSeq " ") ("\\" <> w1 <> w2 <> w3)
343+ Tok pos (CtrlSeq " ") ws
342− : totoks (incSourceColumn pos 1) r3
344+ : totoks (incSourceColumn pos (T.length ws))
345+ r3
343 | otherwise ->
346 | otherwise ->
344 Tok pos (CtrlSeq (T.singleton d)) (T.pack [c,d])
347 Tok pos (CtrlSeq (T.singleton d)) (T.pack [c,d])
345 : totoks (incSourceColumn pos 2) rest'
348 : totoks (incSourceColumn pos 2) rest'