diff options
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index df3d56037..af3717b10 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -261,10 +261,15 @@ writeDocx opts doc@(Pandoc meta _) = do let tocTitle = fromMaybe (stTocTitle defaultWriterState) $ metaValueToInlines <$> lookupMeta "toc-title" meta + let isRTL = case lookupMeta "dir" meta of + Just (MetaString "rtl") -> True + Just (MetaInlines [Str "rtl"]) -> True + _ -> False + ((contents, footnotes), st) <- runStateT ( runReaderT (writeOpenXML opts{writerWrapText = WrapNone} doc') - defaultWriterEnv + defaultWriterEnv { envRTL = isRTL } ) defaultWriterState{ stChangesAuthor = fromMaybe "unknown" username , stChangesDate = formatTime defaultTimeLocale "%FT%XZ" utctime , stPrintWidth = (maybe 420 (\x -> quot x 20) pgContentWidth) @@ -719,7 +724,7 @@ makeTOC _ = return [] writeOpenXML :: WriterOptions -> Pandoc -> WS ([Element], [Element]) writeOpenXML opts (Pandoc meta blocks) = do isRTL <- asks envRTL - (if isRTL then setRTL else id) $ do + (if isRTL then (setRTL True) else id) $ do let tit = docTitle meta ++ case lookupMeta "subtitle" meta of Just (MetaBlocks [Plain xs]) -> LineBreak : xs _ -> [] |