git.iko.soy/typeable/pandoc
on master help sign in
Move `metaValueToInlines` to T.P.W.Shared

This will allow the Powerpoint writer to use it as well.

commit6d74b357511a3d84eb27d18dff51383cfa869cb5 authorJesse Rosenthal <jrosenthal@jhu.edu> dateFri 12 Jan 2018, 11:06 (9 years ago) parent1d9c277
2 files changed+10−11
src/Text/Pandoc/Writers/Docx.hs+1−11 src/Text/Pandoc/Writers/Shared.hs+9
src/Text/Pandoc/Writers/Docx.hs+1−11
@@ -1,4 +1,3 @@
1−
21{-# LANGUAGE PatternGuards #-}
32{-# LANGUAGE RankNTypes #-}
43{-# LANGUAGE ScopedTypeVariables #-}
@@ -65,7 +64,7 @@ import Text.Pandoc.Readers.Docx.StyleMap
6564import Text.Pandoc.Shared hiding (Element)
6665import Text.Pandoc.Walk
6766import Text.Pandoc.Writers.Math
68−import Text.Pandoc.Writers.Shared (fixDisplayMath)
67+import Text.Pandoc.Writers.Shared (fixDisplayMath, metaValueToInlines)
6968import Text.Printf (printf)
7069import Text.TeXMath
7170import Text.XML.Light as XML
@@ -196,15 +195,6 @@ isValidChar (ord -> c)
196195 | 0x10000 <= c && c <= 0x10FFFF = True
197196 | otherwise = False
198197
199−metaValueToInlines :: MetaValue -> [Inline]
200−metaValueToInlines (MetaString s) = [Str s]
201−metaValueToInlines (MetaInlines ils) = ils
202−metaValueToInlines (MetaBlocks bs) = query return bs
203−metaValueToInlines (MetaBool b) = [Str $ show b]
204−metaValueToInlines _ = []
205−
206−
207−
208198writeDocx :: (PandocMonad m)
209199 => WriterOptions -- ^ Writer options
210200 -> Pandoc -- ^ Document to convert
src/Text/Pandoc/Writers/Shared.hs+9
@@ -40,6 +40,7 @@ module Text.Pandoc.Writers.Shared (
4040 , fixDisplayMath
4141 , unsmartify
4242 , gridTable
43+ , metaValueToInlines
4344 )
4445where
4546import Control.Monad (zipWithM)
@@ -55,6 +56,7 @@ import qualified Text.Pandoc.Builder as Builder
5556import Text.Pandoc.Definition
5657import Text.Pandoc.Options
5758import Text.Pandoc.Pretty
59+import Text.Pandoc.Walk (query)
5860import Text.Pandoc.UTF8 (toStringLazy)
5961import Text.Pandoc.XML (escapeStringForXML)
6062
@@ -308,3 +310,10 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do
308310 head'' $$
309311 body $$
310312 border '-' (repeat AlignDefault) widthsInChars
313+
314+metaValueToInlines :: MetaValue -> [Inline]
315+metaValueToInlines (MetaString s) = [Str s]
316+metaValueToInlines (MetaInlines ils) = ils
317+metaValueToInlines (MetaBlocks bs) = query return bs
318+metaValueToInlines (MetaBool b) = [Str $ show b]
319+metaValueToInlines _ = []