<commit_before>#####
Usage
#####

*************
Configuration
*************

In order to get started with django-sekizai, you'll need to do the following
steps:

* Put 'sekizai' into your ``INSTALLED_APPS`` setting.
* Use one of the following:
    * Put ``sekizai.context_processors.sekizai`` into your
      ``TEMPLATE_CONTEXT_PROCESSORS`` setting and use
      ``django.template.RequestContext`` when rendering your templates.
    * Use ``sekizai.context.SekizaiContext`` when rendering your templates.

**********************
Template Tag Reference
**********************
.. highlight:: html+django

.. note:: All sekizai template tags require the ``sekizai_tags`` template tag
          library to be loaded.
          

Handling code snippets
======================

Sekizai uses ``render_block`` and ``addtoblock`` to handle unique code snippets.
Define your blocks using ``{% render_block <name> %}`` and add data to that
block using ``{% addtoblock <name> %}...{% endaddotblock %}``.

Example Template::

    {% load sekizai %}
    
    <html>
    <head>
    {% render_block "css" %}
    </head>
    <body>
    Your content comes here.
    Maybe you want to throw in some css:
    {% addtoblock "css" %}
    <link href="/media/css/stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
    {% endaddtoblock %}
    Some more content here.
    {% addtoblock "js" %}
    <script type="text/javascript">
    alert("Hello django-sekizai");
    </script>
    {% endaddtoblock %}
    And even more content.
    {% render_block "js" %}
    <body>
    </html>
    
Above example would roughly render like this::

    <html>
    <head>
    <link href="/media/css/stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
    </head>
    <body>
    Your content comes here.
    Maybe you want to throw in some css:
    Some more content here.
    And even more content.
    <script type="text/javascript">
    alert("Hello django-sekizai");
    </script>
    <body>
    </html>


Handling data
=============

Sometimes you might not want to use code snippets but rather just add a value to
a list. For this purpose there are the
``{% with_data <name> as <varname> %}...{% end_with_data %}`` and
``{% add_data <name> <value> %}`` template tags.

Example::

    {% load sekizai %}
    
    <html>
    <head>
    {% with_data "css-data" as stylesheets %}
    {% for stylesheet in stylesheets %}
        <link href="{{ MEDIA_URL }}{{ stylesheet }}" media="screen" rel="stylesheet" type="text/css" />
    {% endfor %}
    {% end_with_data %}
    </head>
    <body>
    Your content comes here.
    Maybe you want to throw in some css:
    {% add_data "css-data" "css/stylesheet.css" %}
    Some more content here.
    <body>
    </html>
    
Above example would roughly render like this::

    <html>
    <head>
    <link href="/media/css/stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
    </head>
    <body>
    Your content comes here.
    Maybe you want to throw in some css:
    Some more content here.
    And even more content.
    <body><commit_msg>sekizai_tags instead of just sekizai in the docs<commit_after>#####
Usage
#####

*************
Configuration
*************

In order to get started with django-sekizai, you'll need to do the following
steps:

* Put 'sekizai' into your ``INSTALLED_APPS`` setting.
* Use one of the following:
    * Put ``sekizai.context_processors.sekizai`` into your
      ``TEMPLATE_CONTEXT_PROCESSORS`` setting and use
      ``django.template.RequestContext`` when rendering your templates.
    * Use ``sekizai.context.SekizaiContext`` when rendering your templates.

**********************
Template Tag Reference
**********************
.. highlight:: html+django

.. note:: All sekizai template tags require the ``sekizai_tags`` template tag
          library to be loaded.
          

Handling code snippets
======================

Sekizai uses ``render_block`` and ``addtoblock`` to handle unique code snippets.
Define your blocks using ``{% render_block <name> %}`` and add data to that
block using ``{% addtoblock <name> %}...{% endaddotblock %}``.

Example Template::

    {% load sekizai_tags %}
    
    <html>
    <head>
    {% render_block "css" %}
    </head>
    <body>
    Your content comes here.
    Maybe you want to throw in some css:
    {% addtoblock "css" %}
    <link href="/media/css/stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
    {% endaddtoblock %}
    Some more content here.
    {% addtoblock "js" %}
    <script type="text/javascript">
    alert("Hello django-sekizai");
    </script>
    {% endaddtoblock %}
    And even more content.
    {% render_block "js" %}
    <body>
    </html>
    
Above example would roughly render like this::

    <html>
    <head>
    <link href="/media/css/stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
    </head>
    <body>
    Your content comes here.
    Maybe you want to throw in some css:
    Some more content here.
    And even more content.
    <script type="text/javascript">
    alert("Hello django-sekizai");
    </script>
    <body>
    </html>


Handling data
=============

Sometimes you might not want to use code snippets but rather just add a value to
a list. For this purpose there are the
``{% with_data <name> as <varname> %}...{% end_with_data %}`` and
``{% add_data <name> <value> %}`` template tags.

Example::

    {% load sekizai_tags %}
    
    <html>
    <head>
    {% with_data "css-data" as stylesheets %}
    {% for stylesheet in stylesheets %}
        <link href="{{ MEDIA_URL }}{{ stylesheet }}" media="screen" rel="stylesheet" type="text/css" />
    {% endfor %}
    {% end_with_data %}
    </head>
    <body>
    Your content comes here.
    Maybe you want to throw in some css:
    {% add_data "css-data" "css/stylesheet.css" %}
    Some more content here.
    <body>
    </html>
    
Above example would roughly render like this::

    <html>
    <head>
    <link href="/media/css/stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
    </head>
    <body>
    Your content comes here.
    Maybe you want to throw in some css:
    Some more content here.
    And even more content.
    <body>
{'fraction_non_alphanumeric': 0.16133697573517597, 'fraction_numerical': 0.0, 'mean_word_length': 3.0786369593709044, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 77, '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': '3460402', 'n_tokens_mistral': 1987, 'n_tokens_neox': 1881, 'n_words': 620}