Discussion:
Case sensitivity idea
Ken Harris
2008-10-28 19:29:22 UTC
Permalink
Hi again,

I'm using cl-who for generating a lot of HTML and lowercase XML, and a
tiny bit of mixed-case XML. (I don't know who thought up mixed-case
XML schemas, but I swear it's not my fault. For that matter, neither
is the XML. :-)

To generate mixed-case XML, I should turn off *downcase-tokens-p*, and
then wrap every existing :foo like :|foo| in all my cl-who calls, just
to be able to generate a couple mixedCase XML attributes. This idea
doesn't thrill me. (Or I could change the readtable-case, but that'll
mean changing all my code to upper-case, and I'm not excited about
that, either.)

What if there was another mode (call it, say,
*downcase-tokens-unless-mixedcase-p*) for case handling, whose rule
was:
- "downcase tokens, *unless* the token's string representation is
mixed-case (in which case leave it alone)"
That way, I could say (:a :href "/foo") like normal, but also
(:|feGaussianBlur| :|stdDeviation| 2), and everything would work like
it looks and like I want.

I suppose it would be impossible to generate all-uppercase tags in
this mode, but (a) I don't think I've ever seen an XML schema that
required any all-caps tags, and (b) in *downcase-tokens-p* mode, there
are tags it's impossible to generate, so I'm thinking "any tag in any
mode" isn't a strict requirement.

Thoughts? I could whip up a patch, if somebody else thought this was
a decent approach...


- Ken
Leslie P. Polzer
2008-10-29 09:53:07 UTC
Permalink
Post by Ken Harris
I suppose it would be impossible to generate all-uppercase tags in
this mode, but (a) I don't think I've ever seen an XML schema that
required any all-caps tags, and (b) in *downcase-tokens-p* mode, there
are tags it's impossible to generate, so I'm thinking "any tag in any
mode" isn't a strict requirement.
(a) certainly doesn't hold. A popular format like XML is bound
to generate any type of abomination.
Post by Ken Harris
Thoughts? I could whip up a patch, if somebody else thought this was
a decent approach...
I like it, you only need to get Edi to apply it now ;)

Leslie
Abu Abdullah Al Jumaee
2008-11-03 04:56:46 UTC
Permalink
Sorry after i posted to the list i noticed that the last comment
regarding the code was pasted by mistake

the corrected (arghh .. copy and paste inconvenience between emacs
and firefox) code snippet should be:

(let ((result form1)) (when result (write-string (escape-string result) s)))

Regards,

Ala'a (cmo-0)
--
It does not matter how fast your code is, if it does not work!
Abu Abdullah Al Jumaee
2008-11-03 04:50:59 UTC
Permalink
Hi,

i was reading the documentation for cl-who library and i have a
question in the 'syntax and semantics', it said:

"The first form following either the tag's name itself or an attribute
value which is not a keyword determines the beginning of the tag's
content. **This and all the following forms are subject to the
transformation rules we're just describing**." (the stars are added by
me)

my question is: what are the rules which will be applied to the
content? if it is the previous rules regarding constants, tags and
attr/val then shouldn't the content be printed by princ at runtime?

other thing i noticed in the line:

"Forms that look like (esc form1 form*) will be substituted with (let
((result form1)) (when result (write-string (escape-string result
s)))). "

shouldn't the last code snippet be like this:

(let ((result form1)) (when result (write-string (escape-string result s))))

the last s should be shifted forward one parentheses

regards,

and thanks for the nice library and documentation combined!

Ala'a (cmo-0)
--
It does not matter how fast your code is, if it does not work!
Loading...