summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Shared.hs
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2018-01-12 11:06:03 -0500
committerJesse Rosenthal <jrosenthal@jhu.edu>2018-01-12 11:06:03 -0500
commit6d74b357511a3d84eb27d18dff51383cfa869cb5 (patch)
treefb1f42c824a4183271519f87524968e9cc0939e6 /src/Text/Pandoc/Writers/Shared.hs
parent1d9c2770e3025b1b08463577eac499eb475e5bcf (diff)
Move `metaValueToInlines` to T.P.W.Shared
This will allow the Powerpoint writer to use it as well.
Diffstat (limited to 'src/Text/Pandoc/Writers/Shared.hs')
-rw-r--r--src/Text/Pandoc/Writers/Shared.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index 713e4289e..ae4cc5cc5 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -40,6 +40,7 @@ module Text.Pandoc.Writers.Shared (
, fixDisplayMath
, unsmartify
, gridTable
+ , metaValueToInlines
)
where
import Control.Monad (zipWithM)
@@ -55,6 +56,7 @@ import qualified Text.Pandoc.Builder as Builder
import Text.Pandoc.Definition
import Text.Pandoc.Options
import Text.Pandoc.Pretty
+import Text.Pandoc.Walk (query)
import Text.Pandoc.UTF8 (toStringLazy)
import Text.Pandoc.XML (escapeStringForXML)
@@ -308,3 +310,10 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do
head'' $$
body $$
border '-' (repeat AlignDefault) widthsInChars
+
+metaValueToInlines :: MetaValue -> [Inline]
+metaValueToInlines (MetaString s) = [Str s]
+metaValueToInlines (MetaInlines ils) = ils
+metaValueToInlines (MetaBlocks bs) = query return bs
+metaValueToInlines (MetaBool b) = [Str $ show b]
+metaValueToInlines _ = []