Skip to content

Commit bb98bbf

Browse files
authored
Ignore unneeded tags in diffs for direct_html (#1585)
Ignores two tags from in the html_diff. One of them docbook adds but we don't need and another one asciidoctor adds that we're ok with it adding.
1 parent f6c320c commit bb98bbf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

integtest/html_diff

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,19 @@ def normalize_html(html):
163163
parent = e.parent
164164
e.unwrap()
165165
parent.smooth()
166+
# Asciidoctor suppports adding a `<meta name="description"` if a book
167+
# defines a `:description:` attribute. Docbook doesn't. We're quite ok with
168+
# adding it but we can ignore it in the diff because, well, we don't need
169+
# to see it.
170+
for e in soup.select("meta[name='description']"):
171+
e.extract()
172+
# Docbook renders "indexterms" with an inline anchor and asciidoctor
173+
# doesn't. You can't see them and no one is linking to them and the links
174+
# don't really do anything. So we're ok ignoring them.
175+
for e in soup.select("a.indexterm"):
176+
parent = e.parent
177+
e.extract()
178+
parent.smooth()
166179

167180
# Remove empty "class" attributes and sort the listed classes.
168181
for e in soup.select('*'):

0 commit comments

Comments
 (0)