This is a test of a html template!
We try to replace html tags containing information:
Hello there, <b>Mr. Babbage</b>..
As you see the speicial tag symbols are replaced with entities.
We can also do the same for input forms:
But sometimes we want to replace HTML tags into a template.
There are two ways to do this:
1) Use the macro KEYRAW:
Hello there, Mr. Babbage.
I don't really recommend relaying on it too much.
2) Use the Java side to do this using Template.replace_raw
method that does not do the translation:
Hello there, Mr. Babbage.
This is a lot more manageable and you're less likely to make a mistake because
input comes from java side and java side can't really see whether template
uses raw form or not. So use this instead of KEYRAW.
There is one more quirk. When you happen to write JavaScript
inside your HTML you don't want to escape the HTML stuff to
entities but in case of strings you do want to escape the single quote
and also newlines, carriage returns. There is a macro that does it: KEYJS.
When writing a URL into your document and you want to pass an argument,
but pass it safely here's one way to do it:
Click me
Now lets demonstrate the powerful localization feature. You can
create your own "alias" database and add keys here:
Bonjour.
Filles aiment garcons.
Of course you are not required to use the alias database feature
at all and just ignore it. But if you want to create multi-
lingual web pages it can be your ally.
Finally lets demonstrate one more macro - INCLUDE. What include does
is that it takes the argument, treats it as path and inserts it
into the file. That is done on parse time and all the macro and even
SUB-structures in that included file are also parsed.
This here is a footer template file, lets see if macros work here too:
Hello there, Mr. Babbage.
As include macros can be dangerous they are not added by default to the
HtmlTemplate context. In case you don't want to parse the
contents of the file you can use the macro IncludePlainMacro and
INCLUDEPLAIN macro tag.