diff options
author | oltolm <oleg.tolmatcev@gmail.com> | 2014-08-30 22:57:59 +0200 |
---|---|---|
committer | oltolm <oleg.tolmatcev@gmail.com> | 2017-12-28 22:10:04 +0100 |
commit | 19bab48dccd670e272a6f949321de5413eb96136 (patch) | |
tree | 0cf8115cad7f8f7b381f69b2715e55c21c124d01 /src/Text/Pandoc/Writers/OpenDocument.hs | |
parent | 7e8cfc099017b554dc4105a8c56544867784a9f8 (diff) | |
download | pandoc-19bab48dccd670e272a6f949321de5413eb96136.tar.gz |
improve formatting of formulas in OpenDocument
Diffstat (limited to 'src/Text/Pandoc/Writers/OpenDocument.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/OpenDocument.hs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs index 8aa19dbb5..dc7d14d05 100644 --- a/src/Text/Pandoc/Writers/OpenDocument.hs +++ b/src/Text/Pandoc/Writers/OpenDocument.hs @@ -173,6 +173,24 @@ inTextStyle d = do return $ inTags False "text:span" [("text:style-name",styleName)] d +formulaStyles :: [Doc] +formulaStyles = [formulaStyle InlineMath, formulaStyle DisplayMath] + +formulaStyle :: MathType -> Doc +formulaStyle mt = inTags False "style:style" + [("style:name", if mt == InlineMath then "fr1" else "fr2") + ,("style:family", "graphic") + ,("style:parent-style-name", "Formula")] + $ selfClosingTag "style:graphic-properties" $ if mt == InlineMath then + [("style:vertical-pos", "middle") + ,("style:vertical-rel", "text")] + else + [("style:vertical-pos", "middle") + ,("style:vertical-rel", "paragraph-content") + ,("style:horizontal-pos", "center") + ,("style:horizontal-rel", "paragraph-content") + ,("style:wrap", "none")] + inHeaderTags :: PandocMonad m => Int -> Doc -> OD m Doc inHeaderTags i d = return $ inTags False "text:h" [ ("text:style-name", "Heading_20_" ++ show i) @@ -211,7 +229,7 @@ writeOpenDocument opts (Pandoc meta blocks) = do meta b <- render' `fmap` blocksToOpenDocument opts blocks return (b, m) - let styles = stTableStyles s ++ stParaStyles s ++ + let styles = stTableStyles s ++ stParaStyles s ++ formulaStyles ++ map snd (sortBy (flip (comparing fst)) ( Map.elems (stTextStyles s))) listStyle (n,l) = inTags True "text:list-style" |