From kengruven at gmail.com Mon Nov 12 00:16:04 2007 From: kengruven at gmail.com (Ken Harris) Date: Sun, 11 Nov 2007 16:16:04 -0800 Subject: [cl-who-devel] Case-sensitive XML Message-ID: Hi! I'm having trouble outputting case-sensitive XML using cl-who. The *downcase-tokens-p* variable claims to be the answer, but it only controls whether the output is all-upper-case or all-lower-case: (setq *downcase-tokens-p* nil) (with-html-output-to-string (s) (:twoWords)) => "" (setq *downcase-tokens-p* t) (with-html-output-to-string (s) (:twoWords)) => "" I don't get how this is supposed to help with case-sensitive XML: keywords (like all symbols) are case-folded by the CL reader before cl-who sees them, no? :twoWords => :TWOWORDS. To support generation of XML with mixedCase tags or attributes, I would think that cl-who would need to allow strings where it allows only keywords now. Or maybe I'm just completely missing something, because the question that prompted the creation of *downcase-tokens-p* was a camelCase attribute. Can cl-who support mixedCase tags/attributes? Or if it's as simple as changing (keywordp x) to (or (keywordp x) (stringp x)), would such a patch be well-received? thanks! - Ken From opoku at ece.cmu.edu Mon Nov 12 00:27:58 2007 From: opoku at ece.cmu.edu (Osei Poku) Date: Sun, 11 Nov 2007 19:27:58 -0500 Subject: [cl-who-devel] Case-sensitive XML In-Reply-To: References: Message-ID: <20071112002758.GB6623@pokut60> On Sun, Nov 11, 2007 at 04:16:04PM -0800, Ken Harris wrote: > Hi! > > I'm having trouble outputting case-sensitive XML using cl-who. The > *downcase-tokens-p* variable claims to be the answer, but it only > controls whether the output is all-upper-case or all-lower-case: > > (setq *downcase-tokens-p* nil) > (with-html-output-to-string (s) (:twoWords)) > => "" You must quote the symbol with |symBol|. ie (setq *downcase-tokens-p* nil) (with-html-output-to-string (s) (:|twoWords|)) => "" OR => "" > > (setq *downcase-tokens-p* t) > (with-html-output-to-string (s) (:twoWords)) > => "" > > I don't get how this is supposed to help with case-sensitive XML: > keywords (like all symbols) are case-folded by the CL reader before > cl-who sees them, no? :twoWords => :TWOWORDS. To support generation > of XML with mixedCase tags or attributes, I would think that cl-who > would need to allow strings where it allows only keywords now. > > Or maybe I'm just completely missing something, because the question > that prompted the creation of *downcase-tokens-p* was a camelCase > attribute. > > Can cl-who support mixedCase tags/attributes? Or if it's as simple as > changing (keywordp x) to (or (keywordp x) (stringp x)), would such a > patch be well-received? > > thanks! > > > - Ken > _______________________________________________ > cl-who-devel site list > cl-who-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-who-devel -- Osei Poku PhD Student, ECE Carnegie Mellon University 412.268.2687 (work) From kengruven at gmail.com Mon Nov 12 01:16:04 2007 From: kengruven at gmail.com (Ken Harris) Date: Sun, 11 Nov 2007 17:16:04 -0800 Subject: [cl-who-devel] Case-sensitive XML In-Reply-To: <20071112002758.GB6623@pokut60> References: <20071112002758.GB6623@pokut60> Message-ID: Hi Osei, > You must quote the symbol with |symBol|. ie Ah! That will do it. I guess that means I need to (setq *downcase-tokens-p* nil) and then ||-escape every tag, which seems unfortunate, but I don't think there's anything cl-who could do to make it nicer. Thanks for the super-prompt response. - Ken From opoku at ece.cmu.edu Mon Nov 12 01:22:32 2007 From: opoku at ece.cmu.edu (Osei Poku) Date: Sun, 11 Nov 2007 20:22:32 -0500 Subject: [cl-who-devel] Case-sensitive XML In-Reply-To: References: <20071112002758.GB6623@pokut60> Message-ID: <20071112012232.GC6623@pokut60> On Sun, Nov 11, 2007 at 05:16:04PM -0800, Ken Harris wrote: > Hi Osei, > > > You must quote the symbol with |symBol|. ie > > Ah! That will do it. > > I guess that means I need to (setq *downcase-tokens-p* nil) and then > ||-escape every tag, which seems unfortunate, but I don't think > there's anything cl-who could do to make it nicer. Maybe you could play with the reader case settings so that it doesn't upcase symbols by default. look into READTABLE-CASE http://www.lisp.org/HyperSpec/Body/acc_readtable-case.html > > Thanks for the super-prompt response. Glad to help :) > > > - Ken > _______________________________________________ > cl-who-devel site list > cl-who-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-who-devel -- Osei Poku PhD Student, ECE Carnegie Mellon University 412.268.2687 (work) From lispercat at gmail.com Sat Nov 24 22:25:50 2007 From: lispercat at gmail.com (Andrei Stebakov) Date: Sat, 24 Nov 2007 17:25:50 -0500 Subject: [cl-who-devel] Parsing html and creating a new output Message-ID: I am using drakma to get the html and cl-html-parse to parse it. Let's say I need to parse and modify the html and use hunchentoot to handle the request giving out the new html. In cl-who I see only the macro with-html-output-to-string which prints html given a body of s-exp. In my case I will only have a list of s-exp like '(:div "some text"). If I give a list to with-html-output-to-string it will return an empty string. I am wondering is there a function inside cl-who that I can use to convert s-exp html list like '(:body "some body") to an HTML text? Or how can I use the with-html-output-to-string macro for the purpose? Thank you, Andrew From edi at agharta.de Sat Nov 24 23:40:07 2007 From: edi at agharta.de (Edi Weitz) Date: Sun, 25 Nov 2007 00:40:07 +0100 Subject: [cl-who-devel] Parsing html and creating a new output In-Reply-To: (Andrei Stebakov's message of "Sat, 24 Nov 2007 17:25:50 -0500") References: Message-ID: On Sat, 24 Nov 2007 17:25:50 -0500, "Andrei Stebakov" wrote: > I am wondering is there a function inside cl-who that I can use to > convert s-exp html list like '(:body "some body") to an HTML text? No, unfortunately there isn't. I wanted to add that for quite some time now, but it implies a major rewrite of CL-WHO's internals and I don't have time for this ATM. Maybe you can use one the related tools like htout, LML, or htmlgen for this. Edi. From rnewman at twinql.com Sat Nov 24 23:52:06 2007 From: rnewman at twinql.com (Richard Newman) Date: Sat, 24 Nov 2007 15:52:06 -0800 Subject: [cl-who-devel] Parsing html and creating a new output In-Reply-To: References: Message-ID: >> I am wondering is there a function inside cl-who that I can use to >> convert s-exp html list like '(:body "some body") to an HTML text? > > No, unfortunately there isn't. I wanted to add that for quite some > time now, but it implies a major rewrite of CL-WHO's internals and I > don't have time for this ATM. Maybe you can use one the related tools > like htout, LML, or htmlgen for this. I don't know if the innards of CL-WHO have changed in the two years since I wrote my code, but I did put together a hack that did exactly this, calling APPLY-TO-TREE and TREE-TO-TEMPLATE with a rewritten - AUX function. Rather than walking an expression inside a macro, producing code to print HTML, we walk the form inside a function, printing strings directly. I don't know if it still works, but it's under 100 lines, so you should be able to replicate it pretty easily. -R From edi at agharta.de Sun Nov 25 00:00:28 2007 From: edi at agharta.de (Edi Weitz) Date: Sun, 25 Nov 2007 01:00:28 +0100 Subject: [cl-who-devel] Parsing html and creating a new output In-Reply-To: (Richard Newman's message of "Sat, 24 Nov 2007 15:52:06 -0800") References: Message-ID: On Sat, 24 Nov 2007 15:52:06 -0800, Richard Newman wrote: > I don't know if the innards of CL-WHO have changed in the two years > since I wrote my code, but I did put together a hack that did > exactly this, calling APPLY-TO-TREE and TREE-TO-TEMPLATE with a > rewritten - AUX function. > > Rather than walking an expression inside a macro, producing code to > print HTML, we walk the form inside a function, printing strings > directly. > > I don't know if it still works, but it's under 100 lines, so you > should be able to replicate it pretty easily. Why don't you send it to the list? From rnewman at twinql.com Sun Nov 25 00:05:00 2007 From: rnewman at twinql.com (Richard Newman) Date: Sat, 24 Nov 2007 16:05:00 -0800 Subject: [cl-who-devel] Parsing html and creating a new output In-Reply-To: References: Message-ID: >> I don't know if it still works, but it's under 100 lines, so you >> should be able to replicate it pretty easily. > > Why don't you send it to the list? Let me test if it works :) (I'll also fight through my embarrassment over old code...) From rnewman at twinql.com Sun Nov 25 00:16:49 2007 From: rnewman at twinql.com (Richard Newman) Date: Sat, 24 Nov 2007 16:16:49 -0800 Subject: [cl-who-devel] Parsing html and creating a new output In-Reply-To: References: Message-ID: <41F52976-3236-4339-9686-B418A61829D7@twinql.com> Here's my contribution; it still works in 0.9.1! Please forgive any horrible hackiness you find -- this code was never written for public consumption :) who(11): (tree-to-string '(:body (:b "Foo bar") (:i :style "baz" "boo"))) "Foo barboo" -------------- next part -------------- A non-text attachment was scrubbed... Name: tree-to-string.lisp Type: application/octet-stream Size: 5032 bytes Desc: not available URL: -------------- next part -------------- -R From edi at agharta.de Sun Nov 25 00:20:26 2007 From: edi at agharta.de (Edi Weitz) Date: Sun, 25 Nov 2007 01:20:26 +0100 Subject: [cl-who-devel] Parsing html and creating a new output In-Reply-To: <41F52976-3236-4339-9686-B418A61829D7@twinql.com> (Richard Newman's message of "Sat, 24 Nov 2007 16:16:49 -0800") References: <41F52976-3236-4339-9686-B418A61829D7@twinql.com> Message-ID: On Sat, 24 Nov 2007 16:16:49 -0800, Richard Newman wrote: > Here's my contribution; it still works in 0.9.1! Thanks. I'll have a look at it in the next days/weeks when I find some time. From lispercat at gmail.com Sun Nov 25 16:47:58 2007 From: lispercat at gmail.com (Andrei Stebakov) Date: Sun, 25 Nov 2007 11:47:58 -0500 Subject: [cl-who-devel] Parsing html and creating a new output In-Reply-To: References: <41F52976-3236-4339-9686-B418A61829D7@twinql.com> Message-ID: Richard, I tried it and it works. I didn't test it for many cases only for some simple ones that I currently use. That would be great to integrate the functionality into cl-who. Richard, Edi thank you for your support! Andrew On Nov 24, 2007 7:20 PM, Edi Weitz wrote: > On Sat, 24 Nov 2007 16:16:49 -0800, Richard Newman wrote: > > > Here's my contribution; it still works in 0.9.1! > > Thanks. I'll have a look at it in the next days/weeks when I find > some time. > > _______________________________________________ > cl-who-devel site list > cl-who-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-who-devel >