---Raul Miller wrote:
> I went looking for a J library routine which properly quotes 
> its argument, and found the (require 'convert') 'quote' verb.

That will prove useful thanks for pointing it out.
 
> While looking for it, I also stumbled across enquote from 
> ~system/packages/publish/web.ijs which is used for quoting 
> HTML attributes.
> I noticed that enquote does not properly deal with 
> nested quotes.  I believe that they should be converted to 
> character entities.  This means that proper usage should 
> probably look something like
>    enquote@(entities inv)

I also recently came across web.ijs (which, after a bit of tweaking to
output valid XHTML, I have found very useful as a base for dynamically
building web forms).

While enquote@(entities inv) is neat, I'm not convinced that it will be
much practical use. The verb enquote is used for surrounding properties
of a Tag, for example myclass in the following (enquote is called by the
verb class ):
   DIV class 'myclass' 'This is the text for display'
<DIV class="myclass">This is the text for display</DIV>

The properties don't get displayed in the browser and probably shouldn't
include things like " or & that need to be represented as &quot; etc. I
think entities inv is for use on text for display, which in turn doesn't
need to be enquoted: 

   DIV class 'myclass' entities inv 'Pete cried "Stop!", but she
didn''t'
<DIV class="myclass">Pete said &quot;Stop!&quot;, but she didn't</DIV>


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to