summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Docx.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-06-25 10:38:11 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-06-25 12:46:26 +0200
commit083a224d1e3d791c459a998d18aa9975b8816c15 (patch)
tree57e0ab4c43e307a7627b79edd683582f4ba09841 /src/Text/Pandoc/Writers/Docx.hs
parenta02f08c9fc608727da0ac3b65b39f627e8bb2033 (diff)
Support `lang` attribute in OpenDocument and ODT writers.
This adds the required attributes to the temporary styles, and also replaces existing language attributes in styles.xml. Support for lang attributes on Div and Span has also been added. Closes #1667.
Diffstat (limited to 'src/Text/Pandoc/Writers/Docx.hs')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index b488f2479..d93b99486 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -67,7 +67,7 @@ import Text.Pandoc.Shared hiding (Element)
import qualified Text.Pandoc.UTF8 as UTF8
import Text.Pandoc.Walk
import Text.Pandoc.Writers.Math
-import Text.Pandoc.Writers.Shared (fixDisplayMath)
+import Text.Pandoc.Writers.Shared (fixDisplayMath, getLang)
import Text.Printf (printf)
import Text.TeXMath
import Text.XML.Light as XML
@@ -257,10 +257,7 @@ writeDocx opts doc@(Pandoc meta _) = do
)
-- styles
- let lang = case lookupMeta "lang" meta of
- Just (MetaInlines [Str s]) -> Just s
- Just (MetaString s) -> Just s
- _ -> Nothing
+ let lang = getLang opts meta
let addLang :: Element -> Element
addLang e = case lang >>= \l -> (return . XMLC.toTree . go l . XMLC.fromElement) e of
Just (Elem e') -> e'