Django Template Analyzer - Extract template nodes from a Django template
Project description
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.
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 .
Credits
This package is based on the work of Django CMS.
Many thanks to the contributors of cms/utils/plugins.py in Django CMS!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-template-analyzer-1.0.0.tar.gz
.
File metadata
- Download URL: django-template-analyzer-1.0.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f130ed864dc06e8f9f074ac79a997a8786e324b1f9e49ed4554ef47d48568650 |
|
MD5 | 151b11ee5270491ee79eba300d0e2e6b |
|
BLAKE2b-256 | a30f283f65d09e296eeec89e52f2ebea05ada0b075919caf751c3f73d6d21189 |