aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2021-10-04 09:07:15 -0700
committerJohn MacFarlane <[email protected]>2021-10-04 09:07:15 -0700
commit97ed04f36f0e82fa68675bbfa1911ca314fa825c (patch)
treea916609383e472ece024699d78893d0d9a70b6e1
parenta553f9fa6af4008c603c97332ce9653f60b53ce4 (diff)
Fixes for Str " ".
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/Math.hs2
-rw-r--r--src/Text/Pandoc/Readers/Org/Blocks.hs16
2 files changed, 10 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/Math.hs b/src/Text/Pandoc/Readers/LaTeX/Math.hs
index 2143e0f19..23914cd96 100644
--- a/src/Text/Pandoc/Readers/LaTeX/Math.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/Math.hs
@@ -200,7 +200,7 @@ addTitle :: Inlines -> Blocks -> Blocks
addTitle ils bs =
case B.toList bs of
(Para xs : rest)
- -> B.fromList (Para (B.toList ils ++ (Str " " : xs)) : rest)
+ -> B.para (ils <> B.str " " <> B.fromList xs) <> B.fromList rest
_ -> B.para ils <> bs
addQed :: Blocks -> Blocks
diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs
index 12012a8bc..c5610fcca 100644
--- a/src/Text/Pandoc/Readers/Org/Blocks.hs
+++ b/src/Text/Pandoc/Readers/Org/Blocks.hs
@@ -873,8 +873,8 @@ checkbox = do
, SemicheckedBox <$ char '-'
]
-checkboxToInlines :: Checkbox -> Inline
-checkboxToInlines = B.Str . \case
+checkboxToInlines :: Checkbox -> Inlines
+checkboxToInlines b = B.str $ case b of
UncheckedBox -> "☐"
SemicheckedBox -> "☐"
CheckedBox -> "☒"
@@ -897,12 +897,14 @@ listItem parseIndentedMarker = try . withContext ListItemState $ do
-- | Prepend inlines to blocks, adding them to the first paragraph or
-- creating a new Plain element if necessary.
-prependInlines :: Inline -> Blocks -> Blocks
-prependInlines inlns = B.fromList . prepend . B.toList
+prependInlines :: Inlines -> Blocks -> Blocks
+prependInlines il = prepend . B.toList
where
- prepend (Plain is : bs) = Plain (inlns : Str " " : is) : bs
- prepend (Para is : bs) = Para (inlns : Str " " : is) : bs
- prepend bs = Plain [inlns, Str " "] : bs
+ prepend (Plain is : bs) = B.plain (il <> B.str " " <> B.fromList is) <>
+ B.fromList bs
+ prepend (Para is : bs) = B.para (il <> B.str " " <> B.fromList is) <>
+ B.fromList bs
+ prepend bs = B.plain (il <> B.str " ") <> B.fromList bs
-- continuation of a list item - indented and separated by blankline or endline.
-- Note: nested lists are parsed as continuations.