~fancycade/chicken-cmark

e88216e7647a785dd1bc2f69862b6607814d9415 — Harley Swick 3 years ago f399b19 0.1.0
Properly setup egg file with test dependencies + make proper test script + cleanup
4 files changed, 543 insertions(+), 534 deletions(-)

D build.sh
M cmark.egg
D run_test.sh
R test.scm => tests/run.scm
D build.sh => build.sh +0 -1
@@ 1,1 0,0 @@
csc cmark.scm -C -lcmark -L -lcmark

M cmark.egg => cmark.egg +7 -4
@@ 1,5 1,8 @@
((author "Me")
 (synopsis "A cool hello-world library")
((synopsis "A chicken wrapper for cmark with markdown to sxml capabilities")
 (author "Harley Swick")
 (license "MIT")
 (components (extension cmark  (csc-options "-C" "-lcmark" "-L" "-lcmark")
 )))
\ No newline at end of file
 (category parsing)
 (components (extension cmark  (csc-options "-C" "-lcmark" "-L" "-lcmark")))
 (test-dependencies test lowdown)
 (foreign-dependencies cmark)
 )

D run_test.sh => run_test.sh +0 -4
@@ 1,4 0,0 @@
#!/bin/sh

csc test.scm -C -lcmark -L -lcmark
./test

R test.scm => tests/run.scm +536 -525
@@ 6,9 6,11 @@
 (chicken port)
 sxml-transforms
 srfi-1
 lowdown)
 lowdown
 test
 cmark)

(include "cmark.scm")
;;(include "cmark.scm")

(define (file-extension filename)
  (let ([ss (string-split filename ".")])


@@ 128,11 130,15 @@
(define (out-file? filename)
  (equal? (file-extension filename) "out"))

(define md-files (filter markdown? (directory "tests")))
;;(define md-files (filter markdown? (directory "tests")))
(define md-files (filter markdown? (directory ".")))
;; (define out-files (filter out-file? (directory "tests")))

;;(define (file->string filename)
;;  (read-string #f (open-input-file (string-append "tests/" filename))))

(define (file->string filename)
  (read-string #f (open-input-file (string-append "tests/" filename))))
  (read-string #f (open-input-file filename)))

(define (sxml->HTML-string sxml)
  (with-output-to-string (lambda () (SXML->HTML sxml))))


@@ 140,7 146,7 @@
(define (compare-cmark-to-lowdown filename)
  (let* ([s (file->string filename)]
	 [lowdown-sxml (markdown->sxml s)]
	 [cmark-sxml (cmark-string->sxml s)]
	 [cmark-sxml (cmark->sxml s)]
	 [lowdown-html (sxml->HTML-string lowdown-sxml)]
	 [cmark-html (sxml->HTML-string cmark-sxml)])
    (print (string-append "testing " filename))


@@ 150,11 156,18 @@
    (print "cmark")
    (pretty-print cmark-sxml)
    (print cmark-html)
    (assert (equal? lowdown-html cmark-html))))
    (test lowdown-html cmark-html)))

;; Run list of tests
(test-group "lowdown comparisons"
	    (for-each
	     compare-cmark-to-lowdown
	     md-files))

;; TODO: This single test mechanism could be cleaned up
(define (single-test expected filename)
  (let* ([s (file->string filename)]
	 [actual (cmark-string->sxml s)])
	 [actual (cmark->sxml s)])
    (pretty-print filename)
    (print "expected")
    (pretty-print expected)    


@@ 163,526 176,524 @@
    (assert
     (equal? expected actual))))

;; Single tests
;; Should be used sparingly

;; Lowdown's output didn't seem right
(single-test '((h1 ("This is an H1")))
	     "header-level1-hash-sign.md")

(single-test '((hr)) "horizontal-rule-3-stars.md")

(single-test '((h1 ("This is an H1")))
	     "header-level1-hash-sign-trailing-1-space.md")

(single-test
 '((ol ((li ((p ("list item 1"))))
	(li ((p ("list item 2"))))
        (li ((p ("list item 3")))))))
 "ordered-list-items.md")

(single-test
 '((hr))
 "horizontal-rule-3-dashes.md")

(single-test
 '((h3 ("This is an H3")))
 "header-level3-hash-sign-closed.md")

(single-test
 '((p ("This is a paragraph with 3 leading spaces.")))
 "paragraphs-3-leading-spaces.md")

(single-test
 '((ul ((li ((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph in a list."))))
	      (li ((p ("and yet another long long long long long long long long long long long long long long long long long long long long long long line.")))))))
 "unordered-list-unindented-content.md")

(single-test
 '((ul ((li ((p ("list item 1"))))
	(li ((p ("list item 2"))))
	(li ((p ("list item 3")))))))
 "unordered-list-items-asterisk.md")

