Pretty much everything except tables done.

This commit is contained in:
Simon Brooke 2019-04-30 16:01:55 +01:00
parent 7f50863d83
commit 80f4857d73
4 changed files with 119 additions and 7 deletions

View file

@ -103,3 +103,85 @@
markdown-dispatcher)]
(is (= expected actual)))))
(deftest body-test
(testing "A complete document body"
(let [expected "\n# This is the top level header\n\n## Table of contents\n\n\n1. [Paragraph One](paragraph-1)\n2. [Paragraph Two](paragraph-2)\n\n\n## Paragraph-1\n\nThis is the first paragraph. It is *very* dull.\n\n## Paragraph-2\n\nThis is the second paragraph. It is no more interesting.\n"
actual (process
{:tag :body
:content
[{:tag :h1
:content ["This is the top level header"]}
{:tag :h2
:content ["Table of contents"]}
{:tag :ol
:content
[{:tag :li
:content
[{:tag :a
:attrs {:href "paragraph-1"}
:content ["Paragraph One"]}]}
{:tag :li
:content
[{:tag :a
:attrs {:href "paragraph-2"}
:content ["Paragraph Two"]}]}]}
{:tag :h2
:content ["Paragraph-1"]}
{:tag :p
:content ["This is the first paragraph. It is "
{:tag :em
:content ["very"]}
" dull."]}
{:tag :h2
:content ["Paragraph-2"]}
{:tag :p
:content ["This is the second paragraph. It is no more interesting."]}]}
markdown-dispatcher)]
(println actual)
(is (= expected actual)))))
(deftest html-test
(testing "a complete sample document"
(let [expected "\n# This is the top level header\n\n## Table of contents\n\n\n1. [Paragraph One](paragraph-1)\n2. [Paragraph Two](paragraph-2)\n\n\n## Paragraph-1\n\nThis is the first paragraph. It is *very* dull.\n\n## Paragraph-2\n\nThis is the second paragraph. It is no more interesting.\n"
actual (process
{:tag :html
:content
[{:tag :head
:content
[{:tag :title
:content ["This is the title"]}]}
{:tag :body
:content
[{:tag :h1
:content ["This is the top level header"]}
{:tag :h2
:content ["Table of contents"]}
{:tag :ol
:content
[{:tag :li
:content
[{:tag :a
:attrs {:href "paragraph-1"}
:content ["Paragraph One"]}]}
{:tag :li
:content
[{:tag :a
:attrs {:href "paragraph-2"}
:content ["Paragraph Two"]}]}]}
{:tag :h2
:content ["Paragraph-1"]}
{:tag :p
:content ["This is the first paragraph. It is "
{:tag :em
:content ["very"]}
" dull."]}
{:tag :h2
:content ["Paragraph-2"]}
{:tag :p
:content ["This is the second paragraph. It is no more interesting."]}]}]}
markdown-dispatcher)]
(is (= expected actual)))))