Discussion:
Case sensitive tags with cl-who
rrl
2010-08-16 22:19:57 UTC
Permalink
Hi,

I know that by setting *DOWNCASE-TOKENS-P* to NIL, keyword symbols
representing a tag or attribute name will not be automatically
converted to lowercase.

The problem is most of the time, the default behavior is just fine.
But I want to generate case-sensitive XML in just one function. Which
is annoying since I need to rewrite all the other tags in the form
:|html| if I set *DOWNCASE-TOKENS-P* to NIL.

The attached patch just adds an additional keyword argument
:downcase-tokens-p to WITH-HTML-OUPUT, WITH-HTML-OUTPUT-TO-STRING and
SHOW-HTML-EXPANSION whose default value is the same as
*DOWNCASE-TOKENS-P*, but whose scope is local to the generated code.

Best regards,
rrl
2010-09-03 21:30:11 UTC
Permalink
Thinking about it again, I think this patch is a bad idea. It's
possible to have the desired effect without touching the code base
with something like:

(defmacro with-xml ((&key (prologue "<?xml version=\"1.0\"?>")) &body body)
"Write the xml strings to the standard output."
`(with-output-to-string (*standard-output*)
,(let (*downcase-tokens-p*)
(macroexpand
`(with-html-output (*standard-output* nil :prologue ,prologue)
,@body)))))
Edi Weitz
2010-09-05 13:01:56 UTC
Permalink
Thinking about it again, I think this patch is a bad idea.  It's
possible to have the desired effect without touching the code base
That's good to hear... :)

Sorry for not replying earlier, I was busy with other things.

ISTR that you'll also find similar ideas if you search the archive of
this mailing list. I have to admit that I haven't cared much about
CL-WHO recently, even less then of my other open source libs. Some
stuff has happened in the BKNR repository, but that too was more than
a year ago.

Edi.

Loading...