(single-test
 '((p ("This is a paragraph with a trailing and leading space.")))
 "paragraph-trailing-leading-spaces.md")

(single-test
 '((h2 ("This is an H2")))
 "header-level2-hash-sign.md")

(single-test
 '((ul ((li ((p ("list item 1"))))
	(li ((p ("list item 2"))))
	      (li ((p ("list item 3")))))))
 "unordered-list-items-dashsign.md")

(single-test
 '((hr))
 "horizontal-rule-3-dashes-spaces.md")

(single-test
 '((h1 ("This is an H1")))
 "header-level1-hash-sign-closed.md")

(single-test
 '((h4 ("This is an H4")))
 "header-level4-hash-sign.md")

(single-test
 '((blockquote
    ((p ("A blockquote with a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long line."))))
   (blockquote
       ((p ("and a second very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long line.")))))
 "blockquote-line-2-paragraphs.md")

(single-test
 '((ul ((li ((p ("list item 1"))))
	(li ((p ("list item 2"))))
	      (li ((p ("list item 3")))))))
 "unordered-list-items-leading-2spaces.md")

(single-test
 '((blockquote
    ((p ("This is the first level of quoting."))
         (blockquote ((p ("This is nested blockquote.")))))))
 "blockquote-nested.md")

(single-test
 '((h6 ("This is an H6")))
 "header-level6-hash-sign-closed.md")

(single-test
 '((ul ((li ((p ("list item 1"))))
       (li ((p ("list item 2"))))
             (li ((p ("list item 3")))))))
 "unordered-list-items-leading-1space.md")

(single-test
 '((h5 ("This is an H5")))
 "header-level5-hash-sign-closed.md")

(single-test
 '((ul ((li ((p ("This is a list item"
		"\n"
		"with the content on"
		"\n"
		"multiline and indented."))))
       (li ((p ("And this another list item"
		"\n"
		               "with the same principle.")))))))
 "unordered-list-with-indented-content.md")

(single-test
 '((p ("This is a paragraph with 2 leading spaces.")))
 "paragraphs-2-leading-spaces.md")

(single-test
 '((h5 ("This is an H5")))
 "header-level5-hash-sign.md")

(single-test
 '((hr))
 "horizontal-rule-3-underscores.md")

(single-test
 '((p ("This is a paragraph with 1 leading space.")))
 "paragraphs-leading-space.md")

(single-test
 '((h4 ("This is an H4")))
 "header-level4-hash-sign-closed.md")

(single-test
 '((h3 ("This is an H3")))
 "header-level3-hash-sign.md")

(single-test
 '((h2 ("This is an H2")))
 "header-level2-hash-sign-closed.md")

(single-test
 '((h6 ("This is an H6")))
 "header-level6-hash-sign.md")

(single-test
 '((ul ((li ((p ("a")) (pre (code "  b\n")))))))
 "list-code-1-space.md")

(single-test
 '((ol ((li ((p ("list item 1"))))
	(li ((p ("list item 2"))))
	      (li ((p ("list item 3")))))))
 "ordered-list-items-random-number.md")

(single-test
 '((blockquote
   ((p ("This is the first level of quoting."))
    (blockquote
           ((p ("This is nested blockquote." "\n" "Back to the first level.")))))))
 "blockquote-nested-return-level1.md")

(single-test
 '((p ((a (@ (href "http://www.w3.org/")) ("World Wide Web Consortium")))))
 "link-idref-angle-bracket.md")

(single-test
 '((ul ((li ((p ("list item 1"))))
	(li ((p ("list item 2"))))
	      (li ((p ("list item 3")))))))
 "unordered-list-items-plussign.md")

(single-test
 '((ul ((li ((p ("list item 1"))))
	(li ((p ("list item 2"))))
	      (li ((p ("list item 3")))))))
 "unordered-list-items-leading-3spaces.md")

(single-test
 '((hr))
 "horizontal-rule-7-dashes.md")

(single-test
 '((ol ((li ((p ("1")) (ul ((li ((p ("inner par list")))))))) (li ((p ("2")))))))
 "ordered-list-inner-par-list.md")

(single-test
 '((p ((a (@ (href "http://www.w3.org/")) ("w3c")))))
 "link-idref-implicit.md")

(single-test
 '((p ((a (@ (href "http://www.w3.org/")) ("World Wide Web Consortium")))))
 "link-idref-implicit-spaces.md")

(single-test
 '((p ("This is *an asterisk which should stay as is.")))
 "asterisk-near-text.md")

(single-test
 '((pre (code "10 PRINT HELLO INFINITE\n20 GOTO 10\n")))
 "code-4-spaces.md")

