Spark v1.6

Rating: No reviews yet
Downloads: 2379
Released: Jul 2, 2011
Updated: Jul 21, 2011 by RobertGreyling
Dev status: Stable Help Icon

Recommended Download

Application Spark 1.6 - MVC3 (.NET)
application, 17076K, uploaded Jul 5, 2011 - 1654 downloads

Other Available Downloads

Application Spark 1.6 - MVC2 (.NET 4)
application, 17034K, uploaded Jul 5, 2011 - 319 downloads
Application Spark 1.6 - MVC2 (.NET 3.5)
application, 17032K, uploaded Jul 5, 2011 - 406 downloads

Release Notes

Release Notes 1.6

There are two fixes that I've introduced into Spark v1.6 which address the following sticking points:

Attributes surrounded with single quotes with double quotes inside will now be preserved as per your input.

For example:

 <tag attr='something; other="value1, value2"' />

results in exactly the same output HTML when it used to substitute single quote on the outside with double quotes incorrectly. This never used to be an issue a few years ago, but with new libraries taking advantage of HTML5 syntax, attributes like the one above are becoming very common and Spark just got in the way. Anyway, this is fixed now, but if any of your previous views were "relying" on Spark swapping those to double quotes for you (though I can't imagine why), then you may want to retest those views.

The second thing that is happening is a number of JavaScript frameworks jumping on the whole ${ } syntax bandwagon like jQuery Templates for example. So naturally will try and parse these and expand the variables in to the rendered output and folks have been asking for a way to escape these so that they are not parsed, and left alone for the JS library to consume.

So there are now two ways you can escape the Spark code expressions:
  1. Single item escaping (github commit)
  2. Entire block escaping (github commit)

Single Item escaping

This can be done by using one of three escape chars for each expression type. Rather than explain, the following is an example of how you would do this in your spark view:
    <div>
        $${Encoded.Escaped.with.a.dollar < 0}
        \${Encoded.Escaped.with.a.backslash < 0}
        `${Encoded.Escaped.with.a.backtick < 0}
    </div>
    <div>
        !!{Unencoded.Escaped.with.a.dollar < 0}
        \!{Unencoded.Escaped.with.a.backslash < 0}
        `!{Unencoded.Escaped.with.a.backtick < 0}
    </div>
    <div>
        $$!{Encoded.Silent.Nulls.Escaped.with.a.dollar < 0}
        \$!{Encoded.Silent.Nulls.Escaped.with.a.backslash < 0}
        `$!{Encoded.Silent.Nulls.Escaped.with.a.backtick < 0}
    </div>

results in the following verbatim output:

    <div>
        ${Encoded.Escaped.with.a.dollar < 0}
        ${Encoded.Escaped.with.a.backslash < 0}
        ${Encoded.Escaped.with.a.backtick < 0}
    </div>
    <div>
        !{Unencoded.Escaped.with.a.dollar < 0}
        !{Unencoded.Escaped.with.a.backslash < 0}
        !{Unencoded.Escaped.with.a.backtick < 0}
    </div>
    <div>
        $!{Encoded.Silent.Nulls.Escaped.with.a.dollar < 0}
        $!{Encoded.Silent.Nulls.Escaped.with.a.backslash < 0}
        $!{Encoded.Silent.Nulls.Escaped.with.a.backtick < 0}
    </div>

Now I know that currently the $ is the popular delimiter, but all we need is for one, er...visionary, to decide to use the exclamation point (probably already have) and we'd be in the same boat, so this code change takes that into account as well.

Entire block escaping

This is already in the current version, but worth mentioning again. The second way you can do this is thanks to Mike Murray who introduced the new <ignore> special tag for Spark and you use to output verbatim anything that is inside like so:

<html>
  <head>
    <title>ignore test</title>
  </head>
  <body>
    <h1>ignore test</h1>
    <p>${System.DateTime.Now}</p>
    <ignore>
        <div>
            Regular text ${This.isnt.code < 0}
            <var dummy="This isn't a variable" />
        </div>
    </ignore>
  </body>
</html>

Lastly, as of Spark v1.6, it is now fully Mono compliant - well, there's the VB bits, but I'm not counting those :) - thanks to some awesome community efforts by Alex and Jaime! And thanks to them and Josh, we also have a first class shining implementation of Spark now in the FubuMVC framework that really is better than I ever could have hoped for.

Please reach out and thank these guys, they've done some spectacular work here in their own spare time and it's hugely appreciated.

Reviews for this release

No reviews yet for this release.