Show a summary of a Django or Jinja template
Project description
summarize-template
Show a summary of a Django or Jinja template
Installation
Install this tool using pip
:
pip install summarize-template
Usage
You can run the command against a template file like this:
summarize-template path/to/template.html
The tool will output just the structural tags from the template.
Example
Given a template that looks like this:
{% extends "base.html" %}
{% block title %}This is the title{% endblock %}
{% block content %}
<h1>{{ title }}</h1>
{% if docs %}
<ul>
{% for doc in docs %}
<li><a href="{{ doc.url }}">{{ doc.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}
Running summarize-template
against it will produce the following:
{% extends "base.html" %}
{% block title %} {% endblock %}
{% block content %}
{{ title }}
{% if docs %}
{% for doc in docs %}
{{ doc.url }}{{ doc.title }}
{% endfor %}
{% endif %}
{% endblock %}
Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd summarize-template
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
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
summarize-template-0.1.tar.gz
(6.6 kB
view hashes)
Built Distribution
Close
Hashes for summarize_template-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90a76595649e55b6fecb223dcf52d2b2ec3da1664c97987af8af21c747564b3d |
|
MD5 | bfb7b8537742df3210df0699a1285fdd |
|
BLAKE2b-256 | 97c25316593da83fad5cd666544cc6973a2742b471ed72adc51de872f7273b12 |