diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-12-20 13:44:03 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-12-22 09:45:02 -0800 |
commit | 7a9832166e36f77402d5e0259647e9f5c7ba4e58 (patch) | |
tree | 38b417997812c3e04704be97c05368ea795b15fe /test/writer.html5 | |
parent | 0bdf37315766eb4b785002ffaf38cdb724628e7a (diff) | |
download | pandoc-7a9832166e36f77402d5e0259647e9f5c7ba4e58.tar.gz |
Add text wrapping to HTML output.
Previously the HTML writer was exceptional in not being
sensitive to the `--wrap` option. With this change `--wrap`
now works for HTML. The default (as with other formats) is
automatic wrapping to 72 columns.
A new internal module, T.P.Writers.Blaze, exports `layoutMarkup`.
This converts a blaze Html structure into a doclayout Doc Text.
In addition, we now add a line break between an `img` tag
and the associated `figcaption`.
Note: Output is never wrapped in `writeHtmlStringForEPUB`.
This accords with previous behavior since previously the HTML
writer was insensitive to `--wrap` settings. There's no real
need to wrap HTML inside a zipped container.
Note that the contents of script, textarea, and pre tags are
always laid out with the `flush` combinator, so that unwanted
spaces won't be introduced if these occur in an indented context
in a template.
Closes #7764.
Diffstat (limited to 'test/writer.html5')
-rw-r--r-- | test/writer.html5 | 100 |
1 files changed, 70 insertions, 30 deletions
diff --git a/test/writer.html5 b/test/writer.html5 index 0141bf9fe..cdfcf042f 100644 --- a/test/writer.html5 +++ b/test/writer.html5 @@ -159,10 +159,12 @@ <p class="author">Anonymous</p> <p class="date">July 17, 2006</p> </header> -<p>This is a set of tests for pandoc. Most of them are adapted from John Gruber’s markdown test suite.</p> +<p>This is a set of tests for pandoc. Most of them are adapted from John +Gruber’s markdown test suite.</p> <hr /> <h1 id="headers">Headers</h1> -<h2 id="level-2-with-an-embedded-link">Level 2 with an <a href="/url">embedded link</a></h2> +<h2 id="level-2-with-an-embedded-link">Level 2 with an <a href="/url">embedded +link</a></h2> <h3 id="level-3-with-emphasis">Level 3 with <em>emphasis</em></h3> <h4 id="level-4">Level 4</h4> <h5 id="level-5">Level 5</h5> @@ -175,7 +177,9 @@ <hr /> <h1 id="paragraphs">Paragraphs</h1> <p>Here’s a regular paragraph.</p> -<p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p> +<p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. +Because a hard-wrapped line in the middle of a paragraph looked like a list +item.</p> <p>Here’s one with a bullet. * criminey.</p> <p>There should be a hard line break<br /> here.</p> @@ -286,7 +290,8 @@ These should not be escaped: \$ \\ \> \[ \{</code></pre> <p>Multiple paragraphs:</p> <ol type="1"> <li><p>Item 1, graf one.</p> -<p>Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.</p></li> +<p>Item 1. graf two. The quick brown fox jumped over the lazy dog’s +back.</p></li> <li><p>Item 2.</p></li> <li><p>Item 3.</p></li> </ol> @@ -543,18 +548,22 @@ Blah <p>So is <strong><em>this</em></strong> word.</p> <p><strong><em>This is strong and em.</em></strong></p> <p>So is <strong><em>this</em></strong> word.</p> -<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code><html></code>.</p> +<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, +<code>\$</code>, <code><html></code>.</p> <p><del>This is <em>strikeout</em>.</del></p> -<p>Superscripts: a<sup>bc</sup>d a<sup><em>hello</em></sup> a<sup>hello there</sup>.</p> +<p>Superscripts: a<sup>bc</sup>d a<sup><em>hello</em></sup> +a<sup>hello there</sup>.</p> <p>Subscripts: H<sub>2</sub>O, H<sub>23</sub>O, H<sub>many of them</sub>O.</p> -<p>These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.</p> +<p>These should not be superscripts or subscripts, because of the unescaped +spaces: a^b c^d, a~b c~d.</p> <hr /> <h1 id="smart-quotes-ellipses-dashes">Smart quotes, ellipses, dashes</h1> <p>“Hello,” said the spider. “‘Shelob’ is my name.”</p> <p>‘A’, ‘B’, and ‘C’ are letters.</p> <p>‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’</p> <p>‘He said, “I want to go.”’ Were you alive in the 70’s?</p> -<p>Here is some quoted ‘<code>code</code>’ and a “<a href="http://example.com/?foo=1&bar=2">quoted link</a>”.</p> +<p>Here is some quoted ‘<code>code</code>’ and a “<a +href="http://example.com/?foo=1&bar=2">quoted link</a>”.</p> <p>Some dashes: one—two — three—four — five.</p> <p>Dashes between numbers: 5–7, 255–66, 1987–1999.</p> <p>Ellipses…and…and….</p> @@ -567,13 +576,16 @@ Blah <li><span class="math inline"><em>α</em> ∧ <em>ω</em></span></li> <li><span class="math inline">223</span></li> <li><span class="math inline"><em>p</em></span>-Tree</li> -<li>Here’s some display math: <span class="math display">$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$</span></li> -<li>Here’s one that has a line break in it: <span class="math inline"><em>α</em> + <em>ω</em> × <em>x</em><sup>2</sup></span>.</li> +<li>Here’s some display math: <span class="math +display">$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$</span></li> +<li>Here’s one that has a line break in it: <span class="math +inline"><em>α</em> + <em>ω</em> × <em>x</em><sup>2</sup></span>.</li> </ul> <p>These shouldn’t be math:</p> <ul> <li>To get the famous equation, write <code>$e = mc^2$</code>.</li> -<li>$22,000 is a <em>lot</em> of money. So is $34,000. (It worked if “lot” is emphasized.)</li> +<li>$22,000 is a <em>lot</em> of money. So is $34,000. (It worked if “lot” is +emphasized.)</li> <li>Shoes ($20) and socks ($5).</li> <li>Escaped <code>$</code>: $73 <em>this should be emphasized</em> 23$.</li> </ul> @@ -616,7 +628,8 @@ Blah <p><a href="/url/" title="title">URL and title</a>.</p> <p><a href="/url/" title="title preceded by two spaces">URL and title</a>.</p> <p><a href="/url/" title="title preceded by a tab">URL and title</a>.</p> -<p><a href="/url/" title="title with "quotes" in it">URL and title</a></p> +<p><a href="/url/" title="title with "quotes" in it">URL and +title</a></p> <p><a href="/url/" title="title with single quotes">URL and title</a></p> <p><a href="/url/with_underscore">with_underscore</a></p> <p><a href="mailto:nobody@nowhere.net">Email link</a></p> @@ -633,51 +646,78 @@ Blah <p>Foo <a href="/url/" title="Title with "quotes" inside">bar</a>.</p> <p>Foo <a href="/url/" title="Title with "quote" inside">biz</a>.</p> <h2 id="with-ampersands">With ampersands</h2> -<p>Here’s a <a href="http://example.com/?foo=1&bar=2">link with an ampersand in the URL</a>.</p> -<p>Here’s a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&T</a>.</p> +<p>Here’s a <a href="http://example.com/?foo=1&bar=2">link with an ampersand +in the URL</a>.</p> +<p>Here’s a link with an amersand in the link text: <a href="http://att.com/" +title="AT&T">AT&T</a>.</p> <p>Here’s an <a href="/script?foo=1&bar=2">inline link</a>.</p> -<p>Here’s an <a href="/script?foo=1&bar=2">inline link in pointy braces</a>.</p> +<p>Here’s an <a href="/script?foo=1&bar=2">inline link in pointy +braces</a>.</p> <h2 id="autolinks">Autolinks</h2> -<p>With an ampersand: <a href="http://example.com/?foo=1&bar=2" class="uri">http://example.com/?foo=1&bar=2</a></p> +<p>With an ampersand: <a href="http://example.com/?foo=1&bar=2" +class="uri">http://example.com/?foo=1&bar=2</a></p> <ul> <li>In a list?</li> <li><a href="http://example.com/" class="uri">http://example.com/</a></li> <li>It should.</li> </ul> -<p>An e-mail address: <a href="mailto:nobody@nowhere.net" class="email">nobody@nowhere.net</a></p> +<p>An e-mail address: <a href="mailto:nobody@nowhere.net" +class="email">nobody@nowhere.net</a></p> <blockquote> -<p>Blockquoted: <a href="http://example.com/" class="uri">http://example.com/</a></p> +<p>Blockquoted: <a href="http://example.com/" +class="uri">http://example.com/</a></p> </blockquote> -<p>Auto-links should not occur here: <code><http://example.com/></code></p> +<p>Auto-links should not occur here: +<code><http://example.com/></code></p> <pre><code>or here: <http://example.com/></code></pre> <hr /> <h1 id="images">Images</h1> <p>From “Voyage dans la Lune” by Georges Melies (1902):</p> <figure> -<img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune" /><figcaption aria-hidden="true">lalune</figcaption> +<img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune" /> +<figcaption aria-hidden="true">lalune</figcaption> </figure> <p>Here is a movie <img src="movie.jpg" alt="movie" /> icon.</p> <hr /> <h1 id="footnotes">Footnotes</h1> -<p>Here is a footnote reference,<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a> and another.<a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a> This should <em>not</em> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<a href="#fn3" class="footnote-ref" id="fnref3" role="doc-noteref"><sup>3</sup></a></p> +<p>Here is a footnote reference,<a href="#fn1" class="footnote-ref" id="fnref1" +role="doc-noteref"><sup>1</sup></a> and another.<a href="#fn2" +class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a> This should +<em>not</em> be a footnote reference, because it contains a space.[^my note] +Here is an inline note.<a href="#fn3" class="footnote-ref" id="fnref3" +role="doc-noteref"><sup>3</sup></a></p> <blockquote> -<p>Notes can go in quotes.<a href="#fn4" class="footnote-ref" id="fnref4" role="doc-noteref"><sup>4</sup></a></p> +<p>Notes can go in quotes.<a href="#fn4" class="footnote-ref" id="fnref4" +role="doc-noteref"><sup>4</sup></a></p> </blockquote> <ol type="1"> -<li>And in list items.<a href="#fn5" class="footnote-ref" id="fnref5" role="doc-noteref"><sup>5</sup></a></li> +<li>And in list items.<a href="#fn5" class="footnote-ref" id="fnref5" +role="doc-noteref"><sup>5</sup></a></li> </ol> <p>This paragraph should not be part of the note, as it is not indented.</p> <section class="footnotes footnotes-end-of-document" role="doc-endnotes"> <hr /> <ol> -<li id="fn1" role="doc-endnote"><p>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li> -<li id="fn2" role="doc-endnote"><p>Here’s the long note. This one contains multiple blocks.</p> -<p>Subsequent blocks are indented to show that they belong to the footnote (as with list items).</p> +<li id="fn1" role="doc-endnote"><p>Here is the footnote. It can go anywhere +after the footnote reference. It need not be placed at the end of the +document.<a href="#fnref1" class="footnote-back" +role="doc-backlink">↩︎</a></p></li> +<li id="fn2" role="doc-endnote"><p>Here’s the long note. This one contains +multiple blocks.</p> +<p>Subsequent blocks are indented to show that they belong to the footnote (as +with list items).</p> <pre><code> { <code> }</code></pre> -<p>If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.<a href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li> -<li id="fn3" role="doc-endnote"><p>This is <em>easier</em> to type. Inline notes may contain <a href="http://google.com">links</a> and <code>]</code> verbatim characters, as well as [bracketed text].<a href="#fnref3" class="footnote-back" role="doc-backlink">↩︎</a></p></li> -<li id="fn4" role="doc-endnote"><p>In quote.<a href="#fnref4" class="footnote-back" role="doc-backlink">↩︎</a></p></li> -<li id="fn5" role="doc-endnote"><p>In list.<a href="#fnref5" class="footnote-back" role="doc-backlink">↩︎</a></p></li> +<p>If you want, you can indent every line, but you can also be lazy and just +indent the first line of each block.<a href="#fnref2" class="footnote-back" +role="doc-backlink">↩︎</a></p></li> +<li id="fn3" role="doc-endnote"><p>This is <em>easier</em> to type. Inline notes +may contain <a href="http://google.com">links</a> and <code>]</code> verbatim +characters, as well as [bracketed text].<a href="#fnref3" class="footnote-back" +role="doc-backlink">↩︎</a></p></li> +<li id="fn4" role="doc-endnote"><p>In quote.<a href="#fnref4" +class="footnote-back" role="doc-backlink">↩︎</a></p></li> +<li id="fn5" role="doc-endnote"><p>In list.<a href="#fnref5" +class="footnote-back" role="doc-backlink">↩︎</a></p></li> </ol> </section> </body> |