diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-12-18 16:31:32 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-12-18 16:33:52 -0800 |
commit | c0cc9270cbfad719d4cd3b8c57060cb06d41fe78 (patch) | |
tree | 983da10ce9df4fcef3151c84a7cc90ac6e0cd57c | |
parent | 70dc5834da16680caedef4727b1d7f335f0b5427 (diff) | |
download | pandoc-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.
-rw-r--r-- | src/Text/Pandoc/Writers/Org.hs | 6 | ||||
-rw-r--r-- | test/command/4171.md | 11 |
2 files changed, 16 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 diff --git a/test/command/4171.md b/test/command/4171.md new file mode 100644 index 000000000..649263638 --- /dev/null +++ b/test/command/4171.md @@ -0,0 +1,11 @@ +``` +% pandoc -f org -t org +Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [fn:1] a + +[fn:1] b +^D +Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [fn:1] +a + +[fn:1] b +``` |