Skip to content

Commit da8a1a6

Browse files
committed
Preprocess: Remove invisible elements
1 parent 952fbb5 commit da8a1a6

File tree

4 files changed

+17
-444
lines changed

4 files changed

+17
-444
lines changed

commands/preprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def preprocess_html_file(root, fn, rename_map):
227227
for el in html.xpath('//*'):
228228
if has_class(el, ['noprint', 'editsection']):
229229
el.getparent().remove(el)
230-
if el.get('id') == 'toc':
230+
if el.get('id') in ['toc', 'catlinks']:
231231
el.getparent().remove(el)
232232

233233
# remove see also links between C and C++ documentations

commands/preprocess_cssless.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def preprocess_html_merge_cssless(src_path, dst_path):
3535

3636
output = preprocess_html_merge_css(root, src_path)
3737
strip_style_tags(root)
38+
remove_display_none(root)
3839
convert_span_tables_to_tr_td(root)
3940
convert_inline_block_elements_to_table(root)
4041
convert_zero_td_width_to_nonzero(root)
@@ -147,6 +148,11 @@ def wrap_element(el, tag_name, style):
147148
el.addprevious(new_el)
148149
new_el.insert(0, el)
149150

151+
def remove_display_none(root_el):
152+
for el in root_el.xpath('//*[contains(@style, "display")]'):
153+
if has_css_property_value(el, 'display', 'none'):
154+
el.getparent().remove(el)
155+
150156
def convert_span_tables_to_tr_td(root_el):
151157

152158
# note that the following xpath expressions match only the prefix of the

0 commit comments

Comments
 (0)