summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsko Nomm <asko@bien.ee>2022-04-07 12:02:42 +0200
committerAsko Nomm <asko@bien.ee>2022-04-07 12:02:42 +0200
commitba7a4eaa4e22e9d2213d5911cc275b3a7f702376 (patch)
tree73c7b1e4e2d4edf785efbf841fd5666d6526c1c2
parent7da1fada8dd795543e12c6aa0371cc1149a42be6 (diff)
Add ability to create bold-italic text by using three consecutive asterisk or underscores (re #5).
-rw-r--r--src/clarktown/parsers/bold.clj2
-rw-r--r--src/clarktown/parsers/italic.clj2
-rw-r--r--test/clarktown/core_test.clj4
3 files changed, 4 insertions, 4 deletions
diff --git a/src/clarktown/parsers/bold.clj b/src/clarktown/parsers/bold.clj
index e672153..79579bf 100644
--- a/src/clarktown/parsers/bold.clj
+++ b/src/clarktown/parsers/bold.clj
@@ -7,7 +7,7 @@
"Renders all occurring bold text as bold."
[block _]
(loop [block block
- matches (-> (re-seq #"(\*{2}|\_{2})(.*?)(\*{2}|\_{2})" block)
+ matches (-> (re-seq #"(\*{2}|\_{2})[^\*|\_](.*?)[^\*|\_](\*{2}|\_{2})" block)
distinct)]
(if (empty? matches)
block
diff --git a/src/clarktown/parsers/italic.clj b/src/clarktown/parsers/italic.clj
index 5f63620..915a017 100644
--- a/src/clarktown/parsers/italic.clj
+++ b/src/clarktown/parsers/italic.clj
@@ -7,7 +7,7 @@
"Renders all occurring italic text as italic."
[block _]
(loop [block block
- matches (-> (re-seq #"(\*{1}|\_{1})(.*?)(\*{1}|\_{1})" block)
+ matches (-> (re-seq #"(\*{1,}?|\_{1,}?)(.*?)(\*{1,}?|\_{1,}?)" block)
distinct)]
(if (empty? matches)
block
diff --git a/test/clarktown/core_test.clj b/test/clarktown/core_test.clj
index 8a2ee58..c4b5ee1 100644
--- a/test/clarktown/core_test.clj
+++ b/test/clarktown/core_test.clj
@@ -6,5 +6,5 @@
(deftest overall-test
(testing "Overall"
- (is (= (slurp "./resources/test/core_result.html")
- (core/render (slurp "./resources/test/core.md")))))) \ No newline at end of file
+ (is (= (core/render (slurp "./resources/test/core.md"))
+ (slurp "./resources/test/core_result.html"))))) \ No newline at end of file