Skip to content

Commit

Permalink
Fix tests to remove IDs from <h1>
Browse files Browse the repository at this point in the history
  • Loading branch information
styfle committed Nov 21, 2018
1 parent a127307 commit 12eb59f
Show file tree
Hide file tree
Showing 17 changed files with 298 additions and 312 deletions.
14 changes: 0 additions & 14 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,20 +393,6 @@ function fix() {
.replace(/&__QUOT__;/g, '"')
.replace(/&__APOS__;/g, '\'');

// add heading id's
html = html.replace(/<(h[1-6])>([^<]+)<\/\1>/g, function(s, h, text) {
var id = text
.replace(/&#39;/g, '\'')
.replace(/&quot;/g, '"')
.replace(/&gt;/g, '>')
.replace(/&lt;/g, '<')
.replace(/&amp;/g, '&');

id = id.toLowerCase().replace(/[^\w]+/g, '-');

return '<' + h + ' id="' + id + '">' + text + '</' + h + '>';
});

fs.writeFileSync(file, html);
});

Expand Down
38 changes: 19 additions & 19 deletions test/new/cm_autolinks.html
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
<p>Here are some valid autolinks:</p>

<h3 id="example-565">Example 565</h3>
<h3>Example 565</h3>

<p><a href="http://foo.bar.baz">http://foo.bar.baz</a></p>

<h3 id="example-566">Example 566</h3>
<h3>Example 566</h3>

<p><a href="http://foo.bar.baz/test?q=hello&amp;id=22&amp;boolean">http://foo.bar.baz/test?q=hello&amp;id=22&amp;boolean</a></p>

<h3 id="example-567">Example 567</h3>
<h3>Example 567</h3>

<p><a href="irc://foo.bar:2233/baz">irc://foo.bar:2233/baz</a></p>

<h3 id="example-568">Example 568</h3>
<h3>Example 568</h3>

<p>Uppercase is also fine:</p>

<p><a href="MAILTO:FOO@BAR.BAZ">MAILTO:FOO@BAR.BAZ</a></p>

<p>Note that many strings that count as absolute URIs for purposes of this spec are not valid URIs, because their schemes are not registered or because of other problems with their syntax:</p>

<h3 id="example-569">Example 569</h3>
<h3>Example 569</h3>

<p><a href="a+b+c:d">a+b+c:d</a></p>

<h3 id="example-570">Example 570</h3>
<h3>Example 570</h3>

<p><a href="made-up-scheme://foo,bar">made-up-scheme://foo,bar</a></p>

<h3 id="example-571">Example 571</h3>
<h3>Example 571</h3>

<p><a href="http://../">http://../</a></p>

<h3 id="example-572">Example 572</h3>
<h3>Example 572</h3>

<p><a href="localhost:5001/foo">localhost:5001/foo</a></p>

<h3 id="example-573">Example 573</h3>
<h3>Example 573</h3>

<p>Spaces are not allowed in autolinks:</p>

<p>&lt;http://foo.bar/baz bim&gt;</p>

<h3 id="example-574">Example 574</h3>
<h3>Example 574</h3>

<p>Backslash-escapes do not work inside autolinks:</p>

<p><a href="http://example.com/%5C%5B%5C">http://example.com/\[\</a></p>

<p>Examples of email autolinks:</p>

<h3 id="example-575">Example 575</h3>
<h3>Example 575</h3>

<p><a href="mailto:foo@bar.example.com">foo@bar.example.com</a></p>

<h3 id="example-576">Example 576</h3>
<h3>Example 576</h3>

<p><a href="mailto:foo+special@Bar.baz-bar0.com">foo+special@Bar.baz-bar0.com</a></p>

<h3 id="example-577">Example 577</h3>
<h3>Example 577</h3>

<p>Backslash-escapes do not work inside email autolinks:</p>

<p>&lt;foo+@bar.example.com&gt;</p>

<p>These are not autolinks:</p>

<h3 id="example-578">Example 578</h3>
<h3>Example 578</h3>

<p>&lt;&gt;</p>

<h3 id="example-579">Example 579</h3>
<h3>Example 579</h3>

<p>&lt; http://foo.bar &gt;</p>

<h3 id="example-580">Example 580</h3>
<h3>Example 580</h3>

<p>&lt;m:abc&gt;</p>

<h3 id="example-581">Example 581</h3>
<h3>Example 581</h3>

<p>&lt;foo.bar.baz&gt;</p>

<h3 id="example-582">Example 582</h3>
<h3>Example 582</h3>

<p>http://example.com</p>

<h3 id="example-583">Example 583</h3>
<h3>Example 583</h3>

<p>foo@bar.example.com</p>
58 changes: 29 additions & 29 deletions test/new/cm_blockquotes.html
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
<h3 id="example-191">Example 191</h3>
<h3>Example 191</h3>

<blockquote>
<h1 id="foo">Foo</h1>
<h1>Foo</h1>
<p>bar
baz</p>
</blockquote>

<h3 id="example-192">Example 192</h3>
<h3>Example 192</h3>

<p>The spaces after the <code>&gt;</code> characters can be omitted:</p>

<blockquote>
<h1 id="foo">Foo</h1>
<h1>Foo</h1>
<p>bar
baz</p>
</blockquote>

<h3 id="example-193">Example 193</h3>
<h3>Example 193</h3>

<p>The <code>&gt;</code> characters can be indented 1-3 spaces:</p>

<blockquote>
<h1 id="foo">Foo</h1>
<h1>Foo</h1>
<p>bar
baz</p>
</blockquote>

<h3 id="example-194">Example 194</h3>
<h3>Example 194</h3>

<p>Four spaces gives us a code block:</p>

