From 0d546c29f28f6c185105a06d0fb3669f7647b9f2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 24 Jun 2016 21:48:31 -0700 Subject: Updated spec and pathological tests for changes in strong/emph parsing. --- test/spec.txt | 73 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 35 deletions(-) (limited to 'test/spec.txt') diff --git a/test/spec.txt b/test/spec.txt index 99365cd..c7b1fcd 100644 --- a/test/spec.txt +++ b/test/spec.txt @@ -5964,18 +5964,22 @@ The following rules define emphasis and strong emphasis: 9. Emphasis begins with a delimiter that [can open emphasis] and ends with a delimiter that [can close emphasis], and that uses the same - character (`_` or `*`) as the opening delimiter. There must - be a nonempty sequence of inlines between the open delimiter - and the closing delimiter; these form the contents of the emphasis - inline. + character (`_` or `*`) as the opening delimiter. The + opening and closing delimiters must belong to separate + [delimiter runs]. If one of the delimiters can both + open and close emphasis, then the sum of the lengths of the + delimiter runs containing the opening and closing delimiters + must not be a multiple of 3. 10. Strong emphasis begins with a delimiter that [can open strong emphasis] and ends with a delimiter that [can close strong emphasis], and that uses the same character - (`_` or `*`) as the opening delimiter. - There must be a nonempty sequence of inlines between the open - delimiter and the closing delimiter; these form the contents of - the strong emphasis inline. + (`_` or `*`) as the opening delimiter. The + opening and closing delimiters must belong to separate + [delimiter runs]. If one of the delimiters can both open + and close strong emphasis, then the sum of the lengths of + the delimiter runs containing the opening and closing + delimiters must not be a multiple of 3. 11. A literal `*` character cannot occur at the beginning or end of `*`-delimited emphasis or `**`-delimited strong emphasis, unless it @@ -5999,9 +6003,7 @@ the following principles resolve ambiguity: so that the second begins before the first ends and ends after the first ends, the first takes precedence. Thus, for example, `*foo _bar* baz_` is parsed as `foo _bar baz_` rather - than `*foo bar* baz`. For the same reason, - `**foo*bar**` is parsed as `foobar*` - rather than `foo*bar`. + than `*foo bar* baz`. 16. When there are two potential emphasis or strong emphasis spans with the same closing delimiter, the shorter one (the one that @@ -6581,18 +6583,30 @@ __foo_ bar_

foo bar baz

```````````````````````````````` - -But note: - ```````````````````````````````` example *foo**bar**baz* . -

foobarbaz

+

foobarbaz

```````````````````````````````` +Note that in the preceding case, the interpretation + +``` markdown +

foobarbaz

+``` + + +is precluded by the condition that a delimiter that +can both open and close (like the `*` after `foo` +cannot form emphasis if the sum of the lengths of +the delimiter runs containing the opening and +closing delimiters is a multiple of 3. + +The same condition ensures that the following +cases are all strong emphasis nested inside +emphasis, even when the interior spaces are +omitted: -The difference is that in the preceding case, the internal delimiters -[can close emphasis], while in the cases with spaces, they cannot. ```````````````````````````````` example ***foo** bar* @@ -6608,17 +6622,18 @@ The difference is that in the preceding case, the internal delimiters ```````````````````````````````` -Note, however, that in the following case we get no strong -emphasis, because the opening delimiter is closed by the first -`*` before `bar`: - ```````````````````````````````` example *foo**bar*** . -

foobar**

+

foobar

```````````````````````````````` +```````````````````````````````` example +*foo**bar*** +. +

foobar

+```````````````````````````````` Indefinite levels of nesting are possible: @@ -6712,18 +6727,13 @@ ____foo__ bar__ ```````````````````````````````` -But note: - ```````````````````````````````` example **foo*bar*baz** . -

foobarbaz**

+

foobarbaz

```````````````````````````````` -The difference is that in the preceding case, the internal delimiters -[can close emphasis], while in the cases with spaces, they cannot. - ```````````````````````````````` example ***foo* bar** . @@ -7038,13 +7048,6 @@ Rule 15: ```````````````````````````````` -```````````````````````````````` example -**foo*bar** -. -

foobar*

-```````````````````````````````` - - ```````````````````````````````` example *foo __bar *baz bim__ bam* . -- cgit v1.2.3