[Bese-devel] Re: rendering permalinks

Marco Baringer mb at bese.it
Thu Apr 20 11:21:32 UTC 2006


Evrim ULU <evrim at core.gen.tr> writes:

> Hi,
>
> Do we have something in yaclml to render permalinks? I'm not feeling
> comfortable with :href (format nil "user.ucw?id=~A" id) , maybe
> something like (<ucw:a :href (href :base "user.ucw" :id id)  ....would
> do better. Or am I missing another great treasure found in ucw? :)

not atm, but this would probably be a great addition:

(defun href (base &rest params)
  (with-output-to-string (href)
    (write-string base href)
    (when params
      (write-char #\? href)
      (loop
        for (key value . rest) on params by #'cddr
        do (arnesi:write-as-uri key href)
        do (write-char #\= href)
        do (arnesi:write-as-uri value href)
        when rest
          do (write-char #\& href)))))

which you'd use like so:

(<ucw:a :href (href "foo.ucw" :bar "42"))

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen




More information about the bese-devel mailing list