Having suffixes instead of prefixes is fine with me! I agree that suffixes
would make for more readable content.
Jon
"Kin Blas"
<jblas at adobe.com>
Sent by: To
ide-bounces at opena <ide at openajax.org>
jax.org cc
Subject
08/13/2008 01:57 Re: [OpenAjaxIDE] HTML/JavaScript
PM encoding for variable substitution
Yeah the transformations were exactly what I was thinking. Just curious,
why are we prefixing as opposed to postfixing the transformation names? I
guess to my eyes, it would be easier to read the template code/markup and
see what properties were actually being used if they came after the
property names.
--== Kin ==--
From: ide-bounces at openajax.org [mailto:ide-bounces at openajax.org] On Behalf
Of Jon Ferraiolo
Sent: Wednesday, August 13, 2008 11:09 AM
To: ide at openajax.org
Subject: [OpenAjaxIDE] HTML/JavaScript encoding for variable substitution
Right now we have both property substitution using @@foo@@ syntax and
localization substitution using %%bar%%. Kin has asked if we can extend the
syntax to take into account the fact that a given substitution string might
appear within HTML content (which has its own syntax quirks) and other
times within JavaScript (with its own syntax quirks). I promised to send an
email with a proposal.
Here is what I propose - add two optional parenthetical prefixes,
(htmlchars) and (jschars) to variable references, where:
(htmlchars) transforms the substitution string to the following
replacements (aligns with PHP's htmlspecialchars()):
& with &amp;
< with &lt;
> with &gt;
" with &quot;
' with &#039;
(jschars) transforms the substitution string to the following replacements
(aligns with PHP's addslashes()):
\ with \\
' with \'
" with \"
To illustrate (htmlchars), suppose your have:
<content>@@(htmlchars)remark@@</content>
and the user entered the following for the remark property: << I'm in love!
>>
then the resulting content would be: &lt;&lt; I&#039;m in love! &gt;&gt;
To illustrate (jschars), suppose you have:
<javascript>document.getElementById
('textfield').value='@@(jschars)remark@@';</javascript>
then the resulting JavaScript would be: document.getElementById
('textfield').value='<< I\'m in love! >>';
I propose a variable reference can have either (htmlchars) or (jschars) or
neither, but not both.
Comments?
Jon_______________________________________________
IDE mailing list
IDE at openajax.orghttp://openajax.org/mailman/listinfo/ide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openajax.org/pipermail/ide/attachments/20080813/f5e0b0cc/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080813/f5e0b0cc/attachment-0003.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic32665.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080813/f5e0b0cc/attachment-0004.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://openajax.org/pipermail/ide/attachments/20080813/f5e0b0cc/attachment-0005.gif