diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-10-18 15:36:51 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-10-18 15:36:51 +0000 |
commit | 447b99e35d61b9379825b53906e5517964e20072 (patch) | |
tree | cc109865ad66553e61f9c381c2b97259278d880c | |
parent | a81613df346818ff31889289b4ef82708dd1f73a (diff) | |
download | pandoc-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
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | man/man1/pandoc.1.md | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 12 |
4 files changed, 17 insertions, 9 deletions
@@ -331,8 +331,8 @@ For further documentation, see the `pandoc(1)` man page. sections are not numbered. `--no-wrap` -: disables text-wrapping in Markdown, reStructuredText, DocBook, and man - output. +: disables text-wrapping in Markdown, reStructuredText, DocBook, HTML, + and man output. `--dump-args` : is intended to make it easier to create wrapper scripts that use diff --git a/debian/changelog b/debian/changelog index dee489f59..d90aae0a7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -84,13 +84,15 @@ pandoc (0.45) unstable; urgency=low addition to "\r\n" and '\n'). * Added a writer option for wrapped text and a command-line option - '--no-wrap', which disables text wrapping. (Resolves Issue #26.) + '--no-wrap', which disables text wrapping and minimizes whitespace + in HTML. (Resolves Issue #26.) + Added support for '--no-wrap' to Main.hs. + Added wrapIfNeeded function to Text.Pandoc.Shared. + Use wrapIfNeeded instead of wrapped in the RST, Man, Docbook, and Markdown writers. - + Note: Not yet implemented in HTML, LaTeX, or ConTeXt writers. + + Added render and renderFragment helpers to HTML writer. + + Note: Not yet implemented in LaTeX or ConTeXt writers. * Modified html2markdown to run tidy only if the HTML cannot be parsed. Previously html2markdown piped all input through tidy diff --git a/man/man1/pandoc.1.md b/man/man1/pandoc.1.md index c2b3c7863..c75767913 100644 --- a/man/man1/pandoc.1.md +++ b/man/man1/pandoc.1.md @@ -115,8 +115,8 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`. them.) \--no-wrap -: Disable text wrapping in Markdown, reStructuredText, DocBook, and man - output. (Default is to wrap text.) +: Disable text wrapping in Markdown, reStructuredText, DocBook, HTML, + and man output. (Default is to wrap text.) \--toc, \--table-of-contents : Include an automatically generated table of contents (HTML, markdown, 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 [] |