git.iko.soy/typeable/pandoc
on master help sign in
Test for "dir" metadata.
commite98be61a3855c5f19946c3be757cd6f071b184b3 authorJesse Rosenthal <jrosenthal@jhu.edu> dateMon 3 Oct 2016, 18:28 (10 years ago) parent8d148c0
1 file changed+7−2
src/Text/Pandoc/Writers/Docx.hs+7−2
src/Text/Pandoc/Writers/Docx.hs+7−2
@@ -261,10 +261,15 @@ writeDocx opts doc@(Pandoc meta _) = do
261261 let tocTitle = fromMaybe (stTocTitle defaultWriterState) $
262262 metaValueToInlines <$> lookupMeta "toc-title" meta
263263
264+ let isRTL = case lookupMeta "dir" meta of
265+ Just (MetaString "rtl") -> True
266+ Just (MetaInlines [Str "rtl"]) -> True
267+ _ -> False
268+
264269 ((contents, footnotes), st) <- runStateT (
265270 runReaderT
266271 (writeOpenXML opts{writerWrapText = WrapNone} doc')
267− defaultWriterEnv
272+ defaultWriterEnv { envRTL = isRTL }
268273 ) defaultWriterState{ stChangesAuthor = fromMaybe "unknown" username
269274 , stChangesDate = formatTime defaultTimeLocale "%FT%XZ" utctime
270275 , stPrintWidth = (maybe 420 (\x -> quot x 20) pgContentWidth)
@@ -719,7 +724,7 @@ makeTOC _ = return []
719724writeOpenXML :: WriterOptions -> Pandoc -> WS ([Element], [Element])
720725writeOpenXML opts (Pandoc meta blocks) = do
721726 isRTL <- asks envRTL
722− (if isRTL then setRTL else id) $ do
727+ (if isRTL then (setRTL True) else id) $ do
723728 let tit = docTitle meta ++ case lookupMeta "subtitle" meta of
724729 Just (MetaBlocks [Plain xs]) -> LineBreak : xs
725730 _ -> []