mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-10 17:45:49 +00:00
Added 'stringify' to Text.Pandoc.Shared.
This commit is contained in:
@@ -57,6 +57,7 @@ module Text.Pandoc.Shared (
|
||||
-- * Pandoc block and inline list processing
|
||||
orderedListMarkers,
|
||||
normalizeSpaces,
|
||||
stringify,
|
||||
compactify,
|
||||
Element (..),
|
||||
hierarchicalize,
|
||||
@@ -340,6 +341,15 @@ normalizeSpaces list =
|
||||
else lst
|
||||
in removeLeading $ removeTrailing $ removeDoubles list
|
||||
|
||||
-- | Convert list of inlines to a string with formatting removed.
|
||||
stringify :: [Inline] -> String
|
||||
stringify = queryWith go
|
||||
where go :: Inline -> [Char]
|
||||
go Space = " "
|
||||
go (Str x) = x
|
||||
go (Code x) = x
|
||||
go _ = ""
|
||||
|
||||
-- | Change final list item from @Para@ to @Plain@ if the list contains
|
||||
-- no other @Para@ blocks.
|
||||
compactify :: [[Block]] -- ^ List of list items (each a list of blocks)
|
||||
|
||||
Reference in New Issue
Block a user