(single-test
 '((p ("These lines all end with end of line (EOL) sequences."))
   (p ("Seriously, they really do."))
    (p ("If you don't believe me: HEX EDIT!")))
 "EOL-LF.md")

(single-test
 '((p ((img (@ (src ("http://www.w3.org/html/logo/img/mark-word-icon.png"))
	       (alt ("HTML5"))
	                    (title "HTML5 for everyone"))))))
 "img-idref-title.md")

(single-test
 '((p ("as" (strong ("te")) "risks")))
 "strong-middle-word.md")

(single-test
 '((p ((img (@ (src ("http://www.w3.org/html/logo/img/mark-word-icon.png"))
	       (alt ("HTML5")))))))
 "img-idref.md")

(single-test
 '((p ("We love " (code "<code> and &") " for everything")))
 "inline-code-escaping-entities.md")

(single-test
 '((p ("as" (em ("te")) "risks")))
 "em-middle-word.md")

(single-test
 '((p ("An ampersand & in the text flow is escaped as an html entity.")))
 "ampersand-text-flow.md")

(single-test
 '((p ("This is a paragraph" "\n" "on multiple lines" "\n" "with hard return.")))
 "paragraph-hard-return.md")

(single-test
 '((p ((em ("single asterisks")))))
 "em-star.md")

(single-test
 '((p ("This is a paragraph with 1 trailing tab.")))
 "paragraph-trailing-tab.md")

(single-test
 '((p ("These lines all end with end of line (EOL) sequences."))
   (p ("Seriously, they really do."))
   (p ("If you don't believe me: HEX EDIT!")))
 "EOL-CR.md")

(single-test
 '((blockquote ((h1 ("heading level 1")) (p ("paragraph")))))
 "blockquote-added-markup.md")

(single-test
 '((p ("1. ordered list escape")))
 "ordered-list-escaped.md")

(single-test
 '((p ((strong ("double asterisks")))))
 "strong-star.md")

(single-test
 '((p ((a (@ (href "http://www.w3.org/") (title "Discover W3C"))
	          ("World Wide Web Consortium")))))
 "link-idref-title-next-line.md")

(single-test
 '((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph on 1 line."))
   (p ("1 tab to separate them and a new long long long long long long long long long long long long long long long long paragraph on 1 line.")))
 "2-paragraphs-line-tab.md")

(single-test
 '((pre (code "10 PRINT < > &\n20 GOTO 10\n")))
 "code-4-spaces-escaping.md")

(single-test
 '((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph on 1 line."))
   (p ("A new long long long long long long long long long long long long long long long long paragraph on 1 line.")))
 "2-paragraphs-line.md")

(single-test
 '((p ("A first paragraph."))
   (p ("A second paragraph after 3 CR (carriage return).")))
 "2-paragraphs-line-returns.md")

(single-test
 '((h1 ("this is an h1 with two trailing spaces")) (p ("A new paragraph.")))
 "header-level1-hash-sign-trailing-2-spaces.md")

(single-test
 '((p ((img (@ (src ("http://www.w3.org/html/logo/img/mark-word-icon.png"))
	                    (alt ("HTML5")))))))
 "img.md")

(single-test
 '((p ("This is an automatic link "
       (a (@ (href "http://www.w3.org/")) ("http://www.w3.org/")))))
 "link-automatic.md")

(single-test
 '((blockquote
    ((p ("A blockquote" "\n" "on multiple lines" "\n" "like this."))
     (p ("But it has" "\n" "two paragraphs.")))))
 "blockquote-multiline-2-paragraphs.md")

(single-test
 '((pre (code "10 PRINT HELLO INFINITE\n20 GOTO 10\n")))
 "code-1-tab.md")

(single-test
 '((p ((a (@ (href "http://www.w3.org/") (title "Discover w3c"))
	  ("World Wide Web Consortium")))))
 "link-idref-title-single-quote.md")

(single-test
 '((ul ((li ((p ("This is a list item with two paragraphs. Lorem ipsum dolor"
		 "\n"
		 "sit amet, consectetuer adipiscing elit. Aliquam hendrerit"
		 "\n"
		 "mi posuere lectus."))
	     (p ("Vestibulum enim wisi, viverra nec, fringilla in, laoreet"
		 "\n"
		 "vitae, risus. Donec sit amet nisl. Aliquam semper ipsum"
		 "\n"
		 "sit amet velit."))))
	      (li ((p ("Suspendisse id sem consectetuer libero luctus adipiscing.")))))))
 "list-multiparagraphs.md")

(single-test
 '((blockquote
    ((p ("A blockquote" "\n" "on multiple lines" "\n" "like this.")))))
 "blockquote-multiline-1-space-begin.md")

