From 447b99e35d61b9379825b53906e5517964e20072 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Thu, 18 Oct 2007 15:36:51 +0000 Subject: '--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 --- src/Text/Pandoc/Writers/HTML.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Text/Pandoc') 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 [] -- cgit v1.2.3