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

need to retain space around inline, inline-block, and comment #151

Open
tisdall opened this issue Jan 20, 2021 · 0 comments
Open

need to retain space around inline, inline-block, and comment #151

tisdall opened this issue Jan 20, 2021 · 0 comments

Comments

@tisdall
Copy link
Contributor

tisdall commented Jan 20, 2021

Currently django-htmlmin retains space around inline text elements. However, there are other inline/inline-block elements that still render whitespace around them that are currently not handled. Also, comment removal takes spaces outside the comment with it.

examples:

>>> from htmlmin.minify import html_minify
>>> html_minify('''<img src="http://example.com/image.jpg" alt="example">  hi''')
'<html><head></head><body><img alt="example" src="http://example.com/image.jpg"/>hi</body></html>'
>>> html_minify('''name: <input type="text">''')
'<html><head></head><body>name:<input type="text"/></body></html>'
>>> html_minify('''<p>a <!-- --> b</p>''')
'<html><head></head><body><p>ab</p></body></html>'
>>> html_minify('''<em>a <!-- --> b</em>''')  # this works as `em` is a text context
'<html><head></head><body><em>a  b</em></body></html>'
>>> html_minify('''<button> click me  </button>  text after''')
'<html><head></head><body><button>click me</button>text after</body></html>'

Some of these can be fixed by adding attributes to TEXT_FLOW, but they aren't really text elements so naming would probably need adjusting.

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

No branches or pull requests

1 participant