diff options
| author | John MacFarlane <[email protected]> | 2023-08-04 10:27:10 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-08-04 10:27:10 -0700 |
| commit | 655d87657e568b889283fae51d2d6eeaa1736c30 (patch) | |
| tree | 64d41045051307c0b8415b6983ee3cd5c1006eca | |
| parent | aa21f79e89fcd6aad1d66845238e976fdc0bce98 (diff) | |
Support highlighted text in ODT/OpenDocument writers.
See #8960.
This is a prelimary fix. A better fix would use a named style
so colors could be adjusted.
| -rw-r--r-- | src/Text/Pandoc/Writers/OpenDocument.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs index feea97d8e..e54322e8b 100644 --- a/src/Text/Pandoc/Writers/OpenDocument.hs +++ b/src/Text/Pandoc/Writers/OpenDocument.hs @@ -594,6 +594,8 @@ inlineToOpenDocument o ils | writerWrapText o == WrapPreserve -> return $ preformatted "\n" | otherwise -> return space + Span ("", ["mark"], []) xs -> + withTextStyle Highlight $ inlinesToOpenDocument o xs Span attr xs -> mkSpan attr xs LineBreak -> return $ selfClosingTag "text:line-break" [] Str s -> return $ handleSpaces $ escapeStringForXML s @@ -864,6 +866,7 @@ data TextStyle = Italic | Sup | SmallC | Pre + | Highlight | Language Lang deriving ( Eq,Ord ) @@ -884,6 +887,7 @@ textStyleAttr m = \case Sub -> Map.insert "style:text-position" "sub 58%" m Sup -> Map.insert "style:text-position" "super 58%" m SmallC -> Map.insert "fo:font-variant" "small-caps" m + Highlight -> Map.insert "fo:background-color" "#ffff38" m Pre -> Map.insert "style:font-name" "Courier New" . Map.insert "style:font-name-asian" "Courier New" . Map.insert "style:font-name-complex" "Courier New" $ m |