(single-test
 '((p ((code "We love `code` for everything"))))
 "inline-code-with-visible-backtick.md")

(single-test
 '((p ("These lines all end with end of line (EOL) sequences."))
   (p ("Seriously, they really do."))
   (p ("If you don't believe me: HEX EDIT!")))
 "EOL-CR+LF.md")

(single-test
 '((h1 ("This is an H1")))
 "header-level1-equal-underlined.md")

(single-test
 '((p ((a (@ (href "http://www.w3.org/") (title "Discover w3c"))
	  ("World Wide Web Consortium")))))
 "link-idref-title.md")

(single-test
 '((blockquote
    ((p ("This is the first level of quoting."))
     (blockquote ((p ("This is nested blockquote."))))
     (p ("Back to the first level.")))))
 "blockquote-nested-multiplereturn-level1.md")

(single-test
 '((blockquote
    ((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph in a blockquote.")))))
 "blockquote-line.md")

(single-test
 '((p ("\\   backslash"
       "\n"
       "`   backtick"
       "\n"
       "*   asterisk"
       "\n"
       "_   underscore"
       "\n"
       "{}  curly braces"
       "\n"
       "[]  square brackets"
       "\n"
       "()  parentheses"
       "\n"
       "#   hash mark"
       "\n"
       "+   plus sign"
       "\n"
       "-   minus sign (hyphen)"
       "\n"
       ".   dot"
       "\n"
            "!   exclamation mark")))
 "backslash-escape.md")

(single-test
 '((ul ((li ((p ("a list containing a blockquote"))
	                (blockquote ((p ("this the blockquote in the list")))))))))
 "list-blockquote.md")

(single-test
 '((blockquote
   ((p ("A blockquote" "\n" "on multiple lines" "\n" "like this.")))))
 "blockquote-multiline-1-space-end.md")

(single-test
 '((p ((strong ("double underscores")))))
 "strong-underscore.md")

(single-test
 '((p ((code "We love `code` for everything"))))
 "inline-code.md")

(single-test
 '((p ("There is an "
       (a (@ (href "http://validator.w3.org/check?uri=http://www.w3.org/&verbose=1"))
	  ("ampersand"))
       " in the URI.")))
 "ampersand-uri.md")

(single-test
 '((ul ((li ((p ("This is a list item with two paragraphs. Lorem ipsum dolor"
		 "\n"
		 "sit amet, consectetuer adipiscing elit. Aliquam hendrerit"
		 "\n"
		 "mi posuere lectus."))
	     (p ("Vestibulum enim wisi, viverra nec, fringilla in, laoreet"
		 "\n"
		 "vitae, risus. Donec sit amet nisl. Aliquam semper ipsum"
		 "\n"
		 "sit amet velit."))))
	      (li ((p ("Suspendisse id sem consectetuer libero luctus adipiscing.")))))))
 "list-multiparagraphs-tab.md")

(single-test
 '((p ((em ("single underscores")))))
 "em-underscore.md")

(single-test
 '((ul ((li ((p ("list item in paragraph"))))
	(li ((p ("another list item in paragraph")))))))
 "unordered-list-paragraphs.md")

(single-test
 '((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph on 1 line."))
    (p ("A few spaces and a new long long long long long long long long long long long long long long long long paragraph on 1 line.")))
 "2-paragraphs-line-spaces.md")

(single-test
 '((blockquote ((p ("A blockquote" "\n" "on multiple lines" "\n" "like this")))))
 "blockquote-multiline.md")

(single-test
 '((ul ((li ((p ("a list containing a block of code"))
	     (pre (code "10 PRINT HELLO INFINITE\n20 GOTO 10\n")))))))
 "list-code.md")

(single-test
 '((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph on 1 line.")))
 "paragraph-line.md")

(single-test
 '((blockquote
    ((p ("This is the first level of quoting."))
     (blockquote ((p ("This is nested blockquote.")))))))
 "blockquote-nested-multiplereturn.md")

(single-test
 '((p ("This is * an asterisk which should stay as is.")))
 "asterisk.md")

(single-test
 '((p ("This is a paragraph with a trailing space.")))
 "paragraphs-trailing-spaces.md")

(single-test
 '((p ((a (@ (href "http://www.w3.org/")) ("W3C")))))
 "link-bracket-paranthesis.md")

(single-test
 '((p ("This is a first paragraph," "\n" "on multiple lines."))
    (p ("This is a second paragraph" "\n" "which has multiple lines too.")))
 "2-paragraphs-hard-return.md")

(single-test
 '((h2 ("This is an H2")))
 "header-level2-dash-underlined.md")

(single-test
 '((p ((a (@ (href "http://www.w3.org/") (title "Discover w3c"))
	          ("World Wide Web Consortium")))))
 "link-idref-title-paranthesis.md")

(single-test
 '((p ("This is a first paragraph," "\n" "on multiple lines."))
   (p ("This is a second paragraph."
       "\n"
       "There are spaces in between the two.")))
 "2-paragraphs-hard-return-spaces.md")

(single-test
 '((p ((a (@ (href "http://www.w3.org/") (title "Discover w3c")) ("W3C")))))
 "link-bracket-paranthesis-title.md")

(single-test
 '((p ((a (@ (href "http://www.w3.org/")) ("World Wide Web Consortium")))))
 "link-idref.md")

(single-test
 '((p ((img (@ (src ("http://www.w3.org/html/logo/img/mark-word-icon.png"))
	      (alt ("HTML5"))
	      (title "HTML5 logo for everyone"))))))
 "img-title.md")

(single-test
 '((p ("A first sentence" (br) "and a line break.")))
 "line-break-2-spaces.md")
;; Normally a test is comparing cmark output to lowdown
;; However, lowdown messes up in a number of places and thus
;; we need a mechanism like single test

(test-group "non lowdown comparisons"
	    (single-test '((h1 ("This is an H1")))
			 "header-level1-hash-sign.md")

	    (single-test '((hr)) "horizontal-rule-3-stars.md")

	    (single-test '((h1 ("This is an H1")))
			 "header-level1-hash-sign-trailing-1-space.md")

	    (single-test
	     '((ol ((li ((p ("list item 1"))))
		    (li ((p ("list item 2"))))
		    (li ((p ("list item 3")))))))
	     "ordered-list-items.md")

	    (single-test
	     '((hr))
	     "horizontal-rule-3-dashes.md")

	    (single-test
	     '((h3 ("This is an H3")))
	     "header-level3-hash-sign-closed.md")

	    (single-test
	     '((p ("This is a paragraph with 3 leading spaces.")))
	     "paragraphs-3-leading-spaces.md")

	    (single-test
	     '((ul ((li ((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph in a list."))))
		    (li ((p ("and yet another long long long long long long long long long long long long long long long long long long long long long long line.")))))))
	     "unordered-list-unindented-content.md")

	    (single-test
	     '((ul ((li ((p ("list item 1"))))
		    (li ((p ("list item 2"))))
		    (li ((p ("list item 3")))))))
	     "unordered-list-items-asterisk.md")

	    (single-test
	     '((p ("This is a paragraph with a trailing and leading space.")))
	     "paragraph-trailing-leading-spaces.md")

	    (single-test
	     '((h2 ("This is an H2")))
	     "header-level2-hash-sign.md")

	    (single-test
	     '((ul ((li ((p ("list item 1"))))
		    (li ((p ("list item 2"))))
		    (li ((p ("list item 3")))))))
	     "unordered-list-items-dashsign.md")

	    (single-test
	     '((hr))
	     "horizontal-rule-3-dashes-spaces.md")

	    (single-test
	     '((h1 ("This is an H1")))
	     "header-level1-hash-sign-closed.md")

	    (single-test
	     '((h4 ("This is an H4")))
	     "header-level4-hash-sign.md")

	    (single-test
	     '((blockquote
		((p ("A blockquote with a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long line."))))
	       (blockquote
		((p ("and a second very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long line.")))))
	     "blockquote-line-2-paragraphs.md")

	    (single-test
	     '((ul ((li ((p ("list item 1"))))
		    (li ((p ("list item 2"))))
		    (li ((p ("list item 3")))))))
	     "unordered-list-items-leading-2spaces.md")

	    (single-test
	     '((blockquote
		((p ("This is the first level of quoting."))
		 (blockquote ((p ("This is nested blockquote.")))))))
	     "blockquote-nested.md")

	    (single-test
	     '((h6 ("This is an H6")))
	     "header-level6-hash-sign-closed.md")

	    (single-test
	     '((ul ((li ((p ("list item 1"))))
		    (li ((p ("list item 2"))))
		    (li ((p ("list item 3")))))))
	     "unordered-list-items-leading-1space.md")

	    (single-test
	     '((h5 ("This is an H5")))
	     "header-level5-hash-sign-closed.md")

	    (single-test
	     '((ul ((li ((p ("This is a list item"
			     "\n"
			     "with the content on"
			     "\n"
			     "multiline and indented."))))
		    (li ((p ("And this another list item"
			     "\n"
		             "with the same principle.")))))))
	     "unordered-list-with-indented-content.md")

	    (single-test
	     '((p ("This is a paragraph with 2 leading spaces.")))
	     "paragraphs-2-leading-spaces.md")

	    (single-test
	     '((h5 ("This is an H5")))
	     "header-level5-hash-sign.md")

	    (single-test
	     '((hr))
	     "horizontal-rule-3-underscores.md")

	    (single-test
	     '((p ("This is a paragraph with 1 leading space.")))
	     "paragraphs-leading-space.md")

	    (single-test
	     '((h4 ("This is an H4")))
	     "header-level4-hash-sign-closed.md")

	    (single-test
	     '((h3 ("This is an H3")))
	     "header-level3-hash-sign.md")

	    (single-test
	     '((h2 ("This is an H2")))
	     "header-level2-hash-sign-closed.md")

	    (single-test
	     '((h6 ("This is an H6")))
	     "header-level6-hash-sign.md")

	    (single-test
	     '((ul ((li ((p ("a")) (pre (code "  b\n")))))))
	     "list-code-1-space.md")

	    (single-test
	     '((ol ((li ((p ("list item 1"))))
		    (li ((p ("list item 2"))))
		    (li ((p ("list item 3")))))))
	     "ordered-list-items-random-number.md")

	    (single-test
	     '((blockquote
		((p ("This is the first level of quoting."))
		 (blockquote
		  ((p ("This is nested blockquote." "\n" "Back to the first level.")))))))
	     "blockquote-nested-return-level1.md")

	    (single-test
	     '((p ((a (@ (href "http://www.w3.org/")) ("World Wide Web Consortium")))))
	     "link-idref-angle-bracket.md")

	    (single-test
	     '((ul ((li ((p ("list item 1"))))
		    (li ((p ("list item 2"))))
		    (li ((p ("list item 3")))))))
	     "unordered-list-items-plussign.md")

	    (single-test
	     '((ul ((li ((p ("list item 1"))))
		    (li ((p ("list item 2"))))
		    (li ((p ("list item 3")))))))
	     "unordered-list-items-leading-3spaces.md")

	    (single-test
	     '((hr))
	     "horizontal-rule-7-dashes.md")

	    (single-test
	     '((ol ((li ((p ("1")) (ul ((li ((p ("inner par list")))))))) (li ((p ("2")))))))
	     "ordered-list-inner-par-list.md")

	    (single-test
	     '((p ((a (@ (href "http://www.w3.org/")) ("w3c")))))
	     "link-idref-implicit.md")

	    (single-test
	     '((p ((a (@ (href "http://www.w3.org/")) ("World Wide Web Consortium")))))
	     "link-idref-implicit-spaces.md")

	    (single-test
	     '((p ("This is *an asterisk which should stay as is.")))
	     "asterisk-near-text.md")

	    (single-test
	     '((pre (code "10 PRINT HELLO INFINITE\n20 GOTO 10\n")))
	     "code-4-spaces.md")

	    (single-test
	     '((p ("These lines all end with end of line (EOL) sequences."))
	       (p ("Seriously, they really do."))
	       (p ("If you don't believe me: HEX EDIT!")))
	     "EOL-LF.md")

	    (single-test
	     '((p ((img (@ (src ("http://www.w3.org/html/logo/img/mark-word-icon.png"))
			   (alt ("HTML5"))
	                   (title "HTML5 for everyone"))))))
	     "img-idref-title.md")

	    (single-test
	     '((p ("as" (strong ("te")) "risks")))
	     "strong-middle-word.md")

	    (single-test
	     '((p ((img (@ (src ("http://www.w3.org/html/logo/img/mark-word-icon.png"))
			   (alt ("HTML5")))))))
	     "img-idref.md")

	    (single-test
	     '((p ("We love " (code "<code> and &") " for everything")))
	     "inline-code-escaping-entities.md")

	    (single-test
	     '((p ("as" (em ("te")) "risks")))
	     "em-middle-word.md")

	    (single-test
	     '((p ("An ampersand & in the text flow is escaped as an html entity.")))
	     "ampersand-text-flow.md")

	    (single-test
	     '((p ("This is a paragraph" "\n" "on multiple lines" "\n" "with hard return.")))
	     "paragraph-hard-return.md")

	    (single-test
	     '((p ((em ("single asterisks")))))
	     "em-star.md")

	    (single-test
	     '((p ("This is a paragraph with 1 trailing tab.")))
	     "paragraph-trailing-tab.md")

	    (single-test
	     '((p ("These lines all end with end of line (EOL) sequences."))
	       (p ("Seriously, they really do."))
	       (p ("If you don't believe me: HEX EDIT!")))
	     "EOL-CR.md")

	    (single-test
	     '((blockquote ((h1 ("heading level 1")) (p ("paragraph")))))
	     "blockquote-added-markup.md")

	    (single-test
	     '((p ("1. ordered list escape")))
	     "ordered-list-escaped.md")

	    (single-test
	     '((p ((strong ("double asterisks")))))
	     "strong-star.md")

	    (single-test
	     '((p ((a (@ (href "http://www.w3.org/") (title "Discover W3C"))
	              ("World Wide Web Consortium")))))
	     "link-idref-title-next-line.md")

	    (single-test
	     '((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph on 1 line."))
	       (p ("1 tab to separate them and a new long long long long long long long long long long long long long long long long paragraph on 1 line.")))
	     "2-paragraphs-line-tab.md")

	    (single-test
	     '((pre (code "10 PRINT < > &\n20 GOTO 10\n")))
	     "code-4-spaces-escaping.md")

	    (single-test
	     '((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph on 1 line."))
	       (p ("A new long long long long long long long long long long long long long long long long paragraph on 1 line.")))
	     "2-paragraphs-line.md")

	    (single-test
	     '((p ("A first paragraph."))
	       (p ("A second paragraph after 3 CR (carriage return).")))
	     "2-paragraphs-line-returns.md")

	    (single-test
	     '((h1 ("this is an h1 with two trailing spaces")) (p ("A new paragraph.")))
	     "header-level1-hash-sign-trailing-2-spaces.md")

	    (single-test
	     '((p ((img (@ (src ("http://www.w3.org/html/logo/img/mark-word-icon.png"))
	                   (alt ("HTML5")))))))
	     "img.md")

	    (single-test
	     '((p ("This is an automatic link "
		   (a (@ (href "http://www.w3.org/")) ("http://www.w3.org/")))))
	     "link-automatic.md")

	    (single-test
	     '((blockquote
		((p ("A blockquote" "\n" "on multiple lines" "\n" "like this."))
		 (p ("But it has" "\n" "two paragraphs.")))))
	     "blockquote-multiline-2-paragraphs.md")

	    (single-test
	     '((pre (code "10 PRINT HELLO INFINITE\n20 GOTO 10\n")))
	     "code-1-tab.md")

	    (single-test
	     '((p ((a (@ (href "http://www.w3.org/") (title "Discover w3c"))
		      ("World Wide Web Consortium")))))
	     "link-idref-title-single-quote.md")

	    (single-test
	     '((ul ((li ((p ("This is a list item with two paragraphs. Lorem ipsum dolor"
			     "\n"
			     "sit amet, consectetuer adipiscing elit. Aliquam hendrerit"
			     "\n"
			     "mi posuere lectus."))
			 (p ("Vestibulum enim wisi, viverra nec, fringilla in, laoreet"
			     "\n"
			     "vitae, risus. Donec sit amet nisl. Aliquam semper ipsum"
			     "\n"
			     "sit amet velit."))))
		    (li ((p ("Suspendisse id sem consectetuer libero luctus adipiscing.")))))))
	     "list-multiparagraphs.md")

	    (single-test
	     '((blockquote
		((p ("A blockquote" "\n" "on multiple lines" "\n" "like this.")))))
	     "blockquote-multiline-1-space-begin.md")

	    (single-test
	     '((p ((code "We love `code` for everything"))))
	     "inline-code-with-visible-backtick.md")

	    (single-test
	     '((p ("These lines all end with end of line (EOL) sequences."))
	       (p ("Seriously, they really do."))
	       (p ("If you don't believe me: HEX EDIT!")))
	     "EOL-CR+LF.md")

	    (single-test
	     '((h1 ("This is an H1")))
	     "header-level1-equal-underlined.md")

	    (single-test
	     '((p ((a (@ (href "http://www.w3.org/") (title "Discover w3c"))
		      ("World Wide Web Consortium")))))
	     "link-idref-title.md")

	    (single-test
	     '((blockquote
		((p ("This is the first level of quoting."))
		 (blockquote ((p ("This is nested blockquote."))))
		 (p ("Back to the first level.")))))
	     "blockquote-nested-multiplereturn-level1.md")

	    (single-test
	     '((blockquote
		((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph in a blockquote.")))))
	     "blockquote-line.md")

	    (single-test
	     '((p ("\\   backslash"
		   "\n"
		   "`   backtick"
		   "\n"
		   "*   asterisk"
		   "\n"
		   "_   underscore"
		   "\n"
		   "{}  curly braces"
		   "\n"
		   "[]  square brackets"
		   "\n"
		   "()  parentheses"
		   "\n"
		   "#   hash mark"
		   "\n"
		   "+   plus sign"
		   "\n"
		   "-   minus sign (hyphen)"
		   "\n"
		   ".   dot"
		   "\n"
		   "!   exclamation mark")))
	     "backslash-escape.md")

	    (single-test
	     '((ul ((li ((p ("a list containing a blockquote"))
	                 (blockquote ((p ("this the blockquote in the list")))))))))
	     "list-blockquote.md")

	    (single-test
	     '((blockquote
		((p ("A blockquote" "\n" "on multiple lines" "\n" "like this.")))))
	     "blockquote-multiline-1-space-end.md")

	    (single-test
	     '((p ((strong ("double underscores")))))
	     "strong-underscore.md")

	    (single-test
	     '((p ((code "We love `code` for everything"))))
	     "inline-code.md")

	    (single-test
	     '((p ("There is an "
		   (a (@ (href "http://validator.w3.org/check?uri=http://www.w3.org/&verbose=1"))
		      ("ampersand"))
		   " in the URI.")))
	     "ampersand-uri.md")

	    (single-test
	     '((ul ((li ((p ("This is a list item with two paragraphs. Lorem ipsum dolor"
			     "\n"
			     "sit amet, consectetuer adipiscing elit. Aliquam hendrerit"
			     "\n"
			     "mi posuere lectus."))
			 (p ("Vestibulum enim wisi, viverra nec, fringilla in, laoreet"
			     "\n"
			     "vitae, risus. Donec sit amet nisl. Aliquam semper ipsum"
			     "\n"
			     "sit amet velit."))))
		    (li ((p ("Suspendisse id sem consectetuer libero luctus adipiscing.")))))))
	     "list-multiparagraphs-tab.md")

	    (single-test
	     '((p ((em ("single underscores")))))
	     "em-underscore.md")

	    (single-test
	     '((ul ((li ((p ("list item in paragraph"))))
		    (li ((p ("another list item in paragraph")))))))
	     "unordered-list-paragraphs.md")

	    (single-test
	     '((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph on 1 line."))
	       (p ("A few spaces and a new long long long long long long long long long long long long long long long long paragraph on 1 line.")))
	     "2-paragraphs-line-spaces.md")

	    (single-test
	     '((blockquote ((p ("A blockquote" "\n" "on multiple lines" "\n" "like this")))))
	     "blockquote-multiline.md")

	    (single-test
	     '((ul ((li ((p ("a list containing a block of code"))
			 (pre (code "10 PRINT HELLO INFINITE\n20 GOTO 10\n")))))))
	     "list-code.md")

	    (single-test
	     '((p ("This a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long paragraph on 1 line.")))
	     "paragraph-line.md")

	    (single-test
	     '((blockquote
		((p ("This is the first level of quoting."))
		 (blockquote ((p ("This is nested blockquote.")))))))
	     "blockquote-nested-multiplereturn.md")

	    (single-test
	     '((p ("This is * an asterisk which should stay as is.")))
	     "asterisk.md")

	    (single-test
	     '((p ("This is a paragraph with a trailing space.")))
	     "paragraphs-trailing-spaces.md")

	    (single-test
	     '((p ((a (@ (href "http://www.w3.org/")) ("W3C")))))
	     "link-bracket-paranthesis.md")

	    (single-test
	     '((p ("This is a first paragraph," "\n" "on multiple lines."))
	       (p ("This is a second paragraph" "\n" "which has multiple lines too.")))
	     "2-paragraphs-hard-return.md")

	    (single-test
	     '((h2 ("This is an H2")))
	     "header-level2-dash-underlined.md")

	    (single-test
	     '((p ((a (@ (href "http://www.w3.org/") (title "Discover w3c"))
	              ("World Wide Web Consortium")))))
	     "link-idref-title-paranthesis.md")

	    (single-test
	     '((p ("This is a first paragraph," "\n" "on multiple lines."))
	       (p ("This is a second paragraph."
		   "\n"
		   "There are spaces in between the two.")))
	     "2-paragraphs-hard-return-spaces.md")

	    (single-test
	     '((p ((a (@ (href "http://www.w3.org/") (title "Discover w3c")) ("W3C")))))
	     "link-bracket-paranthesis-title.md")

	    (single-test
	     '((p ((a (@ (href "http://www.w3.org/")) ("World Wide Web Consortium")))))
	     "link-idref.md")

	    (single-test
	     '((p ((img (@ (src ("http://www.w3.org/html/logo/img/mark-word-icon.png"))
			   (alt ("HTML5"))
			   (title "HTML5 logo for everyone"))))))
	     "img-title.md")

	    (single-test
	     '((p ("A first sentence" (br) "and a line break.")))
	     "line-break-2-spaces.md"))

;; Cmark doesn't tolerate the space here
;;(single-test '((p (a (@ (href "http://www.w3.org/")) "[World Wide Web Consortium] ")))
;;	     "link-idref-space.md")

;; Run list of tests
(for-each
 compare-cmark-to-lowdown
 md-files)
(test-exit)