Artifact Content

Artifact 5525037040f36a0160a47088e30ce0e5d71750a8:

Wiki page [home] by carlosru 2013-10-18 18:34:52.
D 2013-10-18T18:34:52.689
L home
N text/x-markdown
P 46a7ebeebed1a0d151f00cb26490b509495c295f
U carlosru
W 3998
<head>
<style type="text/css">
    body { font-family:arial, verdana}
  .codigo{ color:#C00000;}	   
</style>
</head>
<body >
<div style="margin-left:50px;margin-right=50px;">
<br />
 <font color='blue'><h1 align="center">PreprecessorJS</h1></font>
 <br />
 <p>
 PreprecessorJS is a simple parser to transform simple tokens into &lt;script&gt;&lt;/script&gt; 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>
 Download : <a href="https://chiselapp.com/user/carlosru/repository/processorjs/zip/PreprocessorJS-c1cde28b68daac9c.zip?uuid=c1cde28b68daac9ce7dde6cb0e205cd3caea4b3a">PreprocessorJS Zip File</a>
 Download : <a href="https://chiselapp.com/user/carlosru/repository/processorjs/tarball/PreprocessorJS-c1cde28b68daac9c.tar.gz?uuid=c1cde28b68daac9ce7dde6cb0e205cd3caea4b3a">PreprocessorJS tar.gz File</a>
<br />
 <h2>Example:</h2>
 
 The default pair of tokens used for <font color="#009966">preprocessorJS</font> (PJS) are <b>"{?" and "?}" </b> and for assignament <b>{?=(<nowiki>[JavascriptVar]</nowiki>) ?}</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 />
 <br />
 So for example:<br />
 <br />
 <div class="codigo">
 {?  var name="Alice";<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var where="in the wonderland";<br />
 ?}<br />
 <br />
 &lt;h2&gt;The book is {?=(name);?} &amp;nbsp; {?=(where);?} &lt;/h2&gt;<br />
 </div>
 <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 />
 <div class="codigo">
 &lt;head&gt;<br />
  &lt;script src="./lib/preprocessorJS.js" type="text/javascript"&gt;&lt;/script&gt;<br />
 &lt;/head&gt;<br />
<br />
&lt;body onload="changeIt();"&gt;</div><br />
<br />
The resulted markup will be something like:<br />
<div class="codigo">&lt;h2&gt;The book is Alice in the wonderland&lt;/h2&gt;</div><br />
<br />
You can also have very simple if-block like this<br />
<div class="codigo">
 {?  if(name="Alice"){ ?};<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;Some markup..&lt;/p&gt;<br />
 {?  } else { ?};<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;Other markup...&lt;/p&gt;<br />
 ?}<br />
</div> 
<p>
 Finally in this version, you can have just GET parameters comming from a HTML Form.
 Using the array <b>parms['parName']</b> where 'parName' is the parameter corresponding to the
 name of the elements in your form.<br />
 var name=
 
 <div class="codigo">
 {?  <br />
   &nbsp;&nbsp;&nbsp;&nbsp;var name=params<nowiki>['theName']</nowiki>;<br />
 ?}<br />
 </div>
 <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 />
 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<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">
</form> <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>
 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>
</div>
</body>
</nowiki>
Z 68d59980552dc1c2da631cba38eba65d