summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2017-12-21 16:36:29 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2017-12-21 16:36:29 +0300
commitd035689a0646261d7a4731e39bce7dbf85187773 (patch)
tree6488bec057f75aac850d39818852ac9a68ec6b70 /src/Text
parent0405c5b461ee8d9a57eacc5ff2b44fafa5c0637f (diff)
Org writer: do not wrap "-" to avoid accidental bullet lists
Also add TODO for ordered lists.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/Org.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
index e10fcd5ce..43b5b59ee 100644
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -308,13 +308,18 @@ blockListToOrg blocks = vcat <$> mapM blockToOrg blocks
inlineListToOrg :: PandocMonad m
=> [Inline]
-> Org m Doc
-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 (SoftBreak : n@Note{} : rest) =
- Str " " : n : fixNotes rest
- fixNotes (x : rest) = x : fixNotes rest
+inlineListToOrg lst = hcat <$> mapM inlineToOrg (fixMarkers lst)
+ where fixMarkers [] = [] -- prevent note refs and list markers from wrapping, see #4171
+ fixMarkers (Space : x : rest) | shouldFix x =
+ Str " " : x : fixMarkers rest
+ fixMarkers (SoftBreak : x : rest) | shouldFix x =
+ Str " " : x : fixMarkers rest
+ fixMarkers (x : rest) = x : fixMarkers rest
+
+ shouldFix Note{} = True -- Prevent footnotes
+ shouldFix (Str "-") = True -- Prevent bullet list items
+ -- TODO: prevent ordered list items
+ shouldFix _ = False
-- | Convert Pandoc inline element to Org.
inlineToOrg :: PandocMonad m => Inline -> Org m Doc