Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge updates from previous PRs; as well as py3 compat fixes #16

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

eli-collins
Copy link

@eli-collins eli-collins commented May 20, 2017

This PR contains a big bundle of changes:

  • rolls up pretty much all the prior PRs at this time.
  • adds some py3 fixes on top of them
  • adds a setup.py file so wheels can be built
  • splits tests out into separate file, adds proper unittests
  • adds environment.policy support, so HTMLCompress 'globally strip' mode can be disabled (potentially eliminating need for SelectiveHTMLCompress)
  • adds {% strip [true|false] %} .. {% endstrip %} syntax, so certain blocks can be explicitly enabled/disabled.
  • large refactor of the parsing code to handle some edge cases from the issues
  • tried to make html entity tables roughly match HTML5 spec.

I'm going to be using this a bit in production, so if/until this is merged, will try to keep my branch up to date. Update: After exploring how to enhance this extension further, I ran into a number of architectural obstacles, and decided that using jinja's lstrip_blocks & trim_blocks flags will probably be overall easier for me to deploy, despite those flags' "all or nothing" behavior.

@eli-collins eli-collins force-pushed the master branch 2 times, most recently from b92dc99 to bc5c049 Compare May 22, 2017 14:29
updates constants to match HTML5 spec, reworked leave_tag() for clarity.
simplifies a bunch of the code, and consolidates parser state in one place.
now aware of "block" vs "inline" elements, and preserves 1 space
around inline elements, to prevent layout errors.  additionally,
tries to use more information about parsing state in order to only strip
spaces where it won't potentially cause a syntax error once rendered.

this also moves the brunt of normalize() into an internal generator function, _feed()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants