aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-10-18 15:36:51 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-10-18 15:36:51 +0000
commit447b99e35d61b9379825b53906e5517964e20072 (patch)
treecc109865ad66553e61f9c381c2b97259278d880c /src/Text/Pandoc
parenta81613df346818ff31889289b4ef82708dd1f73a (diff)
downloadpandoc-447b99e35d61b9379825b53906e5517964e20072.tar.gz
'--no-wrap' option now prevents the addition of structural whitespace
in HTML output, minimizing the file size. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1053 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 43c3cce4b..7ec95d8ef 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -51,12 +51,18 @@ defaultWriterState :: WriterState
defaultWriterState = WriterState {stNotes= [], stIds = [],
stMath = False, stCSS = S.empty}
+-- Helpers to render HTML with the appropriate function.
+render opts = if writerWrapText opts then renderHtml else showHtml
+renderFragment opts = if writerWrapText opts
+ then renderHtmlFragment
+ else showHtmlFragment
+
-- | Convert Pandoc document to Html string.
writeHtmlString :: WriterOptions -> Pandoc -> String
writeHtmlString opts =
if writerStandalone opts
- then renderHtml . writeHtml opts
- else renderHtmlFragment . writeHtml opts
+ then render opts . writeHtml opts
+ else renderFragment opts . writeHtml opts
-- | Convert Pandoc document to Html structure.
writeHtml :: WriterOptions -> Pandoc -> Html
@@ -406,7 +412,7 @@ inlineToHtml opts inline =
linkText
(Image txt (source,tit)) -> do
alternate <- inlineListToHtml opts txt
- let alternate' = renderHtmlFragment alternate
+ let alternate' = renderFragment opts alternate
let attributes = [src source] ++
(if null tit
then []