<pre><code>&gt; # Foo
&gt; bar
&gt; baz</code></pre>

<h3 id="example-195">Example 195</h3>
<h3>Example 195</h3>

<p>The Laziness clause allows us to omit the <code>&gt;</code> before paragraph continuation text:</p>

<blockquote>
<h1 id="foo">Foo</h1>
<h1>Foo</h1>
<p>bar
baz</p>
</blockquote>

<h3 id="example-196">Example 196</h3>
<h3>Example 196</h3>

<p>A block quote can contain some lazy and some non-lazy continuation lines:</p>

Expand All @@ -54,7 +54,7 @@ <h3 id="example-196">Example 196</h3>
foo</p>
</blockquote>

<h3 id="example-197">Example 197</h3>
<h3>Example 197</h3>

<p>Laziness only applies to lines that would have been continuations of paragraphs had they been prepended with block quote markers. For example, the <code>&gt;</code> cannot be omitted in the second line of</p>

Expand All @@ -65,14 +65,14 @@ <h3 id="example-197">Example 197</h3>

<p>without changing the meaning.</p>

<h3 id="example-198">Example 198</h3>
<h3>Example 198</h3>

<pre><code>Similarly, if we omit the `&gt;` in the second line then the block quote ends after the first line:

&gt; - foo
- bar</code></pre>

<h3 id="example-199">Example 199</h3>
<h3>Example 199</h3>

<p>For the same reason, we can’t omit the <code>&gt;</code> in front of subsequent lines of an indented or fenced code block:</p>

Expand All @@ -81,7 +81,7 @@ <h3 id="example-199">Example 199</h3>
</blockquote>
<pre><code>bar</code></pre>

<h3 id="example-200">Example 200</h3>
<h3>Example 200</h3>

<pre><code>&gt; ```
foo
Expand All @@ -93,7 +93,7 @@ <h3 id="example-200">Example 200</h3>
&lt;p&gt;foo&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;</code></pre>

<h3 id="example-201">Example 201</h3>
<h3>Example 201</h3>
<pre><code>&gt; foo
- bar

Expand All @@ -102,19 +102,19 @@ <h3 id="example-201">Example 201</h3>
- bar&lt;/p&gt;
&lt;/blockquote&gt;</code></pre>

<h3 id="example-202">Example 202</h3>
<h3>Example 202</h3>

<p>A block quote can be empty:</p>

<blockquote>
</blockquote>

<h3 id="example-203">Example 203</h3>
<h3>Example 203</h3>

<blockquote>
</blockquote>

<h3 id="example-204">Example 204</h3>
<h3>Example 204</h3>

<p>A block quote can have initial or final blank lines:</p>

Expand All @@ -123,7 +123,7 @@ <h3 id="example-204">Example 204</h3>
</blockquote>


<h3 id="example-205">Example 205</h3>
<h3>Example 205</h3>

<p>A blank line always separates block quotes:</p>

Expand All @@ -134,7 +134,7 @@ <h3 id="example-205">Example 205</h3>
<p>bar</p>
</blockquote>

<h3 id="example-206">Example 206</h3>
<h3>Example 206</h3>

<p>Consecutiveness means that if we put these block quotes together, we get a single block quote:</p>

Expand All @@ -143,7 +143,7 @@ <h3 id="example-206">Example 206</h3>
bar</p>
</blockquote>

<h3 id="example-207">Example 207</h3>
<h3>Example 207</h3>

<p>To get a block quote with two paragraphs, use:</p>

Expand All @@ -152,7 +152,7 @@ <h3 id="example-207">Example 207</h3>
<p>bar</p>
</blockquote>

<h3 id="example-208">Example 208</h3>
<h3>Example 208</h3>

<p>Block quotes can interrupt paragraphs:</p>

Expand All @@ -161,7 +161,7 @@ <h3 id="example-208">Example 208</h3>
<p>bar</p>
</blockquote>

<h3 id="example-209">Example 209</h3>
<h3>Example 209</h3>

<p>In general, blank lines are not needed before or after block quotes:</p>

Expand All @@ -173,7 +173,7 @@ <h3 id="example-209">Example 209</h3>
<p>bbb</p>
</blockquote>

<h3 id="example-210">Example 210</h3>
<h3>Example 210</h3>

<p>However, because of laziness, a blank line is needed between a block quote and a following paragraph:</p>

Expand All @@ -182,21 +182,21 @@ <h3 id="example-210">Example 210</h3>
baz</p>
</blockquote>

<h3 id="example-211">Example 211</h3>
<h3>Example 211</h3>

<blockquote>
<p>bar</p>
</blockquote>
<p>baz</p>

<h3 id="example-212">Example 212</h3>
<h3>Example 212</h3>

<blockquote>
<p>bar</p>
</blockquote>
<p>baz</p>

<h3 id="example-213">Example 213</h3>
<h3>Example 213</h3>

<p>It is a consequence of the Laziness rule that any number of initial <code>&gt;</code>s may be omitted on a continuation line of a nested block quote:</p>

Expand All @@ -209,7 +209,7 @@ <h3 id="example-213">Example 213</h3>
</blockquote>
</blockquote>

<h3 id="example-214">Example 214</h3>
<h3>Example 214</h3>

<blockquote>
<blockquote>
Expand All @@ -221,7 +221,7 @@ <h3 id="example-214">Example 214</h3>
</blockquote>
</blockquote>

<h3 id="example-215">Example 215</h3>
<h3>Example 215</h3>

<p>When including an indented code block in a block quote, remember that the block quote marker includes both the <code>&gt;</code> and a following space. So five spaces are needed after the <code>&gt;</code>:</p>

Expand Down
Loading

0 comments on commit 12eb59f

Please sign in to comment.