<commit_before>Syntax {@name=syntax}
==============================

A Mako template is parsed from a text stream containing any kind of content, XML, HTML, email text, etc.  The template can further contain Mako-specific directives which represent variable and/or expression substitutions, control structures (i.e. conditionals and loops), server-side comments, full blocks of Python code, as well as various tags that offer additional functionality.  All of these constructs compile into real Python code.  This means that you can leverage the full power of Python in almost every aspect of a Mako template.

### Expression Substiution

The simplest expression is just a variable substitution.  The syntax for this is the `${}` construct, which is inspired by Perl, Genshi, JSP EL, and others:

    this is x: ${x}

Above, the string representation of `x` is applied to the template's output stream.  If you're wondering where `x` comes from, its usually from the `Context` supplied to the template's rendering function.  If `x` was not supplied to the template and was not otherwise assigned locally, it evaluates to a special value `UNDEFINED`.  More on that later.
    
The contents within the `${}` tag are evaluated by Python directly, so full expressions are OK:

    pythagorean theorem:  ${pow(x,2) + pow(y,2)}
    
The results of the expression are evaluated into a string result in all cases before being rendered to the output stream, such as the above example where the expression produces a numeric result.<commit_msg>oops, wrong branch. merge r363 from brnaches/jython<commit_after>Syntax {@name=syntax}
==============================

A Mako template is parsed from a text stream containing any kind of content, XML, HTML, email text, etc.  The template can further contain Mako-specific directives which represent variable and/or expression substitutions, control structures (i.e. conditionals and loops), server-side comments, full blocks of Python code, as well as various tags that offer additional functionality.  All of these constructs compile into real Python code.  This means that you can leverage the full power of Python in almost every aspect of a Mako template.

### Expression Substitution

The simplest expression is just a variable substitution.  The syntax for this is the `${}` construct, which is inspired by Perl, Genshi, JSP EL, and others:

    this is x: ${x}

Above, the string representation of `x` is applied to the template's output stream.  If you're wondering where `x` comes from, its usually from the `Context` supplied to the template's rendering function.  If `x` was not supplied to the template and was not otherwise assigned locally, it evaluates to a special value `UNDEFINED`.  More on that later.
    
The contents within the `${}` tag are evaluated by Python directly, so full expressions are OK:

    pythagorean theorem:  ${pow(x,2) + pow(y,2)}
    
The results of the expression are evaluated into a string result in all cases before being rendered to the output stream, such as the above example where the expression produces a numeric result.
{'fraction_non_alphanumeric': 0.07439613526570048, 'fraction_numerical': 0.0022544283413848632, 'mean_word_length': 4.576301615798923, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '214884', 'n_tokens_mistral': 757, 'n_tokens_neox': 720, 'n_words': 451}