From f82ad725c151feab74e1d1ae0e5b49bebe5d2bb6 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Wed, 19 Feb 2020 16:18:58 +0000 Subject: [PATCH] Working,, but regression in Mermaid stylesheet --- resources/test/test_extension.md | 7 +++++++ resources/test/test_local_links.md | 6 ++++++ src/smeagol/formatting.clj | 1 - test/smeagol/test/formatting.clj | 19 +++++++++++++++++++ test/smeagol/test/local_links.clj | 9 +++++++-- 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 resources/test/test_extension.md create mode 100644 resources/test/test_local_links.md diff --git a/resources/test/test_extension.md b/resources/test/test_extension.md new file mode 100644 index 0000000..1f43160 --- /dev/null +++ b/resources/test/test_extension.md @@ -0,0 +1,7 @@ +# This is a test + +```test +the quick brown fox jumped over the lazy dog +``` + +This concludes the test. diff --git a/resources/test/test_local_links.md b/resources/test/test_local_links.md new file mode 100644 index 0000000..659f03a --- /dev/null +++ b/resources/test/test_local_links.md @@ -0,0 +1,6 @@ +# This is a test + +[[Local link]] +[Not a local link](http://nowhere.at.al) + +This concludes the test. diff --git a/src/smeagol/formatting.clj b/src/smeagol/formatting.clj index 3807cb0..3617514 100644 --- a/src/smeagol/formatting.clj +++ b/src/smeagol/formatting.clj @@ -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)] diff --git a/test/smeagol/test/formatting.clj b/test/smeagol/test/formatting.clj index 52e9817..18769cd 100644 --- a/test/smeagol/test/formatting.clj +++ b/test/smeagol/test/formatting.clj @@ -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])) @@ -22,3 +23,21 @@ :inclusion-3) expected ""] (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 + "

This is a test

" + "

" + "

This concludes the test

")] + (is (= expected actual)))) diff --git a/test/smeagol/test/local_links.clj b/test/smeagol/test/local_links.clj index 54d31e9..dc3682d 100644 --- a/test/smeagol/test/local_links.clj +++ b/test/smeagol/test/local_links.clj @@ -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])) @@ -10,5 +11,9 @@ (is (= (local-links "") "") "Empty string should pass through unchanged.") (is (= (local-links "[[froboz]]") "froboz") "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\nLocal link\n[Not a local link](http://nowhere.at.al)\n\nThis concludes the test."] + (is (= actual expected)))))