From 5fe96c837f7e9eb7967fad995840cd3621c98f2a Mon Sep 17 00:00:00 2001 From: a Date: Wed, 7 Jun 2023 10:36:01 -0400 Subject: [PATCH] Fixed issue where parentheses in links caused links to not work --- Makefile | 8 +++++++- blog/blogpost1.md4tj | 3 ++- blogpost1.html | 18 ++++++++++++++++++ blogpost2.html | 16 ++++++++++++++++ md4tj-blog.el | 3 ++- md4tj.el | 8 +++----- test_blog.html | 2 ++ test_blog.md4tj | 3 ++- test_file.html | 10 +++------- teximg/05e525335903ae89ce2a72ebe2582879.png | Bin 0 -> 946 bytes 10 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 blogpost1.html create mode 100644 blogpost2.html create mode 100644 teximg/05e525335903ae89ce2a72ebe2582879.png diff --git a/Makefile b/Makefile index 7617bcf..95ab667 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,8 @@ -all: +all: test_file test_blog + +test_file: emacs --no-site-file --batch -l ./md4tj.el --eval "(md4tj-parse \"test_file.md4tj\" \"test_file.html\")" +test_blog: + emacs --no-site-file --batch -l ./md4tj.el --eval "(md4tj-parse \"test_blog.md4tj\" \"test_blog.html\")" + emacs --no-site-file --batch -l ./md4tj.el --eval "(md4tj-parse \"./blog/blogpost1.md4tj\" \"blogpost1.html\")" + emacs --no-site-file --batch -l ./md4tj.el --eval "(md4tj-parse \"./blog/blogpost2.md4tj\" \"blogpost2.html\")" diff --git a/blog/blogpost1.md4tj b/blog/blogpost1.md4tj index cf8f81e..09677f2 100644 --- a/blog/blogpost1.md4tj +++ b/blog/blogpost1.md4tj @@ -3,4 +3,5 @@ @@BLOGPOSTTITLE Blog Post 1 @@BLOGPOSTDATE 1677804254 # Blog post 1 -blog text 1! \ No newline at end of file +blog text 1! +[Link to example.com!](https://www.example.com ()) \ No newline at end of file diff --git a/blogpost1.html b/blogpost1.html new file mode 100644 index 0000000..c6ed741 --- /dev/null +++ b/blogpost1.html @@ -0,0 +1,18 @@ + + + + + +Blog post 1 + + + +
+ +

Blog post 1

+ +

blog text 1!

+ +

[Link to example.com!](https://www.example.com ())

+ + \ No newline at end of file diff --git a/blogpost2.html b/blogpost2.html new file mode 100644 index 0000000..1fc0bc8 --- /dev/null +++ b/blogpost2.html @@ -0,0 +1,16 @@ + + + + + +Blog post 2 + + + +
+ +

Blog post 2

+ +

blog text 2 text!

+ + \ No newline at end of file diff --git a/md4tj-blog.el b/md4tj-blog.el index 149eda6..2c9e156 100644 --- a/md4tj-blog.el +++ b/md4tj-blog.el @@ -7,7 +7,8 @@ (require 'cl-lib) ;; (load "./md4tj-util.el") -(load-file (expand-file-name "~/.emacs.d/elpa/dash-20220608.1931/dash.el")) +;; Remember to add (setq flycheck-emacs-lisp-load-path 'inherit) to .emacs for this to work with flycheck +(load "~/.emacs.d/elpa/dash-20230415.2324/dash.el") ;; NOT needed anymore ;; Presence of blog indicated by @@BLOGINSERT line diff --git a/md4tj.el b/md4tj.el index 91bc67a..dd28e43 100644 --- a/md4tj.el +++ b/md4tj.el @@ -6,11 +6,9 @@ (require 'cl-lib) -;; (load-file "./md4tj-util.el") -;; (load-file "./md4tj-blog.el") +(load-file "./md4tj-util.el") +(load-file "./md4tj-blog.el") (require 'subr-x) -;; Crappy hack, figure out the "emacs" way of loading dash - (defun md4tj-begin-tag (tag &optional attrs) "Return beginning html tag for TAG with optional ATTRS." @@ -47,7 +45,7 @@ "\\1" ;; Then links (replace-regexp-in-string - "\\[\\([^\\[]*\\)](\\([^\\[(]*\\))" + "\\[\\([^\\[]*\\)](\\([^\\[]*\\))" (concat (md4tj-begin-tag "a" (list '("href" "\\2"))) "\\1" (md4tj-end-tag "a")) ;; Then images (replace-regexp-in-string diff --git a/test_blog.html b/test_blog.html index 10c8e93..3e90c1d 100644 --- a/test_blog.html +++ b/test_blog.html @@ -35,5 +35,7 @@

Non blog text!!

+ +

link to example.com

\ No newline at end of file diff --git a/test_blog.md4tj b/test_blog.md4tj index f21e80c..212dc4c 100644 --- a/test_blog.md4tj +++ b/test_blog.md4tj @@ -16,4 +16,5 @@ @@BLOGBASEDIR ./blog/ @@BLOGINSERT -### Non blog text!! \ No newline at end of file +### Non blog text!! +[link to example.com](https://www.example.com) \ No newline at end of file diff --git a/test_file.html b/test_file.html index a0965f7..b9a6cd9 100644 --- a/test_file.html +++ b/test_file.html @@ -12,10 +12,6 @@ - - - -

Hello world!

Hello world!

@@ -69,16 +65,16 @@ int main() { -
+

Dungeon Crawl Stone Soup - My favorite FOSS roguelike (Yes, I know the greatest roguelike of all time is NetHack, I don't care).

e^{i \pi} + 1 = 0 -
+

This is a div that has monospace text.

-

Last updated: Wed Jan 4 15:08:50 2023

+

Last updated: Wed Jun 7 10:10:53 2023

\ No newline at end of file diff --git a/teximg/05e525335903ae89ce2a72ebe2582879.png b/teximg/05e525335903ae89ce2a72ebe2582879.png new file mode 100644 index 0000000000000000000000000000000000000000..41db122ce648889c7e72ad01a5aefbb036bc7601 GIT binary patch literal 946 zcmV;j15NyiP)QtDA|fIX5D-K}M3|VEs;a8)?(WRY%-r1EGBPrDc6MfFW{8N0!7X6N00009 za7bBm000ie000ie0hKEb8vpJLt2APL)qJE@uR2x(WW*H^i3ao{%hmh z#)hXatn#8l(O5sP)Z5E4kZ+9-Ec4GFm0izBD*BSk?*{5K|E~`zJOlP0OZ_VLB{a z9nlw8Sou7PA7-(F1Sg44VzV?V2v;N`xi^+yU*vjuCv^cxQ4I+zLN_ipE7960GL!3Z zt`0OfFv_R5fi&-0|CAde^zK}HaBMz_%~~T4fQ8052FkOh zHGu~UJFNA80MyH@cty%mKY8T6ZEmy5<3N#l9E}CH2LwwgODVT5ZL8qbv82(8t2_nO z%0*+-?rT#@S#9j_%w}bwiKF%;n0P+h?paeXm-GIOT-E0~Q0F%}ni&;f-yoM|4+c{HCOCU|T^nX%U}Vc$_R(D^t=k=QKF zzI!L2I|rdNQOZ)Ug`ed#HBHYdO`;O*eF7;<@f>AxLP%O4t|Wgl?RVGf&SA+}ZSAe^ za)!5U)tW%y>Ebt)#^pC~>W2C1Cue>zHlb@c8o(TSTY9j!!Xk-zpys