From f167c32721e78621bb86befe34a56a2f463e0e03 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 27 Apr 2015 22:46:02 -0700 Subject: Fixed rules for `_`-based emphasis and strong emphasis. Previously this was not counted as emphasis _(bar)_. because the closing delimiter is both left- and right- flanking. This fix allows such delimiters, provided they're followed by punctuation (= they have punctuation on both sides). Similarly, mutatis mutandis, for opening delimiters and for `__`. Closes #317. --- spec.txt | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/spec.txt b/spec.txt index c2a867d..f61f5d5 100644 --- a/spec.txt +++ b/spec.txt @@ -4643,28 +4643,36 @@ The following rules define emphasis and strong emphasis: 2. A single `_` character [can open emphasis] iff it is part of a [left-flanking delimiter run] - and not part of a [right-flanking delimiter run]. + and either (a) not part of a [right-flanking delimiter run] + or (b) part of a [right-flanking delimeter run] + preceded by punctuation. 3. A single `*` character [can close emphasis](@can-close-emphasis) iff it is part of a [right-flanking delimiter run]. -4. A single `_` character [can close emphasis] - iff it is part of a [right-flanking delimiter run] - and not part of a [left-flanking delimiter run]. +4. A single `_` character [can close emphasis] iff + it is part of a [right-flanking delimiter run] + and either (a) not part of a [left-flanking delimiter run] + or (b) part of a [left-flanking delimeter run] + followed by punctuation. 5. A double `**` [can open strong emphasis](@can-open-strong-emphasis) iff it is part of a [left-flanking delimiter run]. -6. A double `__` [can open strong emphasis] - iff it is part of a [left-flanking delimiter run] - and not part of a [right-flanking delimiter run]. +6. A double `__` [can open strong emphasis] iff + it is part of a [left-flanking delimiter run] + and either (a) not part of a [right-flanking delimiter run] + or (b) part of a [right-flanking delimeter run] + preceded by punctuation. 7. A double `**` [can close strong emphasis](@can-close-strong-emphasis) iff it is part of a [right-flanking delimiter run]. 8. A double `__` [can close strong emphasis] - iff it is part of a [right-flanking delimiter run] - and not part of a [left-flanking delimiter run]. + it is part of a [right-flanking delimiter run] + and either (a) not part of a [left-flanking delimiter run] + or (b) part of a [left-flanking delimeter run] + followed by punctuation. 9. Emphasis begins with a delimiter that [can open emphasis] and ends with a delimiter that [can close emphasis], and that uses the same @@ -4835,6 +4843,16 @@ both left- and right-flanking:

"aa"_"bb"_"cc"

. +This is emphasis, even though the opening delimiter is +both left- and right-flanking, because it is preceded by +punctuation: + +. +foo-_(bar) +. +

foo-(bar)

+. + Rule 3: This is not emphasis, because the closing delimiter does @@ -4943,6 +4961,16 @@ _foo_bar_baz_

foo_bar_baz

. +This is emphasis, even though the closing delimiter is +both left- and right-flanking, because it is followed by +punctuation: + +. +_(bar)_. +. +

(bar).

+. + Rule 5: . @@ -5039,6 +5067,17 @@ __foo, __bar__, baz__

foo, bar, baz

. +This is strong emphasis, even though the opening delimiter is +both left- and right-flanking, because it is preceded by +punctuation: + +. +foo-_(bar)_ +. +

foo-(bar)

+. + + Rule 7: This is not strong emphasis, because the closing delimiter is preceded @@ -5142,6 +5181,16 @@ __foo__bar__baz__

foo__bar__baz

. +This is strong emphasis, even though the closing delimiter is +both left- and right-flanking, because it is followed by +punctuation: + +. +_(bar)_. +. +

(bar).

+. + Rule 9: Any nonempty sequence of inline elements can be the contents of an -- cgit v1.2.3