aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-03-29 10:29:41 -0700
committerJohn MacFarlane <[email protected]>2025-03-29 18:36:18 -0700
commit3a0743e815c9af28669828a5df2ccab0eefbc306 (patch)
tree2d8f2af6b77f41083a37e98f560164d36d4dfc2e
parentb526c504ea1223e75756de9ede29a4df017ae1a1 (diff)
Org reader: don't include newlines in inine code/verbatim.
Convert newlines to spaces as we do in other formats. Closes #10730.
-rw-r--r--src/Text/Pandoc/Readers/Org/Inlines.hs6
-rw-r--r--test/command/10730.md7
2 files changed, 10 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Inlines.hs b/src/Text/Pandoc/Readers/Org/Inlines.hs
index b5b48257f..b4d732a74 100644
--- a/src/Text/Pandoc/Readers/Org/Inlines.hs
+++ b/src/Text/Pandoc/Readers/Org/Inlines.hs
@@ -635,11 +635,11 @@ emphasisBetween c = try $ do
verbatimBetween :: PandocMonad m
=> Char
-> OrgParser m Text
-verbatimBetween c = try $
- emphasisStart c *>
- many1TillNOrLessNewlines 1 verbatimChar (emphasisEnd c)
+verbatimBetween c = newlinesToSpaces <$>
+ try (emphasisStart c *> many1TillNOrLessNewlines 1 verbatimChar (emphasisEnd c))
where
verbatimChar = noneOf "\n\r" >>= updatePositions
+ newlinesToSpaces = T.map (\d -> if d == '\n' then ' ' else d)
-- | Parses a raw string delimited by @c@ using Org's math rules
mathTextBetween :: PandocMonad m
diff --git a/test/command/10730.md b/test/command/10730.md
new file mode 100644
index 000000000..c9b696a5b
--- /dev/null
+++ b/test/command/10730.md
@@ -0,0 +1,7 @@
+```
+% pandoc -f org -t native
+=hi
+there=
+^D
+[ Para [ Code ( "" , [ "verbatim" ] , [] ) "hi there" ] ]
+```