Skip to content

Commit

Permalink
Working,, but regression in Mermaid stylesheet
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-brooke committed Feb 19, 2020
1 parent 03c63da commit f82ad72
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
7 changes: 7 additions & 0 deletions resources/test/test_extension.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This is a test

```test
the quick brown fox jumped over the lazy dog
```

This concludes the test.
6 changes: 6 additions & 0 deletions resources/test/test_local_links.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This is a test

[[Local link]]
[Not a local link](http://nowhere.at.al)

This concludes the test.
1 change: 0 additions & 1 deletion src/smeagol/formatting.clj
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
^String fragment
^String token
formatter]
(log/info "index:" index "(type result):" (type result) "(type fragments):" (type fragments) "fragment:" fragment "token:" token ":formatter" formatter)
(let
[inky (keyword (str "inclusion-" index))
fkey (keyword token)]
Expand Down
19 changes: 19 additions & 0 deletions test/smeagol/test/formatting.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns smeagol.test.formatting
(:require [clojure.test :refer :all]
[clojure.string :as cs]
[smeagol.formatting :refer :all]
[smeagol.extensions.test :refer :all]
[smeagol.local-links :refer :all]))
Expand All @@ -22,3 +23,21 @@
:inclusion-3)
expected "<!-- The test extension has run and this is its output -->"]
(is (= actual expected)))))

(deftest test-md->html
(let [actual (:content (md->html
{:source
(cs/join
"\n"
["# This is a test"
""
"```test"
"![Frost on a gate, Laurieston](content/uploads/g1.jpg)"
"```"
""
"This concludes the test"])} ))
expected (str
"<h1 id=\"this&#95;is&#95;a&#95;test\">This is a test</h1>"
"<p><!-- The test extension has run and this is its output --></p>"
"<p>This concludes the test</p>")]
(is (= expected actual))))
9 changes: 7 additions & 2 deletions test/smeagol/test/local_links.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns smeagol.test.local-links
(:require [clojure.test :refer :all]
[clojure.string :as cs]
[smeagol.local-links :refer [local-links no-text-error]]
[smeagol.extensions.test :refer :all]
[smeagol.local-links :refer :all]))
Expand All @@ -10,5 +11,9 @@
(is (= (local-links "") "") "Empty string should pass through unchanged.")
(is (= (local-links "[[froboz]]") "<a href='wiki?page=froboz'>froboz</a>") "Local link should be rewritten.")
(let [text (str "# This is a heading"
"[This is a foreign link](http://to.somewhere)")]
(is (= (local-links text) text) "Foreign links should be unchanged"))))
"[This is a foreign link](http://to.somewhere)")]
(is (= (local-links text) text) "Foreign links should be unchanged"))
(let [text (cs/trim (slurp "resources/test/test_local_links.md"))
actual (local-links text)
expected "# This is a test\n\n<a href='wiki?page=Local%20link'>Local link</a>\n[Not a local link](http://nowhere.at.al)\n\nThis concludes the test."]
(is (= actual expected)))))

0 comments on commit f82ad72

Please sign in to comment.