Metadata-Version: 2.0
Name: django-template-analyzer
Version: 1.4
Summary: Django Template Analyzer - Extract template nodes from a Django template
Home-page: https://github.com/edoburu/django-template-analyzer
Author: Diederik van der Boor & Django CMS developers
Author-email: opensource@edoburu.nl
License: BSD License
Download-URL: https://github.com/edoburu/django-template-analyzer/zipball/master
Platform: OS Independent
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Framework :: Django
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules

Introduction
============

The ``template_analyzer`` package offers an API to analyze the Django template structure.
It can be used to find nodes of a particular type, e.g. to do automatic detection of placeholder tags.

Supported features
==================

The scanner finds tags in various situations, including:

* Extend nodes
* Include nodes
* Overwritten blocks with new definitions
* Blocks with or without ``{{ block.super }}``
* Reorganized blocks
* Ignoring nodes outside blocks in extending templates
* Handling multiple levels of super includes

The returned nodes are provided in a natural ordering,
as they would be expected to appear in the outputted page.

While Django offers a ``template.nodelist.get_nodes_of_type()`` function,
this function does not produce the same results.


API example
===========

::

    from template_analyzer.djangoanalyzer import get_node_instances
    from mycms.templatetags.placeholdertags import Placeholder

    template = get_template("mycms/default-page.html")

    placeholders = get_node_instances(template, Placeholder)
    placeholder_names = [p.get_name() for p in placeholders]

Installation
============

First install the module, preferably in a virtual environment. It can be installed from PyPI::

    pip install django-template-analyzer

Or the current folder can be installed::

    pip install .

Changelog
=========

Version 1.1: added Django 1.4 compatibility.
Version 1.0: initial release.

Credits
=======

* This package is based on the work of
  `Django CMS <http://www.django-cms.org>`_. 
* Many thanks to the contributors of ``cms/utils/plugins.py`` in Django CMS!


