cobrateam / cobrateam/django-htmlmin

HTML space entities are changed into regular spaces

Open
#70 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Python
Stars
542
Forks
72
PR merge metrics
No merged PRs in 30d

Description

BeautifulSoup's formatter='html' should probably be used, although it would be nice not to have all unicode characters converted to entities.
Additionally, space between a button and a another tag like a link is lost.

Example source file:

<!DOCTYPE html>
<html>
<body>
    <p>A paragraph with a&nbsp;non-breakable space</p>
    <p>And&ensp;one&thinsp;with various&emsp;spaces</p>
    <a href="#">A link</a>
    <button>A button</button>
</body>
</html>

Minified output:

<!DOCTYPE html><html><head></head><body><p>A paragraph with a non-breakable space</p><p>And one with various spaces</p><a href="#">A link</a><button>A button</button></body></html>

Pictures (input on the left, output on the right):

capture d ecran 2014-03-01 02 35 09 capture d ecran 2014-03-01 02 35 24

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the HTML example and the minifier's BeautifulSoup formatter='html' path. Compare handling of  ,  ,  , and  , along with whitespace between the link and button. Done means the documented space entities and inter-element spacing are preserved as intended without converting every Unicode character to an entity.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.