From 13bc573e7f9e0602404dd37fec2c7cd14b5c56ee Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Wed, 26 Oct 2016 15:53:33 +0200 Subject: Inline code when text has a special style When a piece of text has a text 'Source_Text' then we assume that this is a piece of the document that represents a code that needs to be inlined. Addapted an odt writer to also reflect that change; previously it was just writing a 'preformatted' text using a non-distinguishable font style. Code blocks are still not recognized by the ODT reader. That's a separate issue. --- src/Text/Pandoc/Writers/OpenDocument.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Writers') diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs index 583aa2e4a..42c151780 100644 --- a/src/Text/Pandoc/Writers/OpenDocument.hs +++ b/src/Text/Pandoc/Writers/OpenDocument.hs @@ -392,7 +392,7 @@ inlineToOpenDocument o ils Subscript l -> withTextStyle Sub $ inlinesToOpenDocument o l SmallCaps l -> withTextStyle SmallC $ inlinesToOpenDocument o l Quoted t l -> inQuotes t <$> inlinesToOpenDocument o l - Code _ s -> withTextStyle Pre $ inTextStyle $ preformatted s + Code _ s -> inlinedCode $ preformatted s Math t s -> inlinesToOpenDocument o (texMathToInlines t s) Cite _ l -> inlinesToOpenDocument o l RawInline f s -> if f == Format "opendocument" @@ -403,6 +403,7 @@ inlineToOpenDocument o ils Note l -> mkNote l where preformatted s = handleSpaces $ escapeStringForXML s + inlinedCode s = return $ inTags False "text:span" [("text:style-name", "Source_Text")] s mkLink s t = inTags False "text:a" [ ("xlink:type" , "simple") , ("xlink:href" , s ) , ("office:name", t ) -- cgit v1.2.3