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>