D 2013-10-16T21:19:16.185
L home
P 2fa8d0d48be8df0af663179a021a0edf2d26809e
U carlosru
W 3306
PreprecessorJS
PreprecessorJS is a simple parser to transform simple tokens into
<script></script> tags, and rewrites the generated markup,or better
said is a kind of preprocessor like php, jsp, asp but using the native
javascript as language.
Example:
The default pair of tokens used for preprocessorJS
(PJS) are "{?" and "?}" and for assignament {?=([JavascriptVar]) ?}
inside these tokens should go javascript code. You can change the pair of
tokens inside the preprocessorJS.js changing openToken,assignamentToken and
closeToken variables.
So for example:
{? var name="Alice";
var where="in the wonderland";
?}
<h2>The book is {?=(name);?} {?=(where);?} </h2>
And the tokens are mixed and embeded in a html page, that will be preprocessed
loading
the preprocessorJS.js javascript on the load event in the body tag and calling
changeIt() function.
Finally in this version, you can have just GET parameters comming from a
HTML Form. Using the array parms['parName'] where 'parName' is the
parameter corresponding to the name of the elements in your form.
var name=