From 2011d2ea4d6ec9d1bd7409c22e4258aceaaa3afe Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 12 Sep 2022 13:50:48 +0200 Subject: Fix whitespace in GFM footnote definition identifiers * Fix a crash on line endings in footnote definitions * Fix to match spaces and tabs in identifiers to `cmark-gfm` * Fix order of one attribute --- tests/gfm_footnote.rs | 286 +++++++++++++++++++++++++++++++------------------- 1 file changed, 177 insertions(+), 109 deletions(-) (limited to 'tests/gfm_footnote.rs') diff --git a/tests/gfm_footnote.rs b/tests/gfm_footnote.rs index d371455..42c70d3 100644 --- a/tests/gfm_footnote.rs +++ b/tests/gfm_footnote.rs @@ -21,7 +21,7 @@ fn gfm_footnote() -> Result<(), String> {

Footnotes

  1. -

    whatevs

    +

    whatevs

@@ -43,7 +43,7 @@ fn gfm_footnote() -> Result<(), String> {

Voetnoten

  1. -

    dingen

    +

    dingen

@@ -64,7 +64,7 @@ fn gfm_footnote() -> Result<(), String> {

Footnotes

  1. -

    b

    +

    b

@@ -85,7 +85,7 @@ fn gfm_footnote() -> Result<(), String> {

Footnotes

  1. -

    b

    +

    b

@@ -106,7 +106,7 @@ fn gfm_footnote() -> Result<(), String> {

Footnotes

  1. -

    b

    +

    b

@@ -132,7 +132,7 @@ fn gfm_footnote() -> Result<(), String> {

Footnotes

  1. -

    c

    +

    c

@@ -146,7 +146,7 @@ fn gfm_footnote() -> Result<(), String> {

Footnotes

  1. -

    d 2

    +

    d 2

@@ -185,7 +185,7 @@ fn gfm_footnote() -> Result<(), String> {

Footnotes

  1. -

    y

    +

    y

@@ -199,7 +199,7 @@ fn gfm_footnote() -> Result<(), String> {

Footnotes

  1. -

    y

    +

    y

@@ -215,7 +215,7 @@ fn gfm_footnote() -> Result<(), String> {

Footnotes

  1. -

    y

    +

    y

@@ -229,7 +229,7 @@ fn gfm_footnote() -> Result<(), String> {

Footnotes

  1. -

    y

    +

    y

@@ -256,7 +256,7 @@ fn gfm_footnote() -> Result<(), String> {
  1. a -b

    +b

@@ -273,7 +273,7 @@ b
  • a -b

    +b

  • @@ -290,7 +290,7 @@ b
  • a -b

    +b

  • @@ -308,7 +308,7 @@ b

    b

    -
    + @@ -325,7 +325,7 @@ b

    Footnotes

    1. -

      y

      +

      y

    @@ -365,7 +365,7 @@ a!

    Footnotes

    1. -

      b 2

      +

      b 2

    @@ -391,7 +391,7 @@ a!

    Footnotes

    1. -

      b

      +

      b

    @@ -437,10 +437,10 @@ even another caret.

    Footnotes

    1. -

      numbers

      +

      numbers

    2. -

      caret

      +

      caret

    @@ -448,6 +448,74 @@ even another caret.

    "should match calls like GitHub" ); + // Note: + // * GH does not support line ending in call. + // See: + // Here line endings don’t make text disappear. + assert_eq!( + micromark_with_options( + r###"[^a]: # b + +[^c d]: # e + +[^f g]: # h + +[^i +j]: # k + +[^ l]: # l + +[^m ]: # m + +xxx[^a], [^c d], [^f g], [^i +j], [^ l], [^m ] + +--- + +Some calls.[^ w][^x ][^y][^z] + +[^w]: # w + +[^x]: # x + +[^ y]: # y + +[^x ]: # z +"###, + &gfm + )?, + r###"

    [^c d]: # e

    +

    [^f g]: # h

    +

    [^i +j]: # k

    +

    [^ l]: # l

    +

    [^m ]: # m

    +

    xxx1, [^c d], [^f g], [^i +j], [^ l], [^m ]

    +
    +

    Some calls.23[^y][^z]

    +

    [^ y]: # y

    +

    3: # z

    +

    Footnotes

    +
      +
    1. +

      b

      + +
    2. +
    3. +

      w

      + +
    4. +
    5. +

      x

      + 2 +
    6. +
    +
    +"###, + "should match whitespace in calls like GitHub (except for the bugs)" + ); + assert_eq!( micromark_with_options( r###"[^*emphasis*] @@ -504,22 +572,22 @@ even another caret.

    Footnotes

    1. -

      a

      +

      a

    2. -

      a

      +

      a

    3. -

      a

      +

      a

    4. -

      a

      +

      a

    5. -

      a

      +

      a

    6. -

      a

      +

      a

    @@ -555,16 +623,16 @@ even another caret.

    Footnotes

    1. -

      Defined in a block quote.

      +

      Defined in a block quote.

    2. -

      Directly after a block quote.

      +

      Directly after a block quote.

    3. -

      Defined in a list item.

      +

      Defined in a list item.

    4. -

      Directly after a list item.

      +

      Directly after a list item.

    @@ -612,21 +680,21 @@ even another caret.

    1. Paragraph -…continuation

      +…continuation

    2. Paragraph …continuation

      “code”, which is paragraphs…

      -

      …because of the indent!

      +

      …because of the indent!

    3. Paragraph -…continuation

      +…continuation

    4. Paragraph -…continuation

      +…continuation

    @@ -664,19 +732,19 @@ Lazy!

    1. - +
    2. -

      Paragraph.

      +

      Paragraph.

    3. - +
    4. -

      Another blank.

      +

      Another blank.

    5. - +
    @@ -717,46 +785,46 @@ Lazy!

    Footnotes

    1. -

      alpha

      +

      alpha

    2. -

      bravo

      +

      bravo

    3. charlie -indented delta

      +indented delta

    4. -

      echo

      +

      echo

    5. -

      foxtrot

      +

      foxtrot

    6. golf

      - +
    7. hotel

      - +
    8. india

      - +
    9. juliett

      - +

    10. - +
      • @@ -770,7 +838,7 @@ indented delta +
    @@ -790,7 +858,7 @@ indented delta

    Footnotes

    1. -

      Recursion11 2 3 4

      +

      Recursion11 2 3 4

    @@ -812,7 +880,7 @@ indented delta

    Footnotes

    1. -

      a

      +

      a

    @@ -858,16 +926,16 @@ indented delta

    Footnotes

    1. -

      a

      +

      a

    2. -

      b

      +

      b

    3. -

      d

      +

      d

    4. -

      e

      +

      e

    @@ -891,13 +959,13 @@ indented delta

    Footnotes

    1. -

      a

      +

      a

    2. -

      b

      +

      b

    3. -

      c

      +

      c

    @@ -941,28 +1009,28 @@ indented delta

    Paragraph -…continuation

    +…continuation

  • -

    Another

    +

    Another

  • Paragraph -…continuation

    +…continuation

  • Paragraph …continuation “code”, which is paragraphs…

    -

    …because of the indent!

    +

    …because of the indent!

  • Paragraph -…continuation

    +…continuation

  • Paragraph -…continuation

    +…continuation

  • @@ -986,13 +1054,13 @@ indented delta

    Footnotes

    1. -

      a

      +

      a

    2. -

      b

      +

      b

    3. -

      c

      +

      c

    @@ -1043,18 +1111,18 @@ indented delta

    Footnotes

    1. -

      Paragraph

      +

      Paragraph

    2. Paragraph

      “code”, which is paragraphs…

      -

      …because of the indent!

      +

      …because of the indent!

    3. -

      Paragraph

      +

      Paragraph

    4. -

      Paragraph

      +

      Paragraph

    @@ -1100,7 +1168,7 @@ indented delta

    Paragraph

    Heading

    -
    +
  • Paragraph

    @@ -1109,21 +1177,21 @@ indented delta +
  • Paragraph

    block quote

    - +
  • Paragraph

    • list
    - +
  • @@ -1152,16 +1220,16 @@ more code

    Footnotes

    1. -

      Paragraph

      +

      Paragraph

    2. -

      Paragraph

      +

      Paragraph

    3. - +
    4. -

      Paragraph

      +

      Paragraph

    @@ -1204,18 +1272,18 @@ more code

    Footnotes

    1. -

      Paragraph

      +

      Paragraph

    2. Paragraph

      “code”, which is paragraphs…

      -

      …because of the indent!

      +

      …because of the indent!

    3. -

      Paragraph

      +

      Paragraph

    4. -

      Paragraph

      +

      Paragraph

    @@ -1253,7 +1321,7 @@ more code
  • Paragraph

    Heading

    - +
  • Paragraph

    @@ -1261,21 +1329,21 @@ more code more code - +
  • Paragraph

    block quote

    - +
  • Paragraph

    • list
    - +
  • @@ -1311,7 +1379,7 @@ isn’t indented.

    Footnotes

    1. -

      Here is the footnote.

      +

      Here is the footnote.

    2. Here’s one with multiple blocks.

      @@ -1321,7 +1389,7 @@ belong to the previous footnote.

      The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like -multi-paragraph list items.

      +multi-paragraph list items.

    @@ -1384,38 +1452,38 @@ multi-paragraph list items.

    Footnotes

    1. -

      3

      +

      3

    2. -

      2

      +

      2

    3. -

      1

      +

      1

    4. -

      0

      +

      0

    5. 3

      -

      5

      +

      5

    6. 3

      -

      4

      +

      4

    7. -

      3

      +

      3

    8. 2

      -

      5

      +

      5

    9. 2

      -

      4

      +

      4

    10. -

      2

      +

      2

    @@ -1476,35 +1544,35 @@ multi-paragraph list items. a

    8
     
    -
    +
  • a

    -

    7

    +

    7

  • a

    -

    6

    +

    6

  • a

    -

    5

    +

    5

  • a

    -

    4

    +

    4

  • -

    a

    +

    a

  • -

    a

    +

    a

  • -

    a

    +

    a

  • -

    a

    +

    a

  • -- cgit