Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

'ML problem with literal quotation marks

 [1/6] from: tim::johnsons-web::com at: 15-Oct-2003 16:35


Hello: I have a question about puting literal quotation marks into a form generated by 'ML (Andrew's HTML-generating dialect) Below is a sample script followed by the output source ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; REBOL[] print "Content-Type: text/html^/" do %Pop.r do %Push.r do %build-tag.r do %ML.r test: {"boo-boo"} ; literal quotes print ml compose/deep[ html[ body[ input/type/name/value "text" "testing" (test) ] ] ] ;;;; html source follows: <html> <body><input type="text" name="testing" value=""boo-boo /> </body></html> ;;; Below is a console session
>> print ml compose/deep[ html[ body[ input/type/name/value "text" "testing" (test) ] ] ]
<html> <body><input type="text" name="testing" value=""boo-boo"" /> </body></html> The content as viewed in the browser does not show {"boo-boo"} (with or without the literal quotes) How do I resolve this? thanks tim -- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com

 [2/6] from: andrew:martin:colenso:school at: 24-Dec-2003 22:40


Hi, Tim.
> Cc: [Al--Bri--xtra--co--nz]
That email address no longer exists! Try one of these: [AJMartin--orcon--net--nz] [Rebol--orcon--net--nz] Or at work: [Andrew--Martin--colenso--school--nz] Tim wrote:
> <html> > <body><input type="text" name="testing" value=""boo-boo"" /> > </body></html> > > The content as viewed in the browser does not show {"boo-boo"} (with
or without the literal quotes) That's because the browser interprets the "input" tag like this: input type="text" name="testing" value="" In other words, the "value" attribute is an empty string, which is why the browser doesn't show {"boo-boo"}. There's also a fault in my ML dialect, as I never considered that people might want to display text with double quote marks. My ML dialect (or maybe 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. Andrew J Martin Attendance Officer & Grail Jedi. Chief boo-boo maker! 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: [postmaster--colenso--school--nz]

 [3/6] from: andrew:martin:colenso:school at: 24-Dec-2003 22:40


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: [postmaster--colenso--school--nz]

 [4/6] from: tim:johnsons-web at: 15-Oct-2003 17:48


* Andrew Martin <[andrew--martin--colenso--school--nz]> [031015 17:31]:
> Hi, Tim. > > Cc: [Al--Bri--xtra--co--nz]
<<quoted lines omitted: 4>>
> Or at work: > [Andrew--Martin--colenso--school--nz]
Sorry! Used the one from ML.r. Will change.
> Tim wrote: > > <html>
<<quoted lines omitted: 7>>
> In other words, the "value" attribute is an empty string, which is why > the browser doesn't show {"boo-boo"}.
I understand...
> There's also a fault in my ML dialect, as I never considered that people > might want to display text with double quote marks. My ML dialect (or > maybe 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.
I would prefer that people didn't use them. Currently what I'm doing is just eliminating them, however, sooner or later some user is going to insist on it. Let me know when you have a solution. thanks tim
> Andrew J Martin > Attendance Officer
<<quoted lines omitted: 17>>
> To unsubscribe from this list, just send an email to > [rebol-request--rebol--com] with unsubscribe as the subject.
-- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com

 [5/6] from: tim:johnsons-web at: 15-Oct-2003 18:19


* Andrew Martin <[andrew--martin--colenso--school--nz]> [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
<<quoted lines omitted: 72>>
> To unsubscribe from this list, just send an email to > [rebol-request--rebol--com] with unsubscribe as the subject.
-- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com

 [6/6] from: bry:itnisk at: 16-Oct-2003 11:42


one not very happy solution would be the usage of &quot; if ML (hard to remember) allows the passage of entities.
> * Andrew Martin
<[andrew--martin--colenso--school--nz]> [031015 17:31]:
> > > > Hi, Tim.
<<quoted lines omitted: 7>>
> > Or at work: > >
[Andrew--Martin--colenso--school--nz]
> Sorry! Used the one from ML.r. Will
change.
> > Tim wrote: > > > <html> > > > <body><input type="text"
name="testing" value=""boo-boo"" />
> > > </body></html> > > > > > > The content as viewed in the browser
does not show {"boo-boo"} (with
> > or without the literal quotes) > > > > That's because the browser interprets
the "input" tag like this:
> > input type="text"
name="testing" value=""
> > In other words, the "value" attribute is
an empty string, which is why
> > the browser doesn't show {"boo-boo"}. > > I understand... > > > There's also a fault in my ML dialect,
as I never considered that people
> > might want to display text with double
quote marks. My ML dialect (or
> > maybe 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. > > I would prefer that people didn't use
them. Currently what I'm doing
> is just eliminating them, however, sooner
or later some user is going
> to insist on it. > Let me know when you have a solution.
<<quoted lines omitted: 12>>
> > > > 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: [postmaster--colenso--school--nz]

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted