Wiki page
[home] by
carlosru
2013-10-16 21:19:04.
D 2013-10-16T21:19:04.719
L home
P e5aae41d9efe4553e7e3db3298b2d9ad791595b8
U carlosru
W 5946
<div><html></div>
<div><head></div>
<div><meta http-equiv="cache-control" content="no-cache"></div>
<div><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></div>
<div><style type="text/css"></div>
<div> body { font-family:arial, verdana}</div>
<div> .codigo{ color:#C00000;}
<span class="Apple-tab-span" style="white-space:pre"></span> </div>
<div></style></div>
<div></head></div>
<div><body ></div>
<div><div style="margin-left:50px;margin-right=50px;"></div>
<div><br /></div>
<div> <font color='blue'><h1
align="center">PreprecessorJS</h1></font></div>
<div> <br /></div>
<div> <p></div>
<div> PreprecessorJS is a simple parser to transform simple tokens into
&lt;script&gt;&lt;/script&gt; tags, and</div>
<div> rewrites the generated markup,or better said is a kind of
preprocessor like php, jsp, asp but using the native</div>
<div> javascript as language.</p></div>
<div> </div>
<div> <h2>Example:</h2></div>
<div> </div>
<div> 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.</div>
<div> You can change the pair of tokens inside the preprocessorJS.js
changing openToken,assignamentToken and closeToken variables.<br /></div>
<div> </div>
<div> <br /></div>
<div> <br /></div>
<div> So for example:<br /></div>
<div> <br /></div>
<div> <div class="codigo"></div>
<div> {? var name="Alice";<br /></div>
<div> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var where="in the
wonderland";<br /></div>
<div> ?}<br /></div>
<div> <br /></div>
<div> &lt;h2&gt;The book is {?=(name);?} &amp;nbsp;
{?=(where);?} &lt;/h2&gt;<br /></div>
<div> </div></div>
<div> <br /> </div>
<div> And the tokens are mixed and embeded in a html page, that will be
preprocessed loading<br /></div>
<div> the preprocessorJS.js javascript on the load event in the body tag
and calling changeIt() function.<br /></div>
<div> <br /></div>
<div> <div class="codigo"></div>
<div> &lt;head&gt;<br /></div>
<div> &lt;script src="./lib/preprocessorJS.js"
type="text/javascript"&gt;&lt;/script&gt;<br /></div>
<div> &lt;/head&gt;<br /></div>
<div><br /></div>
<div>&lt;body onload="changeIt();"&gt;</div><br /></div>
<div><br /></div>
<div>The resulted markup will be something like:<br /></div>
<div><div class="codigo">&lt;h2&gt;The book is Alice in the
wonderland&lt;/h2&gt;</div><br /></div>
<div><br /></div>
<div>You can also have very simple if-block like this<br /></div>
<div><div class="codigo"></div>
<div> {? if(name="Alice"){ ?};<br /></div>
<div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;Some
markup..&lt;/p&gt;<br /></div>
<div> {? } else { ?};<br /></div>
<div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;Other
markup...&lt;/p&gt;<br /></div>
<div> ?}<br /></div>
<div></div> </div>
<div><p></div>
<div> Finally in this version, you can have just GET parameters comming
from a HTML Form.</div>
<div> Using the array <b>parms['parName']</b> where 'parName'
is the parameter corresponding to the</div>
<div> name of the elements in your form.<br /></div>
<div> var name=</div>
<div> </div>
<div> <div class="codigo"></div>
<div> {? <br /></div>
<div> &nbsp;&nbsp;&nbsp;&nbsp;var
name=params['theName'];<br /></div>
<div> ?}<br /></div>
<div> </div></div>
<div> <br /></div>
<div> </div>
<div> <br /></div>
<div> This is licenced under Apache 2.0<br /></div>
<div> <br /></div>
<div> And the repository is a Fossil one on <a
href="https://chiselapp.com/user/carlosru/repository/processorjs">SCM
processJS</a><br /></div>
<div> <br /></div>
<div> Please, donate <br /><br /></div>
<div> <form action="https://www.paypal.com/cgi-bin/webscr"
method="post" target="_top"></div>
<div><input type="hidden" name="cmd" value="_s-xclick"></div>
<div><input type="hidden" name="hosted_button_id" value="RA782FJ6V3ZE4"></div>
<div><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!"></div>
<div><img alt="" border="0"
src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1"
height="1"></div>
<div></form> <br /> </div>
<div> or contribute to improve it or use it without <i>any
warranty</i>, just<br /></div>
<div> in the spirit to have a handy tool that could help!.<br /></div>
<div><br /> </div>
<div><p></div>
<div> This script was developed by <a
href="mailto:carlosru@factware.info">carlosru@factware.info </a>,
please use Fossil site.</div>
<div> To rise bugs, and ask for a user to contribute to the project.</div>
<div> </p></div>
<div></div></div>
<div></body></div>
<div></html></div><nowiki></nowiki>
Z da4f9323ef2d582bdaf0c1bcb6a2e1fc