Skip to main content

Template Remover

https://badge.fury.io/py/template-remover.png https://travis-ci.org/deezer/template-remover.png?branch=master https://coveralls.io/repos/deezer/template-remover/badge.png?branch=master

Template remover is a tool to remove the PHP and Jinja markup from HTML files.

Motivation

Many tools, like html tidy, are designed to parse and analyze html files, however they do not play well when there is language markup. This projects aims to be a simple way of getting rid of those markups.

Limitations

template_remover is based on regular expressions. This means that there are some edge cases that cannot be captured with this method. Although we believe those cases are too contrived, and probably should be avoided as many development tools will fail as well.

One example that won’t work is the following::

<?php echo "?>" ?>

The reason it does not work is because when the method sees the first ‘?>’ (the one inside the string), it thinks it’s a closing tag.

Example use

Below are example of how template_remover.py is used:

$ remove_template.py filename.html
$ remove_template.py filename.html | tidy -qe

Installation

You can install, upgrade or uninstall template-remover with these commands:

$ pip install template-remover
$ pip install --upgrade template-remover
$ pip uninstall template-remover

Python Versions

Python 2.7 is officially supported, 3.2, 3.3 and 3.4 should also work.

Development

Help for this project is more than welcomed, so feel free to create an issue or to send a pull request via http://github.com/deezer/template-remover.

Tests are run using nose, either with:

$ python -R setup.py nosetests
$ nosetests

Use the tool git-lint before any commit, so errors and style problems are caught early.

TODOS and Possible Features

  • Support more template engines and languages (Smarty, ASP, JSP, etc).

Changelog

v0.1 (2014-05-07)

  • Initial commit.

Metadata

Release files for template-remover 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for template-remover 0.1.9
File Size Uploaded Provenance
template-remover-0.1.9.tar.gz 7.1 kB Without provenance Details

Release files / template-remover-0.1.9.tar.gz

Download URL template-remover-0.1.9.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
480f1ce63f56affac1edb29356afcca1260e8409cd928fcf9438fc149df5ff41
BLAKE2b-256 checksum
How to use checksums
3489e440ff92cd0de37dbd7d7660fe75bb29e8674dae56bd2e20ab2ef3e377c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for template-remover 0.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page