[cl-markdown-devel] Bug with multiple instances of the same extension on the same line.
Andy Peterson
andy.arvid at gmail.com
Wed Dec 5 04:01:46 UTC 2012
Gary,
When you have multiple instances of the same extension (with different
arguments) on the same line, each instance repeats the first instance. If
you trace the function call, each instance calls the function with the
arguments of the first call.
If you put in a line break between the extension instances, markdown works
correctly.
Below is some test code demonstrating the error
andy
(in-package :markdown)
(defextension (link-new :arguments ((text :required)
(href :required))
:insertp t)
(ecase phase
(:parse
;; no worries
)
(:render
(format nil "<a href=~s target=\"_blank\">~a</a>" href text))))
(defparameter *cliki*
"Cliki link here: {link-new \"cliki\" \"http://www.cliki.net\"}.")
(defparameter *google*
"Google link here: {link-new \"google\" \"http://www.google.com\"}.")
(defparameter *test-one-line*
(concatenate 'string
*cliki*
" "
*google*))
(defparameter *test-two-lines*
(concatenate 'string
*cliki*
(string #\Newline)
*google*))
(defun test-string (str)
(let ((*render-active-functions*
(append '(link-new) *render-active-functions*)))
(nth-value 1 (markdown str :stream nil))))
MARKDOWN> (trace link-new)
(LINK-NEW)
MARKDOWN> (test-string *test-one-line*)
0: (LINK-NEW :RENDER ("cliki" "http://www.cliki.net") NIL)
0: LINK-NEW returned
"<a href=\"http://www.cliki.net\" target=\"_blank\">cliki</a>"
0: (LINK-NEW :RENDER ("cliki" "http://www.cliki.net") NIL)
0: LINK-NEW returned
"<a href=\"http://www.cliki.net\" target=\"_blank\">cliki</a>"
"<p>Cliki link here: <a href=\"http://www.cliki.net\"
target=\"_blank\">cliki</a>. Google link here: <a href=\"
http://www.cliki.net\" target=\"_blank\">cliki</a>. </p>"
MARKDOWN> (test-string *test-two-lines*)
0: (LINK-NEW :RENDER ("cliki" "http://www.cliki.net") NIL)
0: LINK-NEW returned
"<a href=\"http://www.cliki.net\" target=\"_blank\">cliki</a>"
0: (LINK-NEW :RENDER ("google" "http://www.google.com") NIL)
0: LINK-NEW returned
"<a href=\"http://www.google.com\" target=\"_blank\">google</a>"
"<p>Cliki link here: <a href=\"http://www.cliki.net\"
target=\"_blank\">cliki</a>. Google link here: <a href=\"
http://www.google.com\" target=\"_blank\">google</a>. </p>"
MARKDOWN>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-markdown-devel/attachments/20121205/cc424607/attachment.html>
More information about the Cl-markdown-devel
mailing list