From: Frank Duncan Date: Mon, 10 Jan 2022 20:34:58 +0000 (-0600) Subject: Add codefence, underscore emphasis X-Git-Tag: 0.1~1 X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?a=commitdiff_plain;h=65394a399d32af71f028dc680df1b48af87c0215;p=honey Add codefence, underscore emphasis --- diff --git a/src/main/parse.lisp b/src/main/parse.lisp index 74745bc..61f37e8 100644 --- a/src/main/parse.lisp +++ b/src/main/parse.lisp @@ -49,8 +49,8 @@ DESCRIPTION: (append (list prev - (funcall function-to-call (subseq (cdr lines) 0 (or pos (length lines))))) - (parse-lines (nthcdr (1+ pos) (cdr lines)))))) + (funcall function-to-call (subseq (cdr lines) 0 (or pos (1- (length lines)))))) + (parse-lines (nthcdr (if pos (1+ pos) (length lines)) (cdr lines)))))) (t (cons prev (parse-lines (cdr lines) parsed-line)))))))) (defun parse-texts (line) @@ -163,7 +163,17 @@ DESCRIPTION: (defline-parser "### *(.*)" inline-h3) (defline-parser "## *(.*)" inline-h2) (defline-parser "# *(.*)" inline-h1) + +; Ignore codefence +(defline-parser "(```.*```.*)" default) + (defline-parser "```(.*)" codefence) + +; If we start with a space after the asterisk, we really do want a list +(defline-parser " *\\* (.*)" list-item) +; Ignore list-tiem +(defline-parser "(\\*\\*.*\\*\\*.*)" default) +(defline-parser "(\\*.*\\*.*)" default) (defline-parser " *\\* *(.*)" list-item) (defline-parser " *" emptiness) (defline-parser "(.*)" default) @@ -177,6 +187,11 @@ DESCRIPTION: (defun md-link (before text md-link after) (list before (a :href md-link (parse-texts text)) after)) +(defun inline-code (before during after) + (list before (code during) after)) + (definline-parser "(.*)\\[([^\\]]*)\\]\\(([^)]*)\\)(.*)" md-link) (definline-parser "(.*)\\*\\*(.*)\\*\\*(.*)" strength) (definline-parser "(.*)\\*(.*)\\*(.*)" emphasis) +(definline-parser "(.*)_(.*)_(.*)" emphasis) +(definline-parser "(.*)```(.*)```(.*)" inline-code)