//! These tests were ported from the original python-textile library. //! use pretty_assertions::assert_str_eq; const XHTML_KNOWN_VALUES: [(&str, &str); 104] = [ ("hello, world", "

hello, world

"), ("A single paragraph.\n\nFollowed by another.", "

A single paragraph.

\n\n

Followed by another.

"), ("I am very serious.\n\n
\nI am very serious.\n
", "

I am very serious.

\n\n
\nI am <b>very</b> serious.\n
"), ("I spoke.\nAnd none replied.", "

I spoke.
\nAnd none replied.

"), (r#""Observe!""#, "

“Observe!”

"), ("Observe -- very nice!", "

Observe — very nice!

"), ("Observe - tiny and brief.", "

Observe – tiny and brief.

"), ("Observe...", "

Observe…

"), ("Observe ...", "

Observe …

"), ("Observe: 2 x 2.", "

Observe: 2 × 2.

"), ("one(TM), two(R), three(C).", "

one™, two®, three©.

"), ("h1. Header 1", "

Header 1

"), ("h2. Header 2", "

Header 2

"), ("h3. Header 3", "

Header 3

"), ("An old text\n\nbq. A block quotation.\n\nAny old text", "

An old text

\n\n
\n\t

A block quotation.

\n
\n\n

Any old text

"), ("I _believe_ every word.", "

I believe every word.

"), ("And then? She *fell*!", "

And then? She fell!

"), ("I __know__.\nI **really** __know__.", "

I know.
\nI really know.

"), ("??Cat's Cradle?? by Vonnegut", "

Cat’s Cradle by Vonnegut

"), ("Convert with @str(foo)@", "

Convert with str(foo)

"), ("I\'m -sure- not sure.", "

I’m sure not sure.

"), ("You are a +pleasant+ child.", "

You are a pleasant child.

"), ("a ^2^ + b ^2^ = c ^2^", "

a 2 + b 2 = c 2

"), ("log ~2~ x", "

log 2 x

"), ("I'm %unaware% of most soft drinks.", "

I’m unaware of most soft drinks.

"), ("I'm %{color:red}unaware%\nof most soft drinks.", "

I’m unaware
\nof most soft drinks.

"), ("p(example1). An example", "

An example

"), ("p(#big-red). Red here", "

Red here

"), ("p(example1#big-red2). Red here", "

Red here

"), ("p{color:blue;margin:30px}. Spacey blue", "

Spacey blue

"), ("p[fr]. rouge", "

rouge

"), ("I seriously *{color:red}blushed*\nwhen I _(big)sprouted_ that\ncorn stalk from my\n%[es]cabeza%.", "

I seriously blushed
\nwhen I sprouted that
\ncorn stalk from my
\ncabeza.

"), ("p<. align left", "

align left

"), ("p>. align right", "

align right

"), ("p=. centered", "

centered

"), ("p<>. justified", "

justified

"), ("p(. left ident 1em", "

left ident 1em

"), ("p((. left ident 2em", "

left ident 2em

"), ("p))). right ident 3em", "

right ident 3em

"), ("h2()>. Bingo.", "

Bingo.

"), ("h3()>[no]{color:red}. Bingo", "

Bingo

"), ("
\n\na.gsub!( /\n
", "
\n\na.gsub!( /</, \"\" )\n\n
"), ("
\n\nh3. Sidebar\n\n\"Hobix\":http://hobix.com/\n\"Ruby\":http://ruby-lang.org/\n\n
\n\nThe main text of the\npage goes here and will\nstay to the left of the\nsidebar.", "
\n\n

Sidebar

\n\n

Hobix
\nRuby

\n\n
\n\n

The main text of the
\npage goes here and will
\nstay to the left of the
\nsidebar.

"), ("# A first item\n# A second item\n# A third", "
    \n\t
  1. A first item
  2. \n\t
  3. A second item
  4. \n\t
  5. A third
  6. \n
"), ("# Fuel could be:\n## Coal\n## Gasoline\n## Electricity\n# Humans need only:\n## Water\n## Protein", "
    \n\t
  1. Fuel could be:\n\t
      \n\t\t
    1. Coal
    2. \n\t\t
    3. Gasoline
    4. \n\t\t
    5. Electricity
    6. \n\t
  2. \n\t
  3. Humans need only:\n\t
      \n\t\t
    1. Water
    2. \n\t\t
    3. Protein
    4. \n\t
  4. \n\t
"), ("* A first item\n* A second item\n* A third", ""), ("* Fuel could be:\n** Coal\n** Gasoline\n** Electricity\n* Humans need only:\n** Water\n** Protein", ""), ("I searched \"Google\":http://google.com.", "

I searched Google.

"), ("I searched \"a search engine (Google)\":http://google.com.", "

I searched a search engine.

"), ("I am crazy about \"Hobix\":hobix\nand \"it's\":hobix \"all\":hobix I ever\n\"link to\":hobix!\n\n[hobix]http://hobix.com", "

I am crazy about Hobix
\nand it’s all I ever
\nlink to!

"), ("!http://hobix.com/sample.jpg!", "

\"\"

"), ("!openwindow1.gif(Bunny.)!", "

\"Bunny.\"

"), ("!openwindow1.gif!:http://hobix.com/", "

\"\"

"), ("!>obake.gif!\n\nAnd others sat all round the small\nmachine and paid it to sing to them.", "

\"\"

\n\n

And others sat all round the small
\nmachine and paid it to sing to them.

"), ("We use CSS(Cascading Style Sheets).", "

We use CSS.

"), ("|one|two|three|\n|a|b|c|", "\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
onetwothree
abc
"), ("| name | age | sex |\n| joan | 24 | f |\n| archie | 29 | m |\n| bella | 45 | f |", "\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
name age sex
joan 24 f
archie 29 m
bella 45 f
"), ("|_. name |_. age |_. sex |\n| joan | 24 | f |\n| archie | 29 | m |\n| bella | 45 | f |", "\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
name age sex
joan 24 f
archie 29 m
bella 45 f
"), ("", "

"), ("pre.. Hello\n\nHello Again\n\np. normal text", "
Hello\n\nHello Again
\n\n

normal text

"), ("
this is in a pre tag
", "
this is in a pre tag
"), ("\"test1\":http://foo.com/bar--baz\n\n\"test2\":http://foo.com/bar---baz\n\n\"test3\":http://foo.com/bar-17-18-baz", "

test1

\n\n

test2

\n\n

test3

"), ("\"foo ==(bar)==\":#foobar", "

foo (bar)

"), ("!http://render.mathim.com/A%5EtAx%20%3D%20A%5Et%28Ax%29.!", "

\"\"

"), ("* Point one\n* Point two\n## Step 1\n## Step 2\n## Step 3\n* Point three\n** Sub point 1\n** Sub point 2", ""), ("@array[4] = 8@", "

array[4] = 8

"), ("#{color:blue} one\n# two\n# three", "
    \n\t
  1. one
  2. \n\t
  3. two
  4. \n\t
  5. three
  6. \n
"), ("Links (like \"this\":http://foo.com), are now mangled in 2.1.0, whereas 2.0 parsed them correctly.", "

Links (like this), are now mangled in 2.1.0, whereas 2.0 parsed them correctly.

"), ("@monospaced text@, followed by text", "

monospaced text, followed by text

"), ("h2. A header\n\n\n\n\n\nsome text", "

A header

\n\n\n\n\n\n

some text

"), ("pre.. foo bar baz\nquux", "
foo bar baz\nquux
"), ("line of text\n\n leading spaces", "

line of text

\n\n leading spaces"), ("\"some text\":http://www.example.com/?q=foo%20bar and more text", "

some text and more text

"), ("(??some text??)", "

(some text)

"), ("(*bold text*)", "

(bold text)

"), ("H[~2~]O", "

H2O

"), ("p=. Où est l'école, l'église s'il vous plaît?", "

Où est l’école, l’église s’il vous plaît?

"), ("p=. *_The_* _*Prisoner*_", "

The Prisoner

"), ("p=. \"An emphasised _word._\" & \"*A spanned phrase.*\" ", "

“An emphasised word.” & “A spanned phrase.

"), ("p=. \"*Here*'s a word!\" ", "

Here’s a word!”

"), ("p=. \"Please visit our \"Textile Test Page\":http://textile.sitemonks.com\" ", "

“Please visit our Textile Test Page

"), ("| Foreign EXPÓŅÉNTIAL |", "\t\n\t\t\n\t\t\t\n\t\t\n\t
Foreign EXPÓŅÉNTIAL
"), ("Piękne ŹDŹBŁO", "

Piękne ŹDŹBŁO

"), ("p=. Tell me, what is AJAX(Asynchronous Javascript and XML), please?", "

Tell me, what is AJAX, please?

"), ("p{font-size:0.8em}. *TxStyle* is a documentation project of Textile 2.4 for \"Textpattern CMS\":http://texpattern.com.", "

TxStyle is a documentation project of Textile 2.4 for Textpattern CMS.

"), ("\"Übermensch\":http://de.wikipedia.org/wiki/Übermensch", "

Übermensch

"), ("Here is some text with a block.\n\n\n\n\n\nbc. ", "

Here is some text with a block.

\n\n\n\n\n\n
<!-- Here is a comment block in a code block. -->
"), ("\"Textile(c)\" is a registered(r) 'trademark' of Textpattern(tm) -- or TXP(That's textpattern!) -- at least it was - back in '88 when 2x4 was (+/-)5(o)C ... QED!\n\np{font-size: 200%;}. 2(1/4) 3(1/2) 4(3/4)", "

“Textile©” is a registered® ‘trademark’ of Textpattern™ — or TXP — at least it was – back in ’88 when 2×4 was ±5°C … QED!

\n\n

2¼ 3½ 4¾

"), ("|=. Testing colgroup and col syntax\n|:\\5. 80\n|a|b|c|d|e|\n\n|=. Testing colgroup and col syntax|\n|:\\5. 80|\n|a|b|c|d|e|", "\t\n\t\n\t\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
Testing colgroup and col syntax
abcde
\n\n\t\n\t\n\t\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
Testing colgroup and col syntax
abcde
"), ("table(#dvds){border-collapse:collapse}. Great films on DVD employing Textile summary, caption, thead, tfoot, two tbody elements and colgroups\n|={font-size:140%;margin-bottom:15px}. DVDs with two Textiled tbody elements\n|:\\3. 100 |{background:#ddd}|250||50|300|\n|^(header).\n|_. Title |_. Starring |_. Director |_. Writer |_. Notes |\n|~(footer).\n|\\5=. This is the tfoot, centred |\n|-(toplist){background:#c5f7f6}.\n| _The Usual Suspects_ | Benicio Del Toro, Gabriel Byrne, Stephen Baldwin, Kevin Spacey | Bryan Singer | Chris McQaurrie | One of the finest films ever made |\n| _Se7en_ | Morgan Freeman, Brad Pitt, Kevin Spacey | David Fincher | Andrew Kevin Walker | Great psychological thriller |\n| _Primer_ | David Sullivan, Shane Carruth | Shane Carruth | Shane Carruth | Amazing insight into trust and human psychology
rather than science fiction. Terrific! |\n| _District 9_ | Sharlto Copley, Jason Cope | Neill Blomkamp | Neill Blomkamp, Terri Tatchell | Social commentary layered on thick,\nbut boy is it done well |\n|-(medlist){background:#e7e895;}.\n| _Arlington Road_ | Tim Robbins, Jeff Bridges | Mark Pellington | Ehren Kruger | Awesome study in neighbourly relations |\n| _Phone Booth_ | Colin Farrell, Kiefer Sutherland, Forest Whitaker | Joel Schumacher | Larry Cohen | Edge-of-the-seat stuff in this\nshort but brilliantly executed thriller |", "\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t
DVDs with two Textiled tbody elements
Title Starring Director Writer Notes
This is the tfoot, centred
The Usual Suspects Benicio Del Toro, Gabriel Byrne, Stephen Baldwin, Kevin Spacey Bryan Singer Chris McQaurrie One of the finest films ever made
Se7en Morgan Freeman, Brad Pitt, Kevin Spacey David Fincher Andrew Kevin Walker Great psychological thriller
Primer David Sullivan, Shane Carruth Shane Carruth Shane Carruth Amazing insight into trust and human psychology
\nrather than science fiction. Terrific!
District 9 Sharlto Copley, Jason Cope Neill Blomkamp Neill Blomkamp, Terri Tatchell Social commentary layered on thick,
\nbut boy is it done well
Arlington Road Tim Robbins, Jeff Bridges Mark Pellington Ehren Kruger Awesome study in neighbourly relations
Phone Booth Colin Farrell, Kiefer Sutherland, Forest Whitaker Joel Schumacher Larry Cohen Edge-of-the-seat stuff in this
\nshort but brilliantly executed thriller
"), ("-(hot) *coffee* := Hot _and_ black\n-(hot#tea) tea := Also hot, but a little less black\n-(cold) milk := Nourishing beverage for baby cows.\nCold drink that goes great with cookies. =:\n\n-(hot) coffee := Hot and black\n-(hot#tea) tea := Also hot, but a little less black\n-(cold) milk :=\nNourishing beverage for baby cows.\nCold drink that goes great with cookies. =:", "
\n\t
coffee
\n\t
Hot and black
\n\t
tea
\n\t
Also hot, but a little less black
\n\t
milk
\n\t
Nourishing beverage for baby cows.
\nCold drink that goes great with cookies.
\n
\n\n
\n\t
coffee
\n\t
Hot and black
\n\t
tea
\n\t
Also hot, but a little less black
\n\t
milk
\n\t

Nourishing beverage for baby cows.
\nCold drink that goes great with cookies.

\n
"), (";(class#id) Term 1\n: Def 1\n: Def 2\n: Def 3", "
\n\t
Term 1
\n\t
Def 1
\n\t
Def 2
\n\t
Def 3
\n
"), ("*Here is a comment*\n\nHere is *(class)a comment*\n\n*(class)Here is a class* that is a little extended and is\n*followed* by a strong word!\n\nbc. ; Content-type: text/javascript\n; Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0\n; Expires: Sat, 24 Jul 2003 05:00:00 GMT\n; Last-Modified: Wed, 1 Jan 2025 05:00:00 GMT\n; Pragma: no-cache\n\n*123 test*\n\n*test 123*\n\n**123 test**\n\n**test 123**", "

Here is a comment

\n\n

Here is a comment

\n\n

Here is a class that is a little extended and is
\nfollowed by a strong word!

\n\n
; Content-type: text/javascript\n; Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0\n; Expires: Sat, 24 Jul 2003 05:00:00 GMT\n; Last-Modified: Wed, 1 Jan 2025 05:00:00 GMT\n; Pragma: no-cache
\n\n

123 test

\n\n

test 123

\n\n

123 test

\n\n

test 123

"), ("#_(first#list) one\n# two\n# three\n\ntest\n\n#(ordered#list2).\n# one\n# two\n# three\n\ntest\n\n#_(class_4).\n# four\n# five\n# six\n\ntest\n\n#_ seven\n# eight\n# nine\n\ntest\n\n# one\n# two\n# three\n\ntest\n\n#22 22\n# 23\n# 24", "
    \n\t
  1. one
  2. \n\t
  3. two
  4. \n\t
  5. three
  6. \n
\n\n

test

\n\n
    \n\t
  1. one
  2. \n\t
  3. two
  4. \n\t
  5. three
  6. \n
\n\n

test

\n\n
    \n\t
  1. four
  2. \n\t
  3. five
  4. \n\t
  5. six
  6. \n
\n\n

test

\n\n
    \n\t
  1. seven
  2. \n\t
  3. eight
  4. \n\t
  5. nine
  6. \n
\n\n

test

\n\n
    \n\t
  1. one
  2. \n\t
  3. two
  4. \n\t
  5. three
  6. \n
\n\n

test

\n\n
    \n\t
  1. 22
  2. \n\t
  3. 23
  4. \n\t
  5. 24
  6. \n
"), ("# one\n##3 one.three\n## one.four\n## one.five\n# two\n\ntest\n\n#_(continuation#section2).\n# three\n# four\n##_ four.six\n## four.seven\n# five\n\ntest\n\n#21 twenty-one\n# twenty-two", "
    \n\t
  1. one\n\t
      \n\t\t
    1. one.three
    2. \n\t\t
    3. one.four
    4. \n\t\t
    5. one.five
    6. \n\t
  2. \n\t
  3. two
  4. \n
\n\n

test

\n\n
    \n\t
  1. three
  2. \n\t
  3. four\n\t
      \n\t\t
    1. four.six
    2. \n\t\t
    3. four.seven
    4. \n\t
  4. \n\t
  5. five
  6. \n
\n\n

test

\n\n
    \n\t
  1. twenty-one
  2. \n\t
  3. twenty-two
  4. \n
"), ("|* Foo[^2^]\n* _bar_\n* ~baz~ |\n|#4 *Four*\n# __Five__ |\n|-(hot) coffee := Hot and black\n-(hot#tea) tea := Also hot, but a little less black\n-(cold) milk :=\nNourishing beverage for baby cows.\nCold drink that goes great with cookies. =:\n|", "\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t
    \n\t
  • Foo2
  • \n\t
  • bar
  • \n\t
  • baz
  • \n
    \n\t
  1. Four
  2. \n\t
  3. Five
  4. \n
\n\t
coffee
\n\t
Hot and black
\n\t
tea
\n\t
Also hot, but a little less black
\n\t
milk
\n\t

Nourishing beverage for baby cows.
\nCold drink that goes great with cookies.

\n
"), ("h4. A more complicated table\n\ntable(tableclass#tableid){color:blue}.\n|_. table |_. more |_. badass |\n|\\3. Horizontal span of 3|\n(firstrow). |first|HAL(open the pod bay doors)|1|\n|some|{color:green}. styled|content|\n|/2. spans 2 rows|this is|quite a|\n| deep test | don't you think?|\n(lastrow). |fifth|I'm a lumberjack|5|\n|sixth| _*bold italics*_ |6|", "

A more complicated table

\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
table more badass
Horizontal span of 3
firstHAL1
somestyledcontent
spans 2 rowsthis isquite a
deep test don’t you think?
fifthI’m a lumberjack5
sixth bold italics 6
"), ("| *strong* |\n\n| _em_ |\n\n| Inter-word -dashes- | ZIP-codes are 5- or 9-digit codes |", "\t\n\t\t\n\t\t\t\n\t\t\n\t
strong
\n\n\t\n\t\t\n\t\t\t\n\t\t\n\t
em
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
Inter-word dashes ZIP-codes are 5- or 9-digit codes
"), ("|_. attribute list |\n|<. align left |\n|>. align right|\n|=. center |\n|<>. justify me|\n|^. valign top |\n|~. bottom |", "\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t
attribute list
align left
align right
center
justify me
valign top
bottom
"), ("h2. A definition list\n\n;(class#id) Term 1\n: Def 1\n: Def 2\n: Def 3\n;; Center\n;; NATO(Why Em Cee Ayy)\n:: Subdef 1\n:: Subdef 2\n;;; SubSub Term\n::: SubSub Def 1\n::: SubSub Def 2\n::: Subsub Def 3\nWith newline\n::: Subsub Def 4\n:: Subdef 3\n: DEF 4\n; Term 2\n: Another def\n: And another\n: One more\n:: A def without a term\n:: More defness\n; Third term for good measure\n: My definition of a boombastic jazz", "

A definition list

\n\n
\n\t
Term 1
\n\t
Def 1
\n\t
Def 2
\n\t
Def 3\n\t
\n\t\t
Center
\n\t\t
NATO
\n\t\t
Subdef 1
\n\t\t
Subdef 2\n\t\t
\n\t\t\t
SubSub Term
\n\t\t\t
SubSub Def 1
\n\t\t\t
SubSub Def 2
\n\t\t\t
Subsub Def 3
\nWith newline
\n\t\t\t
Subsub Def 4
\n\t\t
\n\t\t
Subdef 3
\n\t
\n\t
DEF 4
\n\t
Term 2
\n\t
Another def
\n\t
And another
\n\t
One more\n\t
\n\t\t
A def without a term
\n\t\t
More defness
\n\t
\n\t
Third term for good measure
\n\t
My definition of a boombastic jazz
\n
"), ("###. Here's a comment.\n\nh3. Hello\n\n###. And\nanother\none.\n\nGoodbye.", "

Hello

\n\n

Goodbye.

"), ("h2. A Definition list which covers the instance where a new definition list is created with a term without a definition\n\n- term :=\n- term2 := def", "

A Definition list which covers the instance where a new definition list is created with a term without a definition

\n\n
\n\t
term
\n\t
term2
\n\t
def
\n
"), ("!{height:20px;width:20px;}https://1.gravatar.com/avatar/!", "

\"\"

"), ("& test", "

& test

"), ]; #[test] fn test_known_values_xhtml() { let textile = rustextile::Textile::default() .set_html_kind(rustextile::HtmlKind::XHTML); for (text, expected) in XHTML_KNOWN_VALUES { let processed = textile.parse(text); assert_str_eq!(processed, expected); } }