Release Notes for Clearsilver 0.9.0 7/7/2003 ------------------------------------- WARNING: This release introduces some incompatible changes to the ClearSilver template syntax. It is unlikely that these changes will affect you, but they might. The two known incompatible changes are: - Completely Numeric identifiers are now considered numbers. This should mean that does what you expect, instead of looking up 1 in the HDF, not finding it, and evaluating to false. Before you had to use the # sign to signify a number. This shouldn't change any code that did what you expected it to do, but might change code which was previously broken and you didn't know it (for example, we had Trakken code with which should have been 0 - box_id, but it was working because 1 evaluated to 0 before, and now it evaluates to 1). With this change, we also added a symbol to force variable identifiers (if you had any all numeric identifiers in the past). That symbol is the time honored dollar sign: $. This means that is the same as , and is the same as in previous versions. - Boolean evaluation. Before, we had only numeric and string evaluation, with some special cases for if. This caused some troubles, especially because was not the same as (because of the special case). We now have boolean evaluation. Boolean evaluation is used in if/elif/alt, and is also used with the operators !, && and ||. Boolean evaluation should be the same as in Perl (where you also have variables that "Act the right type" in various different places). In boolean evaluation, false is one of the following: - A number equal to 0 - A string that is empty, ie "" - A variable that doesn't exist or evaluates to either an empty string or 0. Compared to numeric evaluation, where 0 was only: - A number equal to 0 - A string that doesn't convert to a number - A variable that doesn't exist - A variable that converts to the number 0 - A variable that doesn't convert to a number. Although this is somewhat more intuitive, it can still be confusing, so I still recommend using explicit operators like # and ?, but in theory this will "do what I mean" more often than before. Again, this shouldn't "break" any code that was actually working before, but its possible that you rely on this old method anyways. I've included the beginning of a simple "cs lint" program (in python) to do more rigorous checking of the syntax of your CS files. It currently will warn you of cases where there will be changes in the first of these incompatible changes, but not the second, but I hope to expand it in the future. For not so problematic changes: - I've included the ruby module from Dan Janowski (danj at 3skel . com) I've tried to put it into the build system, but its possible I've broken something (I've never really used ruby). Give it a try and let me know how it goes. - I've also included Dan's cs program (cs/cs.c). This program is similar to cs/cstest but can take multiple HDF and CST files as input. - I've introduced a new CS command: with. This is similar to the Pascal with in functionality, allowing you to shorten references in a limited scope. Another way to think of with is similar to each except of a single variable instead of all of its children. For example: Instead of having to use the full syntax everywhere. - Config.WhiteSpaceStrip now defaults to 1, so white space stripping is enabled by default for CGI (only on text/html output) - Config.TagStart - This allows you to specify a different ClearSilver tag than cs. Ie, to get back to the old CS/HDF, you can just set Config.TagStart to ol, and then you can evaluate: . This was suggested by Robin Barooah on the ClearSilver mailing list. - Strings in ClearSilver templates can now be specified with single quotes (ie like python, you can now use either " or ', still haven't decided on an escape sequence yet, you'll notice with the current parser you can't have " ?>... maybe I should have used a parser generator... - Fixed bug where we weren't escaping # in url_escape - Fixed bug where we were escaping & in js_escape - Added name() function to the templates. This works the same as the name: cmd, ie is the same as . This evaluates to the last part of the HDF name space for a variable, useful for with and each especially. - Instead of all of the hassle with getting the right include files, we now have a single ClearSilver.h file (ala Python.h or windows.h). In the future, we'll try to keep these types of major incompatibilities to major version numbers. I'm not sure if we're going to be reaching 1.0 next or .10.0, but what does 1.0 mean in open source projects anyway? Also, on a side note, ClearSilver was originally being sponsored by Neotonic Software Corporation (well, it was my company, right?). Neotonic was recently purchased by Google, but ClearSilver is still available as Open Source software, under the same license as before, and will continue to be developed primarily by myself. It remains to be seen whether Google will be using ClearSilver, but every successful (and many unsuccessful) internet company needs at least a half dozen competing templating languages, right? -- Brandon Long