@@ -17,7 +17,7 @@ Org-Mode: <http://orgmode.org>
1717-}
1818module Text.Pandoc.Writers.Org (writeOrg) where
1919import Control.Monad.State.Strict
20−import Data.Char (isAlphaNum)
20+import Data.Char (isAlphaNum, isDigit)
2121import Data.List (intersect, intersperse, partition, transpose)
2222import Data.Text (Text)
2323import qualified Data.Text as T
@@ -347,16 +347,19 @@ inlineListToOrg :: PandocMonad m
347347 => [Inline]
348348 -> Org m (Doc Text)
349349inlineListToOrg 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+ -- and #7132.
352+ fixMarkers [] = []
351353 fixMarkers (Space : x : rest) | shouldFix x =
352354 Str " " : x : fixMarkers rest
353355 fixMarkers (SoftBreak : x : rest) | shouldFix x =
354356 Str " " : x : fixMarkers rest
355357 fixMarkers (x : rest) = x : fixMarkers rest
356358
357− shouldFix Note{} = True -- Prevent footnotes
359+ shouldFix Note{} = True -- Prevent footnotes
358360 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 == ')'
360363 shouldFix _ = False
361364
362365-- | Convert Pandoc inline element to Org.