If you don't to have an addtl round-trip, but don't mind having a second file, you could use <xinclude/> with parse="text"...
http://github.com/jquery/jquery-tmpl/blob/master/demo.html
<script id="sometmpl" type="text/html">
<xinclude href="sometmpl.html" parse="text"/>
</script>
http://github.com/jquery/jquery-tmpl/blob/master/sometmpl.html
<li>${$i}) <a href="${url}">${name}</a> (${cityJoin})</li>
The ximport parse="text" will treat the entire contents of the target file the same as if it was actually present at that location, but it's treated as literal text for output - zero parsing or processing.
Of course that doesn't work if you want to mix server-side code in with the jquery-tmpl stuff. It's not ideal, but to reduce friction you could create a partial to represent the jq ${} characters?
_t.spark
${"${"}<render/>${"}"}
http://github.com/jquery/jquery-tmpl/blob/master/demo.html
<script id="sometmpl" type="text/html">
<li><t>$i</t>) <a href="<t>url</t>"><t>name</t></a> (<t>cityJoin</t>)</li>
</script>
Wow - that's a bad idea! You can't tell the jqt apart from the elements, and the <t>url</t> in the <a href=""> won't be picked up in any case.
This kind of feels like the same class of problem as the css # conflict. I'd agree with the conclusion that "# " is a reasonable default, even if it's a breaking change you have the option of configuring "#" when you upgrade so you're not forced to change all of your views. Would be worth considering making autoencoding default to true at the same time, since it's the same kind of downconfig-when-you-upgrade event.
But! That said! It might be nice if there was a way to mark a region that suppresses or alters the parser's understanding of a syntax...
<script type="text/css" ignore="#">
#header {yarg:3;}
</script>
<script id="sometmpl" type="text/html" ignore="${}">
<li>${$i}) <a href="${url}">${name}</a> (${cityJoin})</li>
</script>
Though the syntax parsing phase itself is too early to do start-end element pairing. If it was possible at all, would need to be a syntax more explicit than an element pair's attribute.
<script type="text/css"><?ignore #?>
#header {yarg:3;}
<?ignore /#?></script>
<script id="sometmpl" type="text/html"><?ignore $?>
<li>${$i}) <a href="${url}">${name}</a> (${cityJoin})</li>
<?ignore /$?></script>
http://github.com/jquery/jquery-tmpl/blob/master/demo.html
Thanks!
--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To post to this group, send email to spar...@googlegroups.com.
To unsubscribe from this group, send email to spark-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spark-dev?hl=en.
Sent from my mobile
@James, yeah, I specifically avoided basing something off the <![CDATA[ syntax, though that was one of the first things that comes to mind… It seemed like htm, aspx, and xml editors each treat them a bit differently, and even the way cdata in treated by ie and ff varies. So that seemed like the water was muddy enough already trying to add another meaning to that would confuse the issue even more.
Unless you meant a totally different start and end marker - not CDATA itself but similar meaning - just “treat this bit as literal until you hit the end-code”. That would work fine. Kind of like the effect xinclude parse=”text” has without requiring an additional file.
<li>(${{$i}}) <a href="${{url}}">${{name}}</a> (${{cityJoin}})</li>
It doesn't look pretty, but what's being accomplished here isn't exactly
elegant either, so I think it's a reasonable tradeoff.
____
[1]
http://stackoverflow.com/questions/91362/how-to-escape-brackets-in-a-format-string-in-net
-Asbjørn
On Tue, 22 Jun 2010 22:30:22 +0200, Louis DeJardin
<lode...@microsoft.com> wrote:
> @James, yeah, I specifically avoided basing something off the <![CDATA[
> syntax, though that was one of the first things that comes to mind... It
> spar...@googlegroups.com<mailto:spar...@googlegroups.com>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/spark-dev?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Spark View Engine Dev" group.
> To post to this group, send email to
> spar...@googlegroups.com<mailto:spar...@googlegroups.com>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com>.
Maybe something that follows CDATA’s lead for punctuation, just with a different keyword. Since you’re turning off the Spark syntax, maybe that, spelled backwards?
<script id="sometmpl" type="text/html"><![KRAPS[
<li>${$i}) <a href="${url}">${name}</a> (${cityJoin})</li>
]]></script>
Nah - the leading < would be invalid…
On a more serious note, how about a creative misinterpretation of the existing <xinclude> element with parse=”text” when the href attribute is missing?
<script id="sometmpl" type="text/html">
<xinclude parse=”text”>
<li>${$i}) <a href="${url}">${name}</a> (${cityJoin})</li>
</xinclude>
</script>
Not the tersest thing in the world, but you could say it has some symmetry with the existing use of xinclude to include another file verbatim.
<script id="sometmpl" type="text/html">
<xinclude href=”xxx” parse=”text”/>
</script>
How about introducing a new tag (<verbatim>) as you propose, but in
circumstances like this (and others) allow an XML namespace+prefix to be
easily added to all Spark elements? They should reside in a default
namespace nonetheless, imho.
-Asbjørn
>>> spark-dev+...@googlegroups.com<spark-dev%2Bunsu...@googlegroups.com>
>>> <mailto:spark-dev%2Bunsu...@googlegroups.com<spark-dev%252Buns...@googlegroups.com>
>>> >.
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/spark-dev?hl=en.
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups
>>> "Spark View Engine Dev" group.
>>> To post to this group, send email to spar...@googlegroups.com<mailto:
>>> spar...@googlegroups.com>.
>>> To unsubscribe from this group, send email to
>>> spark-dev+...@googlegroups.com<spark-dev%2Bunsu...@googlegroups.com>
>>> <mailto:spark-dev%2Bunsu...@googlegroups.com<spark-dev%252Buns...@googlegroups.com>
>>> >.
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/spark-dev?hl=en.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups
>>> "Spark View Engine Dev" group.
>>> To post to this group, send email to spar...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> spark-dev+...@googlegroups.com<spark-dev%2Bunsu...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/spark-dev?hl=en.
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups
>>> "Spark View Engine Dev" group.
>>> To post to this group, send email to spar...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> spark-dev+...@googlegroups.com<spark-dev%2Bunsu...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/spark-dev?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups
>> "Spark View Engine Dev" group.
>> To post to this group, send email to spar...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> spark-dev+...@googlegroups.com<spark-dev%2Bunsu...@googlegroups.com>
-Asbjørn
On Wed, 23 Jun 2010 04:00:31 +0200, Louis DeJardin
<lode...@microsoft.com> wrote:
> Maybe something that follows CDATA's lead for punctuation, just with a
> different keyword. Since you're turning off the Spark syntax, maybe
> that, spelled backwards?
>
> <script id="sometmpl" type="text/html"><![KRAPS[
> <li>${$i}) <a href="${url}">${name}</a> (${cityJoin})</li>
> ]]></script>
>
> Nah - the leading < would be invalid...
> syntax, though that was one of the first things that comes to mind... It
> seemed like htm, aspx, and xml editors each treat them a bit
> differently, and even the way cdata in treated by ie and ff varies. So
> that seemed like the water was muddy enough already trying to add
> another meaning to that would confuse the issue even more.
>
> Unless you meant a totally different start and end marker - not CDATA
> itself but similar meaning - just "treat this bit as literal until you
> hit the end-code". That would work fine. Kind of like the effect
> xinclude parse="text" has without requiring an additional file.
>
>
>
> From: spar...@googlegroups.com<mailto:spar...@googlegroups.com>
> [mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>]
> On Behalf Of Curtis Mitchell
> Sent: Tuesday, June 22, 2010 12:30 PM
>
> To: spar...@googlegroups.com<mailto:spar...@googlegroups.com>
> Subject: Re: SparkView and JQuery-tmpl
>
> Yeah, it seems like you should be able to escape the jquery-tmpl
> delimiters since they're parsed after the spark code has been processed.
>
> Sent from my mobile
>
> ________________________________
> From: James Hughes <kou...@gmail.com<mailto:kou...@gmail.com>>
> Sender: spar...@googlegroups.com<mailto:spar...@googlegroups.com>
> Date: Tue, 22 Jun 2010 20:27:05 +0100
> To: <spar...@googlegroups.com<mailto:spar...@googlegroups.com>>
> ReplyTo: spar...@googlegroups.com<mailto:spar...@googlegroups.com>
> spar...@googlegroups.com<mailto:spar...@googlegroups.com>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/spark-dev?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Spark View Engine Dev" group.
> To post to this group, send email to
> spar...@googlegroups.com<mailto:spar...@googlegroups.com>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/spark-dev?hl=en.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Spark View Engine Dev" group.
> To post to this group, send email to
> spar...@googlegroups.com<mailto:spar...@googlegroups.com>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/spark-dev?hl=en.
> --
> You received this message because you are subscribed to the Google
> Groups "Spark View Engine Dev" group.
> To post to this group, send email to
> spar...@googlegroups.com<mailto:spar...@googlegroups.com>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/spark-dev?hl=en.
> --
> You received this message because you are subscribed to the Google
> Groups "Spark View Engine Dev" group.
> To post to this group, send email to
> spar...@googlegroups.com<mailto:spar...@googlegroups.com>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com>.
<text> sounds pretty good, something like <code>…</code> might be a nice additional alias for multiline code block <% … %>, though that clearly has a conflict.
Maybe not use the element, but follow along the leading x of the <xinclude/> element name, with <xtext> and <xcode>? You could say they’re a related set of elements because they share some degree of pre-processing or parse-time effect?
<xtext>
#header {foo:bar;}
</xtext>
<xcode>
func<string,string> etc = …;
foreach(var x in y) {
Output.Write(etc(x));
}
</xcode>
-Asbjørn
A default namespace prefix of 'spark' could be registered as well so
whenever you find yourself in conflict with an element belong to another
language, you can just add the prefix to the Spark element;
<spark:include ... />
-Asbjørn
On Wed, 23 Jun 2010 11:00:15 +0200, Louis DeJardin
<lode...@microsoft.com> wrote:
> <text> sounds pretty good, something like <code>...</code> might be a
> nice additional alias for multiline code block <% ... %>, though that
> clearly has a conflict.
>
> Maybe not use the element, but follow along the leading x of the
> <xinclude/> element name, with <xtext> and <xcode>? You could say
> they're a related set of elements because they share some degree of
> pre-processing or parse-time effect?
>
> <xtext>
> #header {foo:bar;}
> </xtext>
>
> <xcode>
> func<string,string> etc = ...;
> foreach(var x in y) {
> Output.Write(etc(x));
> }
> </xcode>
>
>
>
> From: spar...@googlegroups.com [mailto:spar...@googlegroups.com] On
> Behalf Of Rob G
> Sent: Wednesday, June 23, 2010 12:45 AM
> To: spar...@googlegroups.com
> Subject: Re: SparkView and JQuery-tmpl
>
> I was thinking of <text> but seems like it's far too likely to result in
> another conflict somewhere down the line. Also, the name doesn't express
> its true intent as clearly.
> 2010/6/23 Asbjørn Ulsberg <asbj...@gmail.com<mailto:asbj...@gmail.com>>
> @Louis - I agree with @James' suggestion, and by that I mean a
> "CDATA-like" tag - perhaps we can add a <verbatim> tag to cover this -
> or has that pesky HTML5 taken that one too? ;-)
>
> If we agree on a tag, then I can add it part of the work I'm doing with
> the SparkSense plug-in since I'm knee deep in that code anyway - or
> someone else can do it they prefer. I know James Foster added the
> <markdown> tag so he has some experience in this area.
>
> If you don't like <verbatim>, then how about <asis> or <handsoff> or
> even <canttouchthis> :-) Just kidding, but I really do think this is
> going to be needed more often as jQuery-templ gains traction, and if we
> want Spark to get a bigger foot hold at the same time. I think it's the
> least friction for this conflict even though there may be some
> restrictions for those happy-go-lucky server-client-side-code-mixers out
> there *tut tut* :-).
>
> Thoughts?
>
> All the best,
> RobertTheGrey
> On Tue, Jun 22, 2010 at 9:30 PM, Louis DeJardin
> <lode...@microsoft.com<mailto:lode...@microsoft.com><mailto:lode...@microsoft.com<mailto:lode...@microsoft.com>>>
> wrote:
> @James, yeah, I specifically avoided basing something off the <![CDATA[
> syntax, though that was one of the first things that comes to mind... It
> seemed like htm, aspx, and xml editors each treat them a bit
> differently, and even the way cdata in treated by ie and ff varies. So
> that seemed like the water was muddy enough already trying to add
> another meaning to that would confuse the issue even more.
>
> Unless you meant a totally different start and end marker - not CDATA
> itself but similar meaning - just "treat this bit as literal until you
> hit the end-code". That would work fine. Kind of like the effect
> xinclude parse="text" has without requiring an additional file.
>
>
> From:
> spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>
> [mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>]
> On Behalf Of Curtis Mitchell
>
> Sent: Tuesday, June 22, 2010 12:30 PM
> To:
> spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>
>
> Subject: Re: SparkView and JQuery-tmpl
>
> Yeah, it seems like you should be able to escape the jquery-tmpl
> delimiters since they're parsed after the spark code has been processed.
>
> Sent from my mobile
>
> ________________________________
> From: James Hughes
> <kou...@gmail.com<mailto:kou...@gmail.com><mailto:kou...@gmail.com<mailto:kou...@gmail.com>>>
> Sender:
> spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>
>
> Date: Tue, 22 Jun 2010 20:27:05 +0100
> To:
> <spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>>
> ReplyTo:
> spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>
>
> Subject: Re: SparkView and JQuery-tmpl
>
> Would it not be possible (in future) to have a CDATA style area within a
> Spark file? Basically an area that just spits back plain text? I mean
> if you are trying to mix serverside stuff with this sort of client stuff
> you are really asking fro trouble anyway. It is possible to
> override/hack the jquery tempalte engine to look for different
> delimiters which might be an easier option?
>
> James
> On Tue, Jun 22, 2010 at 8:20 PM, Louis DeJardin
> <lode...@microsoft.com<mailto:lode...@microsoft.com><mailto:lode...@microsoft.com<mailto:lode...@microsoft.com>>>
> spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com><mailto:spark-dev%2Bunsu...@googlegroups.com<mailto:spark-dev%252Buns...@googlegroups.com>>.
>
> For more options, visit this group at
> http://groups.google.com/group/spark-dev?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Spark View Engine Dev" group.
> To post to this group, send email to
> spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com><mailto:spark-dev%2Bunsu...@googlegroups.com<mailto:spark-dev%252Buns...@googlegroups.com>>.
>
> For more options, visit this group at
> http://groups.google.com/group/spark-dev?hl=en.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Spark View Engine Dev" group.
> To post to this group, send email to
> spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com><mailto:spark-dev%2Bunsu...@googlegroups.com<mailto:spark-dev%252Buns...@googlegroups.com>>.
>
> For more options, visit this group at
> http://groups.google.com/group/spark-dev?hl=en.
> --
> You received this message because you are subscribed to the Google
> Groups "Spark View Engine Dev" group.
> To post to this group, send email to
> spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com><mailto:spark-dev%2Bunsu...@googlegroups.com<mailto:spark-dev%252Buns...@googlegroups.com>>.
>
> For more options, visit this group at
> http://groups.google.com/group/spark-dev?hl=en.
> --
> You received this message because you are subscribed to the Google
> Groups "Spark View Engine Dev" group.
> To post to this group, send email to
> spar...@googlegroups.com<mailto:spar...@googlegroups.com><mailto:spar...@googlegroups.com<mailto:spar...@googlegroups.com>>.
> To unsubscribe from this group, send email to
> spark-dev+...@googlegroups.com<mailto:spark-dev%2Bunsu...@googlegroups.com><mailto:spark-dev%2Bunsu...@googlegroups.com<mailto:spark-dev%252Buns...@googlegroups.com>>.
==== reply out-of-band to observation that <xinclude> is actually <include>
Ah!! That’s exactly right. I confused the name of the spec with the name of the element, which is <include>, and doesn’t require a namespace by default.
So there’s no “x” pattern at all - but a multi-line armored code and text element of some name might be nice to have. However if syntax escaping works you could say, as a feature, that’s orthogonal to the problem this thread is about.
==== reply to thread
Yeah - only conflict with ## is for putting cs #pragma in .spark files - but that can always be done with a space like “# #pragma” to no problem there.
$${x} to output literal text “${x}” - not html encoded of course
!!{x} to output literal text “!{x}” - same
## to output literal text “#”
Hmmm… In the parser for those things there are some non-trivial rules that understand the structure of the text inside ${x} - for example it needs to match internal { and } pairs in order to close on the correct ending }.
So, that said, you can get the same effect with:
$${ to output literal text “${”
!!{ to output literal text “!{”
## to output literal text “#”
Would it also make sense to have
<!!-- to output literal text “<!--”
<!!-- html comment with code evaluation intact, like ${DateTime.UtcNow} -->
Otherwise you need to use the escape as string trick, like
!{“<!--“} html comment with code evaluation intact, like ${DateTime.UtcNow} -->
It would be nice if {#...#} could (whenever introducing a breaking change
is possible) replace <!-- --> as the default Spark comment mechanism as
well.
-Asbjørn