Don't wrap text in OpenDocument writer.

The tags are so long that it's pointless.
Use <> instead of $$ to prevent huge indents.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1730 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2009-12-31 01:17:02 +00:00
parent 2a9ac1e65a
commit 9eb4107af9

View file

@ -208,7 +208,7 @@ withParagraphStyle :: WriterOptions -> String -> [Block] -> State WriterState Do
withParagraphStyle o s (b:bs) withParagraphStyle o s (b:bs)
| Para l <- b = go =<< inParagraphTagsWithStyle s <$> inlinesToOpenDocument o l | Para l <- b = go =<< inParagraphTagsWithStyle s <$> inlinesToOpenDocument o l
| otherwise = go =<< blockToOpenDocument o b | otherwise = go =<< blockToOpenDocument o b
where go i = ($$) i <$> withParagraphStyle o s bs where go i = (<>) i <$> withParagraphStyle o s bs
withParagraphStyle _ _ [] = return empty withParagraphStyle _ _ [] = return empty
inPreformattedTags :: String -> State WriterState Doc inPreformattedTags :: String -> State WriterState Doc
@ -288,9 +288,9 @@ blocksToOpenDocument o b = vcat <$> mapM (blockToOpenDocument o) b
-- | Convert a Pandoc block element to OpenDocument. -- | Convert a Pandoc block element to OpenDocument.
blockToOpenDocument :: WriterOptions -> Block -> State WriterState Doc blockToOpenDocument :: WriterOptions -> Block -> State WriterState Doc
blockToOpenDocument o bs blockToOpenDocument o bs
| Plain b <- bs = inParagraphTags <$> wrap o b | Plain b <- bs = inParagraphTags <$> inlinesToOpenDocument o b
| Para b <- bs = inParagraphTags <$> wrap o b | Para b <- bs = inParagraphTags <$> inlinesToOpenDocument o b
| Header i b <- bs = inHeaderTags i <$> wrap o b | Header i b <- bs = inHeaderTags i <$> inlinesToOpenDocument o b
| BlockQuote b <- bs = mkBlockQuote b | BlockQuote b <- bs = mkBlockQuote b
| CodeBlock _ s <- bs = preformatted s | CodeBlock _ s <- bs = preformatted s
| RawHtml _ <- bs = return empty | RawHtml _ <- bs = return empty
@ -353,12 +353,6 @@ tableItemToOpenDocument o tn (n,i) =
in inTags True "table:table-cell" a <$> in inTags True "table:table-cell" a <$>
withParagraphStyle o n (map plainToPara i) withParagraphStyle o n (map plainToPara i)
-- | Take list of inline elements and return wrapped doc.
wrap :: WriterOptions -> [Inline] -> State WriterState Doc
wrap o l = if writerWrapText o
then fsep <$> mapM (inlinesToOpenDocument o) (splitBy Space l)
else inlinesToOpenDocument o l
-- | Convert a list of inline elements to OpenDocument. -- | Convert a list of inline elements to OpenDocument.
inlinesToOpenDocument :: WriterOptions -> [Inline] -> State WriterState Doc inlinesToOpenDocument :: WriterOptions -> [Inline] -> State WriterState Doc
inlinesToOpenDocument o l = hcat <$> mapM (inlineToOpenDocument o) l inlinesToOpenDocument o l = hcat <$> mapM (inlineToOpenDocument o) l
@ -405,7 +399,7 @@ inlineToOpenDocument o ils
let footNote t = inTags False "text:note" let footNote t = inTags False "text:note"
[ ("text:id" , "ftn" ++ show n) [ ("text:id" , "ftn" ++ show n)
, ("text:note-class", "footnote" )] $ , ("text:note-class", "footnote" )] $
inTagsSimple "text:note-citation" (text . show $ n + 1) $$ inTagsSimple "text:note-citation" (text . show $ n + 1) <>
inTagsSimple "text:note-body" t inTagsSimple "text:note-body" t
nn <- footNote <$> withParagraphStyle o "Footnote" l nn <- footNote <$> withParagraphStyle o "Footnote" l
addNote nn addNote nn