aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-01-10 10:40:49 -0800
committerJohn MacFarlane <[email protected]>2022-01-10 10:40:49 -0800
commit7bf119168658627dbddcc6753b79a5f921519782 (patch)
tree464d540b7e82a45914b9ad73f0cfc7014899b898
parent6f739cdb4d754e04a006aa796c45342e92a424bb (diff)
HTML writer: don't break attributes values when wrapping.
-rw-r--r--src/Text/Pandoc/Writers/Blaze.hs6
-rw-r--r--test/command/3534.md18
-rw-r--r--test/command/3752.md8
-rw-r--r--test/command/5627.md16
-rw-r--r--test/command/5650.md8
-rw-r--r--test/command/5655.md8
-rw-r--r--test/ipynb/rank.out.html8
-rw-r--r--test/writer.html49
-rw-r--r--test/writer.html59
9 files changed, 46 insertions, 44 deletions
diff --git a/src/Text/Pandoc/Writers/Blaze.hs b/src/Text/Pandoc/Writers/Blaze.hs
index 8233043a3..692e89e27 100644
--- a/src/Text/Pandoc/Writers/Blaze.hs
+++ b/src/Text/Pandoc/Writers/Blaze.hs
@@ -57,20 +57,20 @@ layoutMarkup = go True mempty
(space' wrap
<> literal (getText rawkey)
<> char '='
- <> doubleQuotes (fromChoiceString wrap value)
+ <> doubleQuotes (fromChoiceString False value)
<> attrs) h
go wrap attrs (AddCustomAttribute key value h) =
go wrap
(space' wrap
<> fromChoiceString wrap key
<> char '='
- <> doubleQuotes (fromChoiceString wrap value)
+ <> doubleQuotes (fromChoiceString False value)
<> attrs) h
go wrap _ (Content content _) = fromChoiceString wrap content
go wrap _ (Comment comment _) =
literal "<!--"
<> space' wrap
- <> fromChoiceString wrap comment
+ <> fromChoiceString False comment
<> space' wrap
<> "-->"
go wrap attrs (Append h1 h2) = go wrap attrs h1 <> go wrap attrs h2
diff --git a/test/command/3534.md b/test/command/3534.md
index 42dca9207..41bf9a5ff 100644
--- a/test/command/3534.md
+++ b/test/command/3534.md
@@ -2,9 +2,9 @@
% pandoc -f latex -t html
I want to explain the interface of \lstinline[language=Java]{public class MyClass}.
^D
-<p>I want to explain the interface of <code class="sourceCode
-java"><span class="kw">public</span> <span class="kw">class</span>
-MyClass</code>.</p>
+<p>I want to explain the interface of <code
+class="sourceCode java"><span class="kw">public</span> <span
+class="kw">class</span> MyClass</code>.</p>
```
@@ -46,9 +46,9 @@ I want to explain the interface of \lstinline[language=Java]{public class MyClas
% pandoc -f latex -t html
I want to explain the interface of \mintinline{java}{public class MyClass}.
^D
-<p>I want to explain the interface of <code class="sourceCode
-java"><span class="kw">public</span> <span class="kw">class</span>
-MyClass</code>.</p>
+<p>I want to explain the interface of <code
+class="sourceCode java"><span class="kw">public</span> <span
+class="kw">class</span> MyClass</code>.</p>
```
@@ -56,9 +56,9 @@ MyClass</code>.</p>
% pandoc -f latex -t html
I want to explain the interface of \mintinline{java}|public class MyClass|.
^D
-<p>I want to explain the interface of <code class="sourceCode
-java"><span class="kw">public</span> <span class="kw">class</span>
-MyClass</code>.</p>
+<p>I want to explain the interface of <code
+class="sourceCode java"><span class="kw">public</span> <span
+class="kw">class</span> MyClass</code>.</p>
```
diff --git a/test/command/3752.md b/test/command/3752.md
index 7db581cfe..bac81b1a1 100644
--- a/test/command/3752.md
+++ b/test/command/3752.md
@@ -32,8 +32,8 @@ A spider: [spider]
^D
<h1 id="chapter-one">Chapter one</h1>
<p>A spider: <img src="command/chap1/spider.png" alt="spider" /></p>
-<p>Another spider: <img src="command/chap2/spider.png" alt="another
-spider" /></p>
+<p>Another spider: <img src="command/chap2/spider.png"
+alt="another spider" /></p>
<p>The moon: <img src="command/chap1/../../lalune.jpg" alt="moon" /></p>
<p>Link to <a href="command/chap1/spider.png">spider picture</a>.</p>
<p>URL left alone: <a
@@ -51,8 +51,8 @@ href="/foo/bar/baz.png">absolute</a>.</p>
^D
<h1>Chapter one</h1>
<p>A spider: <img src="command/chap1/spider.png" alt="spider" /></p>
-<p>Another spider: <img src="command/chap2/spider.png" alt="another
-spider" /></p>
+<p>Another spider: <img src="command/chap2/spider.png"
+alt="another spider" /></p>
<p>The moon: <img src="command/chap1/../../lalune.jpg" alt="moon" /></p>
<p>Link to <a href="command/chap1/spider.png">spider picture</a>.</p>
<p>URL left alone: <a
diff --git a/test/command/5627.md b/test/command/5627.md
index dde4c99d6..fde15fe9a 100644
--- a/test/command/5627.md
+++ b/test/command/5627.md
@@ -20,10 +20,10 @@ Something
<li>Two <code>--&gt;something&lt;!--</code></li>
<li>Three</li>
</ol>
-<div class="sourceCode" id="cb1"><pre class="sourceCode
-html"><code class="sourceCode html"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>--&gt;<span class="co">&lt;!--&lt;script&gt;alert(&#39;Escaped!&#39;)&lt;/script&gt;</span></span></code></pre></div>
-<div class="sourceCode" id="cb2"><pre class="sourceCode
-html"><code class="sourceCode html"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>Something</span></code></pre></div>
+<div class="sourceCode" id="cb1"><pre
+class="sourceCode html"><code class="sourceCode html"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>--&gt;<span class="co">&lt;!--&lt;script&gt;alert(&#39;Escaped!&#39;)&lt;/script&gt;</span></span></code></pre></div>
+<div class="sourceCode" id="cb2"><pre
+class="sourceCode html"><code class="sourceCode html"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>Something</span></code></pre></div>
```
```
@@ -48,10 +48,10 @@ Something
<li><code>--&gt;something&lt;!--</code></li>
<li>bye <code>--&gt;something else&lt;!--</code></li>
</ul>
-<div class="sourceCode" id="cb1"><pre class="sourceCode
-html"><code class="sourceCode html"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>--&gt;<span class="co">&lt;!--&lt;script&gt;alert(&#39;Escaped!&#39;)&lt;/script&gt;</span></span></code></pre></div>
-<div class="sourceCode" id="cb2"><pre class="sourceCode
-html"><code class="sourceCode html"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>Something</span></code></pre></div>
+<div class="sourceCode" id="cb1"><pre
+class="sourceCode html"><code class="sourceCode html"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>--&gt;<span class="co">&lt;!--&lt;script&gt;alert(&#39;Escaped!&#39;)&lt;/script&gt;</span></span></code></pre></div>
+<div class="sourceCode" id="cb2"><pre
+class="sourceCode html"><code class="sourceCode html"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>Something</span></code></pre></div>
```
```
diff --git a/test/command/5650.md b/test/command/5650.md
index 1e96aeaa4..c333d5bcd 100644
--- a/test/command/5650.md
+++ b/test/command/5650.md
@@ -5,8 +5,8 @@ a
b
```
^D
-<div class="sourceCode" id="foocb1"><pre class="sourceCode
-haskell"><code class="sourceCode haskell"><span id="foocb1-1"><a href="#foocb1-1" aria-hidden="true" tabindex="-1"></a>a</span>
+<div class="sourceCode" id="foocb1"><pre
+class="sourceCode haskell"><code class="sourceCode haskell"><span id="foocb1-1"><a href="#foocb1-1" aria-hidden="true" tabindex="-1"></a>a</span>
<span id="foocb1-2"><a href="#foocb1-2" aria-hidden="true" tabindex="-1"></a>b</span></code></pre></div>
````
@@ -17,8 +17,8 @@ a
b
```
^D
-<div class="sourceCode" id="foobar"><pre class="sourceCode
-haskell"><code class="sourceCode haskell"><span id="foobar-1"><a href="#foobar-1" aria-hidden="true" tabindex="-1"></a>a</span>
+<div class="sourceCode" id="foobar"><pre
+class="sourceCode haskell"><code class="sourceCode haskell"><span id="foobar-1"><a href="#foobar-1" aria-hidden="true" tabindex="-1"></a>a</span>
<span id="foobar-2"><a href="#foobar-2" aria-hidden="true" tabindex="-1"></a>b</span></code></pre></div>
````
diff --git a/test/command/5655.md b/test/command/5655.md
index 72ad46e5e..e9fb1b628 100644
--- a/test/command/5655.md
+++ b/test/command/5655.md
@@ -4,8 +4,8 @@ $T_n={n+1 \choose 2}$
^D
<p><img style="vertical-align:middle"
src="https://latex.codecogs.com/png.latex?%5Ctextstyle%20T_n%3D%7Bn%2B1%20%5Cchoose%202%7D"
-alt="T_n={n+1 \choose 2}" title="T_n={n+1 \choose 2}" class="math
-inline" /></p>
+alt="T_n={n+1 \choose 2}" title="T_n={n+1 \choose 2}"
+class="math inline" /></p>
````
````
@@ -14,7 +14,7 @@ $$T_n={n+1 \choose 2}$$
^D
<p><img style="vertical-align:middle"
src="https://latex.codecogs.com/png.latex?%5Cdisplaystyle%20T_n%3D%7Bn%2B1%20%5Cchoose%202%7D"
-alt="T_n={n+1 \choose 2}" title="T_n={n+1 \choose 2}" class="math
-display" /></p>
+alt="T_n={n+1 \choose 2}" title="T_n={n+1 \choose 2}"
+class="math display" /></p>
````
diff --git a/test/ipynb/rank.out.html b/test/ipynb/rank.out.html
index a82fe8bbc..44c1fb72d 100644
--- a/test/ipynb/rank.out.html
+++ b/test/ipynb/rank.out.html
@@ -1,12 +1,12 @@
<div id="5cf8f54d-bf3c-4db2-996d-22662a86ad43" class="cell code"
data-execution_count="1">
-<div class="sourceCode" id="cb1"><pre class="sourceCode
-python"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> matplotlib.pyplot <span class="im">as</span> plt</span></code></pre></div>
+<div class="sourceCode" id="cb1"><pre
+class="sourceCode python"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> matplotlib.pyplot <span class="im">as</span> plt</span></code></pre></div>
</div>
<div id="a0228622-9ff8-4392-9ddd-f70a90f0e106" class="cell code"
data-execution_count="2">
-<div class="sourceCode" id="cb2"><pre class="sourceCode
-python"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>fig, ax <span class="op">=</span> plt.subplots(figsize<span class="op">=</span>(<span class="dv">1</span>, <span class="dv">1</span>), dpi<span class="op">=</span><span class="dv">4</span>)</span>
+<div class="sourceCode" id="cb2"><pre
+class="sourceCode python"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>fig, ax <span class="op">=</span> plt.subplots(figsize<span class="op">=</span>(<span class="dv">1</span>, <span class="dv">1</span>), dpi<span class="op">=</span><span class="dv">4</span>)</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>ax.imshow([[<span class="dv">0</span>, <span class="dv">1</span>], [<span class="dv">2</span>, <span class="dv">3</span>]])<span class="op">;</span></span></code></pre></div>
<div class="output display_data">
<p><em>you should see this when converting from ipynb to html instead of the image below.</em></p>
diff --git a/test/writer.html4 b/test/writer.html4
index 1e255fa70..c8ea04e98 100644
--- a/test/writer.html4
+++ b/test/writer.html4
@@ -595,10 +595,11 @@ href="http://example.com/?foo=1&amp;bar=2">quoted link</a>”.</p>
<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>
diff --git a/test/writer.html5 b/test/writer.html5
index d8e89b3e2..988fc1da5 100644
--- a/test/writer.html5
+++ b/test/writer.html5
@@ -598,10 +598,11 @@ href="http://example.com/?foo=1&amp;bar=2">quoted link</a>”.</p>
<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>