diff options
-rw-r--r-- | src/Text/Pandoc/Writers/Org.hs | 11 | ||||
-rw-r--r-- | test/command/7132.md | 10 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs index 8dfc2749c..1b525831e 100644 --- a/src/Text/Pandoc/Writers/Org.hs +++ b/src/Text/Pandoc/Writers/Org.hs @@ -17,7 +17,7 @@ Org-Mode: <http://orgmode.org> -} module Text.Pandoc.Writers.Org (writeOrg) where import Control.Monad.State.Strict -import Data.Char (isAlphaNum) +import Data.Char (isAlphaNum, isDigit) import Data.List (intersect, intersperse, partition, transpose) import Data.Text (Text) import qualified Data.Text as T @@ -347,16 +347,19 @@ inlineListToOrg :: PandocMonad m => [Inline] -> Org m (Doc Text) inlineListToOrg lst = hcat <$> mapM inlineToOrg (fixMarkers lst) - where fixMarkers [] = [] -- prevent note refs and list markers from wrapping, see #4171 + where -- Prevent note refs and list markers from wrapping, see #4171 + -- and #7132. + fixMarkers [] = [] 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 Note{} = True -- Prevent footnotes shouldFix (Str "-") = True -- Prevent bullet list items - -- TODO: prevent ordered list items + shouldFix (Str x) -- Prevent ordered list items + | Just (cs, c) <- T.unsnoc x = T.all isDigit cs && c == '.' || c == ')' shouldFix _ = False -- | Convert Pandoc inline element to Org. diff --git a/test/command/7132.md b/test/command/7132.md new file mode 100644 index 000000000..30d4c0b3b --- /dev/null +++ b/test/command/7132.md @@ -0,0 +1,10 @@ +``` +% pandoc -f markdown -t org --columns=72 +- This line has exactly the wrong number of characters before the number 5. +- Long line ending with a number (this time it is in parentheses and a 23) +^D +- This line has exactly the wrong number of characters before the + number 5. +- Long line ending with a number (this time it is in parentheses and + a 23) +``` |