Skip to main content

Show a summary of a Django or Jinja template

Project description

summarize-template

PyPI Changelog Tests License

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

This version

0.1

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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

summarize_template-0.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file summarize-template-0.1.tar.gz.

File metadata

  • Download URL: summarize-template-0.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for summarize-template-0.1.tar.gz
Algorithm Hash digest
SHA256 2c3159ac427e68cb217922356c6989c3332bde291f7342daedb9c2734cac80d2
MD5 788e6cc334062546bf91bf7441480617
BLAKE2b-256 90ce53f4ff60822aaad44fbe880abefa93a74e8de87b8df008a6b14baefa47b5

See more details on using hashes here.

File details

Details for the file summarize_template-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for summarize_template-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90a76595649e55b6fecb223dcf52d2b2ec3da1664c97987af8af21c747564b3d
MD5 bfb7b8537742df3210df0699a1285fdd
BLAKE2b-256 97c25316593da83fad5cd666544cc6973a2742b471ed72adc51de872f7273b12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page