@@ -17,7 +17,7 @@ Org-Mode: <http://orgmode.org>
18module Text.Pandoc.Writers.Org (writeOrg) where
18module Text.Pandoc.Writers.Org (writeOrg) where
19import Control.Monad.State.Strict
19import Control.Monad.State.Strict
20−import Data.Char (isAlphaNum)
20+import Data.Char (isAlphaNum, isDigit)
21import Data.List (intersect, intersperse, partition, transpose)
21import Data.List (intersect, intersperse, partition, transpose)
22import Data.Text (Text)
22import Data.Text (Text)
23import qualified Data.Text as T
23import qualified Data.Text as T
@@ -347,16 +347,19 @@ inlineListToOrg :: PandocMonad m
347 => [Inline]
347 => [Inline]
348 -> Org m (Doc Text)
348 -> Org m (Doc Text)
349inlineListToOrg lst = hcat <$> mapM inlineToOrg (fixMarkers lst)
349inlineListToOrg lst = hcat <$> mapM inlineToOrg (fixMarkers lst)
350− where fixMarkers [] = [] -- prevent note refs and list markers from wrapping, see #4171
350+ where -- Prevent note refs and list markers from wrapping, see #4171
351 fixMarkers (Space : x : rest) | shouldFix x =
353 fixMarkers (Space : x : rest) | shouldFix x =
352 Str " " : x : fixMarkers rest
354 Str " " : x : fixMarkers rest
353 fixMarkers (SoftBreak : x : rest) | shouldFix x =
355 fixMarkers (SoftBreak : x : rest) | shouldFix x =
354 Str " " : x : fixMarkers rest
356 Str " " : x : fixMarkers rest
355 fixMarkers (x : rest) = x : fixMarkers rest
357 fixMarkers (x : rest) = x : fixMarkers rest
357− shouldFix Note{} = True -- Prevent footnotes
359+ shouldFix Note{} = True -- Prevent footnotes
358 shouldFix (Str "-") = True -- Prevent bullet list items
360 shouldFix (Str "-") = True -- Prevent bullet list items
359− -- TODO: prevent ordered list items
361+ shouldFix (Str x) -- Prevent ordered list items
362+ | Just (cs, c) <- T.unsnoc x = T.all isDigit cs && c == '.' || c == ')'
360 shouldFix _ = False
363 shouldFix _ = False
362-- | Convert Pandoc inline element to Org.
365-- | Convert Pandoc inline element to Org.