diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-31 01:10:17 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-31 01:10:17 +0000 |
commit | 9f126c15cf4d0f6c2ab14167e11336d4f5f8783e (patch) | |
tree | 416833a563f3be1b9e0bd72e1ec9006150e16943 /src/Text/Pandoc/Writers/OpenDocument.hs | |
parent | c602ed345959dbeb08533cd9c9c11f0604641c10 (diff) | |
download | pandoc-9f126c15cf4d0f6c2ab14167e11336d4f5f8783e.tar.gz |
Removed unneeded writer options; use template variables instead.
Removed writerIncludeAfter, writerIncludeBefore, writerTitlePrefix,
writerHeader. Removed corresponding fields of Options structure
in pandoc.hs. The options now set template variables (writerVariables)
instead.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1684 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers/OpenDocument.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/OpenDocument.hs | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs index 15e7f30bd..df08146b3 100644 --- a/src/Text/Pandoc/Writers/OpenDocument.hs +++ b/src/Text/Pandoc/Writers/OpenDocument.hs @@ -180,28 +180,29 @@ authorToOpenDocument name = -- | Convert Pandoc document to string in OpenDocument format. writeOpenDocument :: WriterOptions -> Pandoc -> String writeOpenDocument opts (Pandoc (Meta title authors date) blocks) = - let root = inTags True "office:document-content" openDocumentNameSpaces - header = when (writerStandalone opts) $ text (writerHeader opts) - title' = case runState (wrap opts title) defaultWriterState of - (t,_) -> if isEmpty t then empty else inHeaderTags 1 t - authors' = when (authors /= []) $ vcat (map authorToOpenDocument authors) - date' = when (date /= []) $ - inParagraphTagsWithStyle "Date" (text $ escapeStringForXML date) - meta = when (writerStandalone opts) $ title' $$ authors' $$ date' - before = writerIncludeBefore opts - after = writerIncludeAfter opts - (doc, s) = runState (blocksToOpenDocument opts blocks) defaultWriterState - body = (if null before then empty else text before) $$ - doc $$ - (if null after then empty else text after) - body' = if writerStandalone opts - then inTagsIndented "office:body" $ - inTagsIndented "office:text" (meta $$ body) - else body - styles = stTableStyles s ++ stParaStyles s ++ stTextStyles s - listStyle (n,l) = inTags True "text:list-style" [("style:name", "L" ++ show n)] (vcat l) - listStyles = map listStyle (stListStyles s) - in render $ header $$ root (generateStyles (styles ++ listStyles) $$ body' $$ text "") + "" -- TODO +-- let root = inTags True "office:document-content" openDocumentNameSpaces +-- header = when (writerStandalone opts) $ text (writerHeader opts) +-- title' = case runState (wrap opts title) defaultWriterState of +-- (t,_) -> if isEmpty t then empty else inHeaderTags 1 t +-- authors' = when (authors /= []) $ vcat (map authorToOpenDocument authors) +-- date' = when (date /= []) $ +-- inParagraphTagsWithStyle "Date" (text $ escapeStringForXML date) +-- meta = when (writerStandalone opts) $ title' $$ authors' $$ date' +-- before = writerIncludeBefore opts +-- after = writerIncludeAfter opts +-- (doc, s) = runState (blocksToOpenDocument opts blocks) defaultWriterState +-- body = (if null before then empty else text before) $$ +-- doc $$ +-- (if null after then empty else text after) +-- body' = if writerStandalone opts +-- then inTagsIndented "office:body" $ +-- inTagsIndented "office:text" (meta $$ body) +-- else body +-- styles = stTableStyles s ++ stParaStyles s ++ stTextStyles s +-- listStyle (n,l) = inTags True "text:list-style" [("style:name", "L" ++ show n)] (vcat l) +-- listStyles = map listStyle (stListStyles s) +-- in render $ header $$ root (generateStyles (styles ++ listStyles) $$ body' $$ text "") withParagraphStyle :: WriterOptions -> String -> [Block] -> State WriterState Doc withParagraphStyle o s (b:bs) |