Repository navigation
Close empty elements in the cleaned HTML of user guides - #4
Merged
Merged
Conversation
clean_html and filter_changelog serialize with lxml's XML method, so an empty element such as `<i class="fas fa-crosshairs"></i>` (as used in the OpenLayers Map user guide) became `<i class="fas fa-crosshairs"/>`. The frontend inserts that code with innerHTML, where only void elements can be self-closing: the <i> wrapped the rest of the paragraph and the HTML parser reopened it in every following list item. Give empty non-void elements an explicit end tag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oxixes
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
clean_htmlandfilter_changelog(src/wirecloud/commons/utils/html.py) serialize the cleaned code with lxml's XML method, so an empty element is written self-closing. For example, the OpenLayers Map user guide includes<i class="fas fa-crosshairs"></i>, which is returned as<i class="fas fa-crosshairs"/>.The frontend inserts the user guide and the changelogs with
innerHTML. With the HTML parser only void elements can be self-closing, so that<i>stays open:The text still looks almost normal with Font Awesome, but it ends up inside the icon. A theme that gives icons a fixed size (such as the Industry theme in #2) shows the rest of the document squeezed into a one-word-wide column.
Empty non-void elements now get an explicit end tag (
<i class="…"></i>). Void elements (<br/>,<img/>…) keep their current serialization.Testing
test_clean_html_closes_empty_elements.pytest tests/commons/test_commons_utils_html.py tests/catalogue/: 50 passing.🤖 Generated with Claude Code