git.iko.soy/typeable/pandoc
on master help sign in
'--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

commit447b99e35d61b9379825b53906e5517964e20072 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateThu 18 Oct 2007, 15:36 (19 years ago) parenta81613d
4 files changed+17−9
README+2−2 debian/changelog+4−2 man/man1/pandoc.1.md+2−2 src/Text/Pandoc/Writers/HTML.hs+9−3
README+2−2
@@ -331,8 +331,8 @@ For further documentation, see the `pandoc(1)` man page.
331331 sections are not numbered.
332332
333333`--no-wrap`
334−: disables text-wrapping in Markdown, reStructuredText, DocBook, and man
335− output.
334+: disables text-wrapping in Markdown, reStructuredText, DocBook, HTML,
335+ and man output.
336336
337337`--dump-args`
338338: is intended to make it easier to create wrapper scripts that use
debian/changelog+4−2
@@ -84,13 +84,15 @@ pandoc (0.45) unstable; urgency=low
8484 addition to "\r\n" and '\n').
8585
8686 * Added a writer option for wrapped text and a command-line option
87− '--no-wrap', which disables text wrapping. (Resolves Issue #26.)
87+ '--no-wrap', which disables text wrapping and minimizes whitespace
88+ in HTML. (Resolves Issue #26.)
8889
8990 + Added support for '--no-wrap' to Main.hs.
9091 + Added wrapIfNeeded function to Text.Pandoc.Shared.
9192 + Use wrapIfNeeded instead of wrapped in the RST, Man, Docbook, and
9293 Markdown writers.
93− + Note: Not yet implemented in HTML, LaTeX, or ConTeXt writers.
94+ + Added render and renderFragment helpers to HTML writer.
95+ + Note: Not yet implemented in LaTeX or ConTeXt writers.
9496
9597 * Modified html2markdown to run tidy only if the HTML cannot be
9698 parsed. Previously html2markdown piped all input through tidy
man/man1/pandoc.1.md+2−2
@@ -115,8 +115,8 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`.
115115 them.)
116116
117117\--no-wrap
118−: Disable text wrapping in Markdown, reStructuredText, DocBook, and man
119− output. (Default is to wrap text.)
118+: Disable text wrapping in Markdown, reStructuredText, DocBook, HTML,
119+ and man output. (Default is to wrap text.)
120120
121121\--toc, \--table-of-contents
122122: Include an automatically generated table of contents (HTML, markdown,
src/Text/Pandoc/Writers/HTML.hs+9−3
@@ -51,12 +51,18 @@ defaultWriterState :: WriterState
5151defaultWriterState = WriterState {stNotes= [], stIds = [],
5252 stMath = False, stCSS = S.empty}
5353
54+-- Helpers to render HTML with the appropriate function.
55+render opts = if writerWrapText opts then renderHtml else showHtml
56+renderFragment opts = if writerWrapText opts
57+ then renderHtmlFragment
58+ else showHtmlFragment
59+
5460-- | Convert Pandoc document to Html string.
5561writeHtmlString :: WriterOptions -> Pandoc -> String
5662writeHtmlString opts =
5763 if writerStandalone opts
58− then renderHtml . writeHtml opts
59− else renderHtmlFragment . writeHtml opts
64+ then render opts . writeHtml opts
65+ else renderFragment opts . writeHtml opts
6066
6167-- | Convert Pandoc document to Html structure.
6268writeHtml :: WriterOptions -> Pandoc -> Html
@@ -406,7 +412,7 @@ inlineToHtml opts inline =
406412 linkText
407413 (Image txt (source,tit)) -> do
408414 alternate <- inlineListToHtml opts txt
409− let alternate' = renderHtmlFragment alternate
415+ let alternate' = renderFragment opts alternate
410416 let attributes = [src source] ++
411417 (if null tit
412418 then []