tests, more conformance

This commit is contained in:
Christopher Jeffrey 2011-08-22 22:13:00 -05:00
parent 9e0f6b0be8
commit e473c0959b
3 changed files with 20 additions and 22 deletions

View File

@ -267,25 +267,21 @@ inline.lexer = function(str) {
case 'reflink':
case 'nolink':
if (key !== 'link') {
link = cap[2]
/*link = cap[2]
? links[cap[2]]
: links[cap[1]];
if (!link) {
out += cap[0];
break;
}
/* the purely conformant way
link = (cap[2] || cap[1])
.replace(/\s+/g, ' ')
.replace(/^ +| +$/g, '');
link = links[link];
}*/
// the purely conformant way
link = cap[2] || cap[1];
link = links[link.replace(/\s+/g, ' ')];
if (!link) {
out += cap[0][0];
str = cap[0].substring(1) + str;
//out += cap[0].replace(cap[1], inline.lexer(cap[1]));
break;
}
*/
} else {
text = /^\s*<?([^\s]*?)>?(?:\s+"([^\n]+)")?\s*$/.exec(cap[2]);
link = {

View File

@ -4,7 +4,7 @@
<p>Foo <a href="/url/" title="Title">bar</a>.</p>
<p>With <a href="/url/">embedded [brackets]</a>.</p>
<p>Indented <a href="/url">once</a>.</p>
@ -33,15 +33,15 @@
<p>Nor [that][].</p>
<p>Nor [that][].</p>
<p>Nor [that].</p>
<p>[Something in brackets like <a href="foo">this</a> should work]</p>
<p>[Same with <a href="foo">this</a>.]</p>
<p>In this case, <a href="/somethingelse/">this</a> points to something else.</p>
<p>Backslashing should suppress [this] and [this].</p>
<hr>

View File

@ -8,7 +8,7 @@ Foo [bar]
[1]: /url/ "Title"
With [embedded [brackets]] [b].
Indented [once][].
@ -40,30 +40,32 @@ And [this] [].
And [this][].
And [this][].
And [this].
But not [that] [].
Nor [that][].
Nor [that][].
Nor [that].
[Something in brackets like [this][] should work]
[Same with [this].]
In this case, [this](/somethingelse/) points to something else.
Backslashing should suppress \[this] and [this\].
[this]: foo
* * *
Here's one where the [link breaks][] across lines.
Here's one where the [link
breaks] across lines.
Here's another where the [link breaks][] across lines, but with a line-ending space.
Here's another where the [link
breaks] across lines, but with a line-ending space.
[link breaks]: /url/