Git Product home page Git Product logo

template-remover's Introduction

Template Remover

image

image

image

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.

template-remover's People

Watchers

John Vandenberg avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.