* Andrew Martin <[EMAIL PROTECTED]> [031015 18:01]:
Hey, that was quick!
Works fine.
That oughtta keep the users happy.
Thanks
tim

> Earlier, I wrote:
> > My ... Build-Tag dialect should check every string! attribute value
> and 'escape' any double quote marks inside (so that people don't have to
> worry about this.)
> 
> Build-Tag: function [
>     "Generates a tag from a composed block."
>     Values [block!] "Block of parens to evaluate and other data."
>     ] [
>     Tag Value_Rule XML? Name Attribute Value
>     ] [
>     Tag: make string! 7 * length? Values
>     Value_Rule: [
>         set Value issue! (Value: mold Value)
>         | set Value file! (Value: remove mold Value)
>         | set Value url! (Value: mold Value)
>         | set Value lit-path!
>         | set Value string! (replace/all Value {"} "&#034;")
>         | set Value any-type! (Value: form :Value)
>         ]
>     XML?: false
>     parse compose Values [
>         [
>             set Name ['?xml (XML?: true) | word! | url! | string!]
> (insert tail Tag Name)
>             any [
>                 set Attribute [word! | url! | string!] Value_Rule (
>                     repend Tag [#" " Attribute {="} Value {"}]
>                     )
>                 | Value_Rule (insert/only tail Tag reduce [#" " Value])
>                 ]
>             end (if XML? [insert tail Tag #"?"])
>             ]
>         | [set Name refinement! to end (Tag: mold Name)]
>         ]
>     to tag! Tag
>     ]
> 
> The change is this line:
> 
>               | set Value string! (replace/all Value {"} "&#034;")
> 
>       which escapes {"} with the appropriate HTML code.
> 
> Testing:
> 
> >> test: {"boo-boo"} ; literal quotes
> == {"boo-boo"}
> >> print ml compose/deep[
> [        html[
> [                body[
> [                        input/type/name/value "text" "testing" (test)
> [                        ]
> [                ]
> [        ]
> <html><body><input type="text" name="testing"
> value="&#034;boo-boo&#034;" /></body></html>
> 
> And displays:
>               "boo-boo"
>       in the input field.
> 
> Enjoy!
> 
> Andrew J Martin
> Attendance Officer
> & Grail Jedi.
> Successively refining oneself...
> Colenso High School
> Arnold Street, Napier.
> Tel: 64-6-8310180 ext 826
> Fax: 64-6-8336759
> http://colenso.net/scripts/Wiki.r?AJM
> http://www.colenso.school.nz/
> 
> DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or 
> legally 
> liable) for materials distributed to or acquired from user e-mail accounts. You can 
> report any 
> misuse of an e-mail account to our ICT Manager and the complaint will be 
> investigated. 
> (Misuse can come in many forms, but can be viewed as any material sent/received that 
> indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, 
> inappropriate 
> language and/or other issues described in our Acceptable Use Policy.)
> 
> All outgoing messages are certified virus-free by McAfee GroupShield Exchange 
> 5.10.285.0
> Phone: +64 6 843 5095  or  Fax: +64 6 833 6759  or  E-mail: [EMAIL PROTECTED] 
> 
> 
> -- 
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.

-- 
Tim Johnson <[EMAIL PROTECTED]>
      http://www.alaska-internet-solutions.com
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to