Merge pull request #1 from johanmynhardt/develop
Fix: java.lang.ClassCastException when source `obj` is (X)HTML.
This commit is contained in:
commit
7f2ccd2d29
|
@ -93,6 +93,4 @@
|
||||||
(if url (transform url dispatcher)
|
(if url (transform url dispatcher)
|
||||||
;; otherwise, if s is not a URL, consider it as an HTML fragment,
|
;; otherwise, if s is not a URL, consider it as an HTML fragment,
|
||||||
;; parse and process it
|
;; parse and process it
|
||||||
(process (tagsoup/parser (java.io.StringReader s)) dispatcher)
|
(process (tagsoup/parser (java.io.StringReader. s)) dispatcher))))
|
||||||
)))
|
|
||||||
|
|
||||||
|
|
10
test/html_to_md/transformer_test.clj
Normal file
10
test/html_to_md/transformer_test.clj
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
(ns html-to-md.transformer-test
|
||||||
|
(:require
|
||||||
|
[clojure.test :as t :refer [deftest is testing]]
|
||||||
|
[html-to-md.html-to-md :refer [markdown-dispatcher]]
|
||||||
|
[html-to-md.transformer :refer [transform]]))
|
||||||
|
|
||||||
|
(deftest transform-payload
|
||||||
|
(testing "String `obj` for: 3. A string representation of an (X)HTML fragment;"
|
||||||
|
(is (= '("\n# This is a header\n")
|
||||||
|
(transform "<h1>This is a header</h1>" markdown-dispatcher)))))
|
Loading…
Reference in a new issue