diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2016-10-03 18:28:53 -0400 |
---|---|---|
committer | Jesse Rosenthal <jrosenthal@jhu.edu> | 2016-10-03 21:39:40 -0400 |
commit | e98be61a3855c5f19946c3be757cd6f071b184b3 (patch) | |
tree | 9bfd14f4aa69c33159a84b817539e8ebf2da2a21 /src/Text | |
parent | 8d148c02a821ff3b15cc67f0f63521e8cd21a994 (diff) | |
download | pandoc-e98be61a3855c5f19946c3be757cd6f071b184b3.tar.gz |
Test for "dir" metadata.
Diffstat (limited to 'src/Text')
-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 _ -> [] |