assertTrue($parser instanceof Parser); return $parser; } /** * @depends testParser */ public function testEmpty($parser) { $this->assertEquals("\n", $parser->transform('')); } /** * @depends testParser */ public function testEmphasis($parser) { $text = <<normal emphasis with asterisks

normal emphasis with underscore

strong emphasis with asterisks

strong emphasis with underscore

This is some text emphased with asterisks.

EOF; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testLiteralAsterisk($parser) { $text = '\*this text is surrounded by literal asterisks\*'; $html = '

*this text is surrounded by literal asterisks*

'; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testTitle($parser) { $text = <<Titre de niveau 1 (balise H1)

Titre de niveau 2 (balise H2)

Titre de niveau 1

Titre de niveau 2

Titre de niveau 6

Close title 3

Close title 4

EOF; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testQuote($parser) { $text = << Ceci est un bloc de citation avec deux paragraphes. Lorem ipsum dolor > sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere > lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, > risus. > > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse > id sem consectetuer libero luctus adipiscing. EOF; $html = <<

Ceci est un bloc de citation avec deux paragraphes. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.

EOF; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testNestedQuote($parser) { $text = << Ceci est le premier niveau de citation. > > > Ceci est un bloc de citation imbriqué. > > Retour au premier niveau. EOF; $html = <<

Ceci est le premier niveau de citation.

Ceci est un bloc de citation imbriqué.

Retour au premier niveau.

EOF; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testQuotedHtml($parser) { $text = << ## This is a header. > > 1. This is the first list item. > 2. This is the second list item. > > Here's some example code: > > return shell_exec("echo \$input | \$markdown_script"); EOF; $html = <<

This is a header.

  1. This is the first list item.
  2. This is the second list item.

Here's some example code:

return shell_exec("echo \$input | \$markdown_script");
EOF; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testUnorderedList($parser) { $text = <<
  • Red
  • Green
  • Blue
  • EOF; $this->assertSame($html, $parser->transform($text)); $text = <<assertSame($html, $parser->transform($text)); $text = <<assertSame($html, $parser->transform($text)); $text = <<
  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
  • Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
  • EOF; $this->assertSame($html, $parser->transform($text)); $text = <<assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testOrderedList($parser) { $text = <<
  • Bird
  • McHale
  • Parish
  • EOF; $this->assertSame($html, $parser->transform($text)); $text = <<assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testInlineLink($parser) { $text = <<This is an example inline link.

    This link has no title attribute.

    EOF; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testReferenceLink($parser) { $text = <<I get 10 times more traffic from Google than from Yahoo or MSN.

    EOF; $this->assertSame($html, $parser->transform($text)); $text = <<assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testAutoLink($parser) { $text = ''; $html = '

    http://exemple.com/

    '; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testInlineImage($parser) { $text = <<Alt text Alt text

    EOF; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testReferenceImage($parser) { $text = <<Alt text

    EOF; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testCode($parser) { $text = 'Use the `printf()` function.'; $html = '

    Use the printf() function.

    '; $this->assertSame($html, $parser->transform($text)); $text = '``There is a literal backtick (`) here.``'; $html = '

    There is a literal backtick (`) here.

    '; $this->assertSame($html, $parser->transform($text)); $text = <<A single backtick in a code span: `

    A backtick-delimited string in a code span: `foo`

    EOF; $this->assertSame($html, $parser->transform($text)); $text = 'Please don\'t use any `` tags.'; $html = '

    Please don\'t use any <blink> tags.

    '; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testCodeBlock($parser) { $text = <<This is a normal paragraph:

    This is a code block.
    
    EOF; $this->assertSame($html, $parser->transform($text)); $text = <<Here is an example of AppleScript:

    tell application "Foo"
        beep
    end tell
    
    EOF; $this->assertSame($html, $parser->transform($text)); $text = << © 2004 Foo Corporation EOF; $html = <<<div class="footer"> &copy; 2004 Foo Corporation </div> EOF; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testHorizontalRule($parser) { $text = <<



    EOF; $this->assertSame($html, $parser->transform($text)); } /** * @depends testParser */ public function testHeaderId($parser) { $text = <<Header 1

    Header 2

    EOF; $this->assertEquals($html, $parser->transform($text)); } /** * @depends testParser */ public function testFencedCodeBlock($parser) { $text = <<This is a paragraph introducing:

    a one-line code block
    
    EOF; $this->assertEquals($html, $parser->transform($text)); $text = <<
  • List item

    Not an indented code block, but a second paragraph in the list item

  • This is a code block, fenced-style
    
    EOF; $this->assertEquals($html, $parser->transform($text)); } /** * @depends testParser */ public function testTable($parser) { $text = << First Header Second Header Content Cell Content Cell Content Cell Content Cell EOF; $this->assertEquals($html, $parser->transform($text)); $text = <<assertEquals($html, $parser->transform($text)); $text = << Function name Description help() Display the help window. destroy() Destroy your computer! EOF; $this->assertEquals($html, $parser->transform($text)); } /** * @depends testParser */ public function testDefinitionList($parser) { $text = <<
    Apple
    Pomaceous fruit of plants of the genus Malus in the family Rosaceae.
    Orange
    The fruit of an evergreen tree of the genus Citrus.
    EOF; $this->assertEquals($html, $parser->transform($text)); $text = <<assertEquals($html, $parser->transform($text)); } /** * @depends testParser */ public function testFootNote($parser) { $text = <<That's some text with a footnote.1


    1. And that's the footnote. 

    EOF; $this->assertEquals($html, $parser->transform($text)); } /** * @depends testParser */ public function testAbbreviation($parser) { $text = <<The HTML specification is maintained by the W3C.

    EOF; $this->assertEquals($html, $parser->transform($text)); } /** * @depends testParser */ public function testInlineHtml($parser) { $text = <<Markup Language EOF; $html = <<Hyper Text Markup Language

    EOF; $this->assertEquals($html, $parser->transform($text)); } }