git.iko.soy/typeable/pandoc
on master help sign in
Org writer: don't allow fn refs to wrap to beginning of line.

Otherwise they can be interpreted as footnote definitions. Closes #4171.

commitc0cc9270cbfad719d4cd3b8c57060cb06d41fe78 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 18 Dec 2017, 16:31 (9 years ago) parent70dc583
2 files changed+16−1
src/Text/Pandoc/Writers/Org.hs+5−1 test/command/4171.md+11
src/Text/Pandoc/Writers/Org.hs+5−1
@@ -308,7 +308,11 @@ blockListToOrg blocks = vcat <$> mapM blockToOrg blocks
308308inlineListToOrg :: PandocMonad m
309309 => [Inline]
310310 -> Org m Doc
311−inlineListToOrg lst = hcat <$> mapM inlineToOrg lst
311+inlineListToOrg lst = hcat <$> mapM inlineToOrg (fixNotes lst)
312+ where fixNotes [] = [] -- prevent note ref from wrapping, see #4171
313+ fixNotes (Space : n@Note{} : rest) =
314+ Str " " : n : fixNotes rest
315+ fixNotes (x : rest) = x : fixNotes rest
312316
313317-- | Convert Pandoc inline element to Org.
314318inlineToOrg :: PandocMonad m => Inline -> Org m Doc
test/command/4171.mdnew file+11
@@ -0,0 +1,11 @@
1+```
2+% pandoc -f org -t org
3+Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [fn:1] a
4+
5+[fn:1] b
6+^D
7+Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [fn:1]
8+a
9+
10+[fn:1] b
11+```