<commit_before>DomTal
======

A TAL template parser for javascript.

copyright (c) 2005-2012 Iván -DrSlump- Montes <http://pollinimini.net>


Credits
-------

   - The script originated from work by <NAME> <http://www.heute-morgen.de/test/About_DOMTAL.html>
 
Known issues
------------

  - This script uses the own browser to parse the html, so you must be carefull 
    with the validity of the code. A common mistake is to use the short syntax 
    `<tag />` for elements which shouldn't according to the standard.
    It's always a good idea to use the full syntax (except for `<br/>` and `<hr/>`) 
    even when no content is defined.

  - In Internet Explorer the tal attributes (processors) can't be removed from
    the generated code although this shouldn't affect anything.

Differences with standard TAL
-----------------------------

  - The default tales prefix/modifier is _js_, which resolves a basic javascript
    statement instead of a simple path to a variable.
  - No support for `tal:block` element.
  - No support for `tal:on-error` processor.
  - No support for `Metal`, however a similar behaviour can be mimicked with
    document fragments and common tal processors.
  - `omit-tag` works a bit differently. If the tales expression evaluates to true 
    the tag is removed and its contents shown, otherwise the tag is also shown.
    This is an intended change and can be easily removed by creating a custom
    wrapper for this processor.


TODO
----

 - Check for performance bottlenecks and memory leaks

-----------------------------------------------------------------------------

Usage
=====

First we need to have a template somewhere in the page. Be it as an html
string, a containing element or a document fragment.

     <div id="myTemplate" style="display: none">
         <table>
         <tr>
             <th>Username</th>
             <th>E-Mail</th>
         </tr>
         <tr tal:repeat="user users"
             tal:attributes="class js:${repeat.user.odd}?'odd':'even'">
             <td tal:content="user.name"></td>
             <td>${user.email}</td>
         </tr>
         </table>
     </div>

we could also use an html string, either as a javascript string literal or
by using the script tag

     <script type="template/domtal" id="myTemplate"><![CDATA[
     <table>
     <tr>
         <th>Username</th>
         <th>E-Mail</th>
     </tr>
     <tr tal:repeat="user users"
         tal:attributes="class js:${repeat.user.odd}?'odd':'even'">
         <td tal:content="user.name"></td>
         <td>${user.email}</td>
     </tr>
     </table>
     ]]></script>

next we need to create the template object and set the apropiate data. Note
that we can create the data set anyway we want, even loading it with JSON or
similar remoting methods.

     var tpl = new DomTal();
     tpl->set( 'users', [{
       name: '<NAME>',
       email: '<EMAIL>'
     }, {
       name: '<NAME>',
       email: '<EMAIL>'
     }]);

now we just need to assign our template to the parser, process it and get
the result

     tpl.load( document.getElementById('myTemplate') );
     var out = tpl.run();
     // put the result on the page
     document.getElmentById('outUsers').appendChild( out );

And that's it. There a few more options but overall it's a pretty easy to
use library.
<commit_msg>Fixed typo in readme<commit_after>DomTal
======

A TAL template parser for javascript.

copyright (c) 2005-2012 Iván -DrSlump- Montes <http://pollinimini.net>


Credits
-------

   - The script originated from work by <NAME> <http://www.heute-morgen.de/test/About_DOMTAL.html>
 
Known issues
------------

  - This script uses the own browser to parse the html, so you must be carefull 
    with the validity of the code. A common mistake is to use the short syntax 
    `<tag />` for elements which shouldn't according to the standard.
    It's always a good idea to use the full syntax (except for `<br/>` and `<hr/>`) 
    even when no content is defined.

  - In Internet Explorer the tal attributes (processors) can't be removed from
    the generated code although this shouldn't affect anything.

Differences with standard TAL
-----------------------------

  - The default tales prefix/modifier is _js_, which resolves a basic javascript
    statement instead of a simple path to a variable.
  - No support for `tal:block` element.
  - No support for `tal:on-error` processor.
  - No support for `Metal`, however a similar behaviour can be mimicked with
    document fragments and common tal processors.
  - `omit-tag` works a bit differently. If the tales expression evaluates to true 
    the tag is removed and its contents shown, otherwise the tag is also shown.
    This is an intended change and can be easily removed by creating a custom
    wrapper for this processor.


TODO
----

 - Check for performance bottlenecks and memory leaks

-----------------------------------------------------------------------------

Usage
=====

First we need to have a template somewhere in the page. Be it as an html
string, a containing element or a document fragment.

     <div id="myTemplate" style="display: none">
         <table>
         <tr>
             <th>Username</th>
             <th>E-Mail</th>
         </tr>
         <tr tal:repeat="user users"
             tal:attributes="class js:${repeat.user.odd}?'odd':'even'">
             <td tal:content="user.name"></td>
             <td>${user.email}</td>
         </tr>
         </table>
     </div>

we could also use an html string, either as a javascript string literal or
by using the script tag

     <script type="template/domtal" id="myTemplate"><![CDATA[
     <table>
     <tr>
         <th>Username</th>
         <th>E-Mail</th>
     </tr>
     <tr tal:repeat="user users"
         tal:attributes="class js:${repeat.user.odd}?'odd':'even'">
         <td tal:content="user.name"></td>
         <td>${user.email}</td>
     </tr>
     </table>
     ]]></script>

next we need to create the template object and set the apropiate data. Note
that we can create the data set anyway we want, even loading it with JSON or
similar remoting methods.

     var tpl = new DomTal();
     tpl.set( 'users', [{
       name: '<NAME>',
       email: '<EMAIL>'
     }, {
       name: '<NAME>',
       email: '<EMAIL>'
     }]);

now we just need to assign our template to the parser, process it and get
the result

     tpl.load( document.getElementById('myTemplate') );
     var out = tpl.run();
     // put the result on the page
     document.getElmentById('outUsers').appendChild( out );

And that's it. There a few more options but overall it's a pretty easy to
use library.

{'fraction_non_alphanumeric': 0.1400480336235365, 'fraction_numerical': 0.0024016811768237767, 'mean_word_length': 2.3549848942598186, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 90, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7497271', 'n_tokens_mistral': 1926, 'n_tokens_neox': 1819, 'n_words': 773}