<commit_before>pyramid_layer
=============

.. image :: https://secure.travis-ci.org/fafhrd91/pyramid_layer.png 
  :target:  https://secure.travis-ci.org/fafhrd91/pyramid_layer

pyramid_layer allows to address templates with two parameters, 
category and name. Also it is possible to use set of directories
for each layer, in that case `pyramid_layer` searches templates
in each directory. It allows to override templates without changing
code. For example form library can define layer `field`::

     >> ls ./fields/
     .. bool.pt
     .. file.pt
     ...
     .. textarea.pt

In your application you can override any of this template by defining 
new layer for `field` category::

     >> ls ./myproject/fields/
     .. bool.pt

Usually top level directory is a category and file in directory is template.
For example 'form:view.lt'::

    `form` - layer category
    `view` - template name
    `.lt`  - custom pyramid renderer factory

Layer can to be defined with `add_layer` config directive::

    >> config = Configurator()
    .. config.include('pyramid_layer')
    ..
    .. config.add_layer('form', path='./path_to_form_dirctory/form/')

`form` directory can contain any template::

    >> ./form/
    ..   view.pt
    ..   actions.jinja2

It is possible to use any of this templates as pyramid renderer path::

    >> config.add_view(
    ..     name='view.html', 
    ..     renderer='form:view.l')

or ::

    >> config.add_view(
    ..     name='actions.html', 
    ..     renderer='form:actions.lt')


Customization
-------------

Any number of layer categories can be registered and any number of
layers can be registered in each category. It doesnt require to override 
all templates from category. For example it is possible to override just 
view.pt template::

    >> config.add_layer('form', 'custom', path='path_to_form_directory_2/form')

and content of this new directory::

    >> ./another_path/form/
    ..   view.jinja2

Now view `view.html` uses `view.jinja2` template. But `actions.html` stil
uses original template.

Another example, if you want customize `bool` field from ptah.form package
all you need is to create some folder, add it as 'fields' layer, and put
`bool.pt` template to this folder, something like that::

   >> config.add_layer('fields', 'custom', 'mypackage:/fields')

and ::

   >> .mypackage/fields/
   ..    bool.pt


Request method
--------------

`pyramid_layer` also provides request method `render_tmpl`. It acccepts
path::

   ..  ${structure: request.render_tmpl('form:actions')

`.l` extension is optional in this case.


player
-------

...


License
-------

pyramid_layer is offered under the BSD license.
<commit_msg>fix readme<commit_after>pyramid_layer
=============

.. image :: https://secure.travis-ci.org/fafhrd91/pyramid_layer.png 
  :target:  https://secure.travis-ci.org/fafhrd91/pyramid_layer

pyramid_layer allows to address templates with two parameters, 
category and name. Also it is possible to use set of directories
for each layer, in that case `pyramid_layer` searches templates
in each directory. It allows to override templates without changing
code. For example form library can define layer `field`::

     >> ls ./fields/
     .. bool.pt
     .. file.pt
     ...
     .. textarea.pt

In your application you can override any of this template by defining 
new layer for `field` category::

     >> ls ./myproject/fields/
     .. bool.pt

Usually top level directory is a category and file in directory is template.
For example 'form:view.lt'::

    `form` - layer category
    `view` - template name
    `.lt`  - custom pyramid renderer factory

Layer can to be defined with `add_layer` config directive::

    >> config = Configurator()
    .. config.include('pyramid_layer')
    ..
    .. config.add_layer('form', path='./path_to_form_dirctory/form/')

`form` directory can contain any template::

    >> ./form/
    ..   view.pt
    ..   actions.jinja2

It is possible to use any of this templates as pyramid renderer path::

    >> config.add_view(
    ..     name='view.html', 
    ..     renderer='form:view.lt')

or ::

    >> config.add_view(
    ..     name='actions.html', 
    ..     renderer='form:actions.lt')


Customization
-------------

Any number of layer categories can be registered and any number of
layers can be registered in each category. It doesnt require to override 
all templates from category. For example it is possible to override just 
view.pt template::

    >> config.add_layer('form', 'custom', path='path_to_form_directory_2/form')

and content of this new directory::

    >> ./another_path/form/
    ..   view.jinja2

Now view `view.html` uses `view.jinja2` template. But `actions.html` stil
uses original template.

Another example, if you want customize `bool` field from ptah.form package
all you need is to create some folder, add it as 'fields' layer, and put
`bool.pt` template to this folder, something like that::

   >> config.add_layer('fields', 'custom', 'mypackage:fields')

and ::

   >> .mypackage/fields/
   ..    bool.pt


Request method
--------------

`pyramid_layer` also provides request method `render_tmpl`. It acccepts
path::

   ..  ${structure: request.render_tmpl('form:actions')

`.lt` extension is optional in this case.


player
-------

...


License
-------

pyramid_layer is offered under the BSD license.

{'fraction_non_alphanumeric': 0.12467387253074916, 'fraction_numerical': 0.002981736861721953, 'mean_word_length': 2.9550478997789242, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 43, 'https://': 4, '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': '3976683', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1572, 'n_words': 559}