Wiki page
[home] by
carlosru
2013-10-16 21:30:02.
D 2013-10-16T21:30:02.420
L home
P bbd6a62c478e1ba96540a6e33bca05d7fb5d8951
U carlosru
W 3236
<h1 align="center"><font color="blue">PreprecessorJS</font></h1><br>
<p>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.</p>
<h2>Example:</h2>The default pair of tokens used for <font color="#009966">preprocessorJS</font>
(PJS) are <b>"{?" and "?}" </b> and for assignament <b>{?=([JavascriptVar]) ?}</b>
inside these tokens should go javascript code. You can change the pair of
tokens inside the preprocessorJS.js changing openToken,assignamentToken and
closeToken variables.<br>
<br>
Download <a href="http://chiselapp.com/user/carlosru/repository/processorjs/zip/PreprocessorJS-fa19852a024872c8.zip?uuid=fa19852a024872c85de1577cf0c30e87c2085a51">preprocessJS.zip</a><br>
<br>
So for example:<br>
<br>
<p>{? var name="Alice";<br>
var where="in the wonderland";<br>
?}<br>
<br>
<h2>The book is {?=(name);?} &nbsp; {?=(where);?} </h2><br>
<br>
And the tokens are mixed and embeded in a html page, that will be preprocessed
loading<br>
the preprocessorJS.js javascript on the load event in the body tag and calling
changeIt() function.<br>
<br>
</p>
<p><head><br>
<script src="./lib/preprocessorJS.js"
type="text/javascript"></script><br>
</head><br>
<br>
<body onload="changeIt();"><br>
<br>
The resulted markup will be something like:<br>
</p>
<p><h2>The book is Alice in the wonderland</h2><br>
<br>
You can also have very simple if-block like this<br>
</p>
<p>{? if(name="Alice"){ ?};<br>
<p>Some markup..</p><br>
{? } else { ?};<br>
<p>Other markup...</p><br>
?}<br>
</p>
<p>Finally in this version, you can have just GET parameters comming from a
HTML Form. Using the array <b>parms<a href="/user/carlosru/repository/processorjs/wiki?name=%27parName%27">'parName'</a></b>
where 'parName' is the parameter corresponding to the name of the elements in
your form.<br>
var name=</p>
<p>{? <br>
var name=params['theName'];<br>
?}<br>
<br>
<br>
This is licenced under Apache 2.0<br>
<br>
And the repository is a Fossil one on
<a href="https://chiselapp.com/user/carlosru/repository/processorjs">SCM
processJS</a><br>
<br>
Please, donate <br>
<br>
<input type="hidden" name="cmd" value="_s-xclick"> <input
type="hidden" name="hosted_button_id" value="RA782FJ6V3ZE4"> <input
type="image"
src="https://www.paypalobjects.com/en_US/MX/i/btn/btn_donateCC_LG.gif"
border="0" name="submit" alt="PayPal - The safer, easier way to pay
online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
<br>
or contribute to improve it or use it without <i>any warranty</i>, just<br>
in the spirit to have a handy tool that could help!.<br>
<br>
</p>
<p>This script was developed by <a href="mailto:carlosru@factware.info">carlosru@factware.info
</a>, please use Fossil site. To rise bugs, and ask for a user to contribute to
the project.</p>
Z 8b0c94a61baa246e6774b0b8c22181ce