Fixed issue where parentheses in links caused links to not work
This commit is contained in:
parent
2712bcbb45
commit
5fe96c837f
8
Makefile
8
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\")"
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
@@BLOGPOSTTITLE Blog Post 1
|
||||
@@BLOGPOSTDATE 1677804254
|
||||
# Blog post 1
|
||||
blog text 1!
|
||||
blog text 1!
|
||||
[Link to example.com!](https://www.example.com ())
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
|
||||
<title>Blog post 1</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<br>
|
||||
|
||||
<h1>Blog post 1</h1>
|
||||
|
||||
<p>blog text 1!</p>
|
||||
|
||||
<p>[Link to example.com!](https://www.example.com ())</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
|
||||
<title>Blog post 2</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<br>
|
||||
|
||||
<h1>Blog post 2</h1>
|
||||
|
||||
<p>blog text 2 text!</p>
|
||||
</body>
|
||||
</html>
|
|
@ -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
|
||||
|
|
8
md4tj.el
8
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 @@
|
|||
"<mark>\\1</mark>"
|
||||
;; 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
|
||||
|
|
|
@ -35,5 +35,7 @@
|
|||
<br>
|
||||
|
||||
<h3>Non blog text!!</h3>
|
||||
|
||||
<p><a href="https://www.example.com">link to example.com</a></p>
|
||||
</body>
|
||||
</html>
|
|
@ -16,4 +16,5 @@
|
|||
@@BLOGBASEDIR ./blog/
|
||||
@@BLOGINSERT
|
||||
|
||||
### Non blog text!!
|
||||
### Non blog text!!
|
||||
[link to example.com](https://www.example.com)
|
|
@ -12,10 +12,6 @@
|
|||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1>Hello <code>world</code>!</h1>
|
||||
|
||||
<h2>Hello world!</h2>
|
||||
|
@ -69,16 +65,16 @@ int main() {
|
|||
</code>
|
||||
</pre>
|
||||
|
||||
<br/>
|
||||
<br>
|
||||
|
||||
<p><a href="https://crawl.develz.org">Dungeon Crawl Stone Soup</a> - My favorite FOSS roguelike (Yes, I know the greatest roguelike of all time is NetHack, I don't care).</p>
|
||||
<img class="teximg" src="./teximg/05e525335903ae89ce2a72ebe2582879.png" alt="e^{i \pi} + 1 = 0">
|
||||
|
||||
<br/>
|
||||
<br>
|
||||
<div class="monospace-text">
|
||||
|
||||
<p>This is a div that has monospace text.</p>
|
||||
</div>
|
||||
<p id="lastupdated">Last updated: Wed Jan 4 15:08:50 2023</p>
|
||||
<p id="lastupdated">Last updated: Wed Jun 7 10:10:53 2023</p>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
After Width: | Height: | Size: 946 B |
Loading…
Reference in New Issue