aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-12-18 16:31:32 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-12-18 16:33:52 -0800
commitc0cc9270cbfad719d4cd3b8c57060cb06d41fe78 (patch)
tree983da10ce9df4fcef3151c84a7cc90ac6e0cd57c /src
parent70dc5834da16680caedef4727b1d7f335f0b5427 (diff)
downloadpandoc-c0cc9270cbfad719d4cd3b8c57060cb06d41fe78.tar.gz
Org writer: don't allow fn refs to wrap to beginning of line.
Otherwise they can be interpreted as footnote definitions. Closes #4171.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Org.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
index f73822b86..b2f9bbc53 100644
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -308,7 +308,11 @@ blockListToOrg blocks = vcat <$> mapM blockToOrg blocks
inlineListToOrg :: PandocMonad m
=> [Inline]
-> Org m Doc
-inlineListToOrg lst = hcat <$> mapM inlineToOrg lst
+inlineListToOrg lst = hcat <$> mapM inlineToOrg (fixNotes lst)
+ where fixNotes [] = [] -- prevent note ref from wrapping, see #4171
+ fixNotes (Space : n@Note{} : rest) =
+ Str " " : n : fixNotes rest
+ fixNotes (x : rest) = x : fixNotes rest
-- | Convert Pandoc inline element to Org.
inlineToOrg :: PandocMonad m => Inline -> Org m Doc