[cl-wiki-devel] promised patch file
Ian Clelland
clelland at gmail.com
Fri Sep 2 07:55:50 UTC 2005
Until the darcs repository is set up, I'm going to have to resort to
doing this :)
This patch, to 0.0.3, contains my removal of *wiki-url* from generated
links, and two new wikimarkup codes (the [[wikipage|description]]
form, and the [http://externalsite] form)
(Save this text to a file, then cd to the cl-wiki-0.0.3 directory, and run
patch -p0 < patchfilename
to update existing source files)
Regards,
Ian Clelland
<clelland at gmail.com>
--------------------------------------------------
File: wiki.lisp.patch:
--- /home/ian/cl-wiki-0.0.3/wiki.lisp 2005-09-02 00:46:25.000000000 -0700
+++ wiki.lisp 2005-08-31 15:54:21.000000000 -0700
@@ -33,7 +33,7 @@
(defun current-page ()
"Extracts the current page from the URL."
- (subseq (tbnl:script-name) (length *wiki-url*)))
+ (let ((url (tbnl:script-name))) (subseq url (+ 1 (position #\/ url
:from-end T)))))
;; From lemonodor's LSP
(defun contents-of-file (pathname)
@@ -56,7 +56,10 @@
(defparameter *simple-replace*
'(("\\x0d?\\x0a" . "<br>")
("'''(.*?)'''" . "<strong>\\1</strong>")
- ("''(.*?)''" . "<em>\\1</em>"))
+ ("''(.*?)''" . "<em>\\1</em>")
+ ("\\[\\[([^]\">|]*?)\\|([^]\">]*?)\\]\\]" . "<a href=\"\\1\">\\2</a>")
+ ("\\[\\[(.*?)\\]\\]" . "<a href=\"\\1\">\\1</a>")
+ ("\\[(http|ftp|mailto|gopher):([^\">].*?)\\]" . "<a
class=\"external \\1\" href=\"\\1:\\2\">\\1:\\2</a>"))
"List of conses. CAR is regexp and CDR replace-string for
CL-PPCRE:REGEX-REPLACE-ALL.")
@@ -68,9 +71,7 @@
(defun complex-translate (string)
"Translate the more complex wiki codes."
- (ppcre:regex-replace-all "\\[\\[(.*?)\\]\\]"
- string
- (format nil "<a href=\"~A\\1\">\\1</a>"
*wiki-url*)))
+ string)
;; Code from Edi Weitz's TBNL <http://weitz.de/tbnl/>
@@ -110,7 +111,7 @@
:env `(:edit ,edit
:base-url ,*wiki-url*
:page-list ,*wiki-page-list*
- :edit-url ,(format nil "~A~A?action=edit"
*wiki-url* page)
+ :edit-url ,(format nil "~A?action=edit" page)
:title ,page
:body ,body)))
@@ -121,7 +122,7 @@
(contents-of-file path)
(format nil "Describe ~A here." page)))
(body (with-html-output-to-string (s)
- (:form :action (format nil "~A~A" *wiki-url* page)
:method "POST"
+ (:form :action (format nil "~A" page) :method "POST"
(:fieldset
(:legend "Edit page")
(:input :type "hidden" :name "action" :value "save")
More information about the Cl-wiki-devel
mailing list