add markdown test suite's backslash escape test
This commit is contained in:
parent
6fbb30588b
commit
91bb13c714
11
test/fix.js
11
test/fix.js
@ -60,14 +60,3 @@ fs.readdirSync(dir).forEach(function(file) {
|
|||||||
|
|
||||||
fs.writeFileSync(file, html);
|
fs.writeFileSync(file, html);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// markdown parses backslashes in a very primitive
|
|
||||||
// way because it's not a real parser. i cannot
|
|
||||||
// include this test, because marked parses backslashes
|
|
||||||
// in a very different way.
|
|
||||||
(function(ext) {
|
|
||||||
fs.writeFileSync(dir + '/backslash_escapes.text',
|
|
||||||
'hello world \\[how](are you) today');
|
|
||||||
fs.writeFileSync(dir + '/backslash_escapes.html',
|
|
||||||
'<p>hello world [how](are you) today</p>');
|
|
||||||
})();
|
|
||||||
|
@ -99,13 +99,16 @@ main:
|
|||||||
main.bench = function(name, func) {
|
main.bench = function(name, func) {
|
||||||
if (!files) {
|
if (!files) {
|
||||||
load();
|
load();
|
||||||
// remove these as they affect the
|
// change certain tests. to allow
|
||||||
// comparison to older benchmark times.
|
// comparison to older benchmark times.
|
||||||
fs.readdirSync(__dirname + '/new').forEach(function(name) {
|
fs.readdirSync(__dirname + '/new').forEach(function(name) {
|
||||||
if (name.split('.').pop() === 'html') return;
|
if (name.split('.').pop() === 'html') return;
|
||||||
if (name === 'main.text') return;
|
if (name === 'main.text') return;
|
||||||
delete files[name];
|
delete files[name];
|
||||||
});
|
});
|
||||||
|
files['backslash_escapes.text'] = {
|
||||||
|
text: 'hello world \\[how](are you) today'
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var start = Date.now()
|
var start = Date.now()
|
||||||
|
@ -1 +1,118 @@
|
|||||||
<p>hello world [how](are you) today</p>
|
<p>These should all get escaped:</p>
|
||||||
|
|
||||||
|
<p>Backslash: \</p>
|
||||||
|
|
||||||
|
<p>Backtick: `</p>
|
||||||
|
|
||||||
|
<p>Asterisk: *</p>
|
||||||
|
|
||||||
|
<p>Underscore: _</p>
|
||||||
|
|
||||||
|
<p>Left brace: {</p>
|
||||||
|
|
||||||
|
<p>Right brace: }</p>
|
||||||
|
|
||||||
|
<p>Left bracket: [</p>
|
||||||
|
|
||||||
|
<p>Right bracket: ]</p>
|
||||||
|
|
||||||
|
<p>Left paren: (</p>
|
||||||
|
|
||||||
|
<p>Right paren: )</p>
|
||||||
|
|
||||||
|
<p>Greater-than: ></p>
|
||||||
|
|
||||||
|
<p>Hash: #</p>
|
||||||
|
|
||||||
|
<p>Period: .</p>
|
||||||
|
|
||||||
|
<p>Bang: !</p>
|
||||||
|
|
||||||
|
<p>Plus: +</p>
|
||||||
|
|
||||||
|
<p>Minus: -</p>
|
||||||
|
|
||||||
|
<p>These should not, because they occur within a code block:</p>
|
||||||
|
|
||||||
|
<pre><code>Backslash: \\
|
||||||
|
|
||||||
|
Backtick: \`
|
||||||
|
|
||||||
|
Asterisk: \*
|
||||||
|
|
||||||
|
Underscore: \_
|
||||||
|
|
||||||
|
Left brace: \{
|
||||||
|
|
||||||
|
Right brace: \}
|
||||||
|
|
||||||
|
Left bracket: \[
|
||||||
|
|
||||||
|
Right bracket: \]
|
||||||
|
|
||||||
|
Left paren: \(
|
||||||
|
|
||||||
|
Right paren: \)
|
||||||
|
|
||||||
|
Greater-than: \>
|
||||||
|
|
||||||
|
Hash: \#
|
||||||
|
|
||||||
|
Period: \.
|
||||||
|
|
||||||
|
Bang: \!
|
||||||
|
|
||||||
|
Plus: \+
|
||||||
|
|
||||||
|
Minus: \-
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Nor should these, which occur in code spans:</p>
|
||||||
|
|
||||||
|
<p>Backslash: <code>\\</code></p>
|
||||||
|
|
||||||
|
<p>Backtick: <code>\`</code></p>
|
||||||
|
|
||||||
|
<p>Asterisk: <code>\*</code></p>
|
||||||
|
|
||||||
|
<p>Underscore: <code>\_</code></p>
|
||||||
|
|
||||||
|
<p>Left brace: <code>\{</code></p>
|
||||||
|
|
||||||
|
<p>Right brace: <code>\}</code></p>
|
||||||
|
|
||||||
|
<p>Left bracket: <code>\[</code></p>
|
||||||
|
|
||||||
|
<p>Right bracket: <code>\]</code></p>
|
||||||
|
|
||||||
|
<p>Left paren: <code>\(</code></p>
|
||||||
|
|
||||||
|
<p>Right paren: <code>\)</code></p>
|
||||||
|
|
||||||
|
<p>Greater-than: <code>\></code></p>
|
||||||
|
|
||||||
|
<p>Hash: <code>\#</code></p>
|
||||||
|
|
||||||
|
<p>Period: <code>\.</code></p>
|
||||||
|
|
||||||
|
<p>Bang: <code>\!</code></p>
|
||||||
|
|
||||||
|
<p>Plus: <code>\+</code></p>
|
||||||
|
|
||||||
|
<p>Minus: <code>\-</code></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>These should get escaped, even though they're matching pairs for
|
||||||
|
other Markdown constructs:</p>
|
||||||
|
|
||||||
|
<p>*asterisks*</p>
|
||||||
|
|
||||||
|
<p>_underscores_</p>
|
||||||
|
|
||||||
|
<p>`backticks`</p>
|
||||||
|
|
||||||
|
<p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p>
|
||||||
|
|
||||||
|
<p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p>
|
||||||
|
|
||||||
|
<p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p>
|
||||||
|
@ -1 +1,120 @@
|
|||||||
hello world \[how](are you) today
|
These should all get escaped:
|
||||||
|
|
||||||
|
Backslash: \\
|
||||||
|
|
||||||
|
Backtick: \`
|
||||||
|
|
||||||
|
Asterisk: \*
|
||||||
|
|
||||||
|
Underscore: \_
|
||||||
|
|
||||||
|
Left brace: \{
|
||||||
|
|
||||||
|
Right brace: \}
|
||||||
|
|
||||||
|
Left bracket: \[
|
||||||
|
|
||||||
|
Right bracket: \]
|
||||||
|
|
||||||
|
Left paren: \(
|
||||||
|
|
||||||
|
Right paren: \)
|
||||||
|
|
||||||
|
Greater-than: \>
|
||||||
|
|
||||||
|
Hash: \#
|
||||||
|
|
||||||
|
Period: \.
|
||||||
|
|
||||||
|
Bang: \!
|
||||||
|
|
||||||
|
Plus: \+
|
||||||
|
|
||||||
|
Minus: \-
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
These should not, because they occur within a code block:
|
||||||
|
|
||||||
|
Backslash: \\
|
||||||
|
|
||||||
|
Backtick: \`
|
||||||
|
|
||||||
|
Asterisk: \*
|
||||||
|
|
||||||
|
Underscore: \_
|
||||||
|
|
||||||
|
Left brace: \{
|
||||||
|
|
||||||
|
Right brace: \}
|
||||||
|
|
||||||
|
Left bracket: \[
|
||||||
|
|
||||||
|
Right bracket: \]
|
||||||
|
|
||||||
|
Left paren: \(
|
||||||
|
|
||||||
|
Right paren: \)
|
||||||
|
|
||||||
|
Greater-than: \>
|
||||||
|
|
||||||
|
Hash: \#
|
||||||
|
|
||||||
|
Period: \.
|
||||||
|
|
||||||
|
Bang: \!
|
||||||
|
|
||||||
|
Plus: \+
|
||||||
|
|
||||||
|
Minus: \-
|
||||||
|
|
||||||
|
|
||||||
|
Nor should these, which occur in code spans:
|
||||||
|
|
||||||
|
Backslash: `\\`
|
||||||
|
|
||||||
|
Backtick: `` \` ``
|
||||||
|
|
||||||
|
Asterisk: `\*`
|
||||||
|
|
||||||
|
Underscore: `\_`
|
||||||
|
|
||||||
|
Left brace: `\{`
|
||||||
|
|
||||||
|
Right brace: `\}`
|
||||||
|
|
||||||
|
Left bracket: `\[`
|
||||||
|
|
||||||
|
Right bracket: `\]`
|
||||||
|
|
||||||
|
Left paren: `\(`
|
||||||
|
|
||||||
|
Right paren: `\)`
|
||||||
|
|
||||||
|
Greater-than: `\>`
|
||||||
|
|
||||||
|
Hash: `\#`
|
||||||
|
|
||||||
|
Period: `\.`
|
||||||
|
|
||||||
|
Bang: `\!`
|
||||||
|
|
||||||
|
Plus: `\+`
|
||||||
|
|
||||||
|
Minus: `\-`
|
||||||
|
|
||||||
|
|
||||||
|
These should get escaped, even though they're matching pairs for
|
||||||
|
other Markdown constructs:
|
||||||
|
|
||||||
|
\*asterisks\*
|
||||||
|
|
||||||
|
\_underscores\_
|
||||||
|
|
||||||
|
\`backticks\`
|
||||||
|
|
||||||
|
This is a code span with a literal backslash-backtick sequence: `` \` ``
|
||||||
|
|
||||||
|
This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.
|
||||||
|
|
||||||
|
This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user