<commit_before>===============================
Templated-docs
===============================


.. image:: https://img.shields.io/pypi/v/templated_docs.svg
        :target: https://pypi.python.org/pypi/templated_docs

.. image:: https://img.shields.io/travis/alexmorozov/templated-docs.svg
        :target: https://travis-ci.org/alexmorozov/templated-docs

.. image:: https://readthedocs.org/projects/templated-docs/badge/?version=latest
        :target: https://templated-docs.readthedocs.io/en/latest/?badge=latest
        :alt: Documentation Status

.. image:: https://requires.io/github/alexmorozov/templated-docs/requirements.svg?branch=master
        :target: https://requires.io/github/alexmorozov/templated-docs/requirements?branch=master
        :alt: Dependencies


Templated-docs generates templated documents within Django in any format supported by LibreOffice.


* Free software: MIT license
* Documentation: https://templated-docs.readthedocs.io.


Requirements
------------

* Django >= 1.9
* A recent LibreOffice version (>=4.3.0) supporting LibreOfficeKit API.
* (pylokit)[https://github.com/xrmx/pylokit] library to bridge to LibreOffice


Example usage
-------------

Create a `sample.odt` document (make sure it's in OpenDocument format) and
put it in your Django templates folder. It should look something like this:

.. image:: https://github.com/alexmorozov/templated-docs/raw/master/docs/document-template.png

Then write a view to generate documents from this template:

    ```python
    from templated_docs import fill_template
    from templated_docs.http import FileResponse

    def get_document(request):
        """
        A view to get a document filled with context variables.
        """
        context = {'user': request.user}  # Just an example

        filename = fill_template('sample.odt', context, output_format='pdf')
        visible_filename = 'greeting.pdf'

        return FileResponse(filename, visible_filename)
        ```

Navigate to the url your view is connected to, and you'll see a rendered and converted document:

.. image:: https://github.com/alexmorozov/templated-docs/raw/master/docs/generated-document.png

For more examples, see the `examples/` subfolder in the repository. Extensive documentation is available at https://templated-docs.readthedocs.io.

Credits
---------

Templated-docs was written by (<NAME>)[http://morozov.ca].
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage<commit_msg>Everything is great except my Markdown is Rst actually.<commit_after>===============================
Templated-docs
===============================


.. image:: https://img.shields.io/pypi/v/templated_docs.svg
        :target: https://pypi.python.org/pypi/templated_docs

.. image:: https://img.shields.io/travis/alexmorozov/templated-docs.svg
        :target: https://travis-ci.org/alexmorozov/templated-docs

.. image:: https://readthedocs.org/projects/templated-docs/badge/?version=latest
        :target: https://templated-docs.readthedocs.io/en/latest/?badge=latest
        :alt: Documentation Status

.. image:: https://requires.io/github/alexmorozov/templated-docs/requirements.svg?branch=master
        :target: https://requires.io/github/alexmorozov/templated-docs/requirements?branch=master
        :alt: Dependencies


Templated-docs generates templated documents within Django in any format supported by LibreOffice.


* Free software: MIT license
* Documentation: https://templated-docs.readthedocs.io.


Requirements
------------

* Django >= 1.9
* A recent LibreOffice version (>=4.3.0) supporting LibreOfficeKit API.
* Pylokit_ library to bridge to LibreOffice


Example usage
-------------

Create a ``sample.odt`` document (make sure it's in OpenDocument format) and
put it in your Django templates folder. It should look something like this:

.. image:: https://github.com/alexmorozov/templated-docs/raw/master/docs/document-template.png

Then write a view to generate documents from this template:

.. code-block:: python
    from templated_docs import fill_template
    from templated_docs.http import FileResponse

    def get_document(request):
        """
        A view to get a document filled with context variables.
        """
        context = {'user': request.user}  # Just an example

        filename = fill_template('sample.odt', context, output_format='pdf')
        visible_filename = 'greeting.pdf'

        return FileResponse(filename, visible_filename)

Navigate to the url your view is connected to, and you'll see a rendered and converted document:

.. image:: https://github.com/alexmorozov/templated-docs/raw/master/docs/generated-document.png

For more examples, see the ``examples/`` subfolder in the repository. Extensive documentation is available at https://templated-docs.readthedocs.io.

Credits
---------

Templated-docs was written by `<NAME>`_.

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
.. _pylokit: https://github.com/xrmx/pylokit
.. _`<NAME>`: http://morozov.ca
{'fraction_non_alphanumeric': 0.14410399257195913, 'fraction_numerical': 0.0018570102135561746, 'mean_word_length': 3.762157382847038, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, 'https://': 30, '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': '4167830', 'n_tokens_mistral': 1694, 'n_tokens_neox': 1608, 'n_words': 388}