|
5 | 5 |
|
6 | 6 | ESCAPE_WORDBREAK = "xWBRx" |
7 | 7 | ESCAPE_WHITESPACE = "xWHITESPACEx" |
| 8 | +ESCAPE_SHOW_ALL_BUTTON = "xSHOWALLBUTTONx" |
| 9 | +ESCAPE_HIDE_ALL_BUTTON = "xHIDEALLBUTTONx" |
8 | 10 |
|
9 | 11 | CSS = """\ |
10 | 12 | <style type="text/css"> |
|
62 | 64 | toggle_button.innerHTML = "Hide table"; |
63 | 65 | } |
64 | 66 |
|
| 67 | +function show_all_tables_in_section(section_id) { |
| 68 | + var section = document.getElementById(section_id); |
| 69 | + if (!section) return; |
| 70 | +
|
| 71 | + var tables = section.getElementsByTagName('table'); |
| 72 | + var buttons = section.getElementsByClassName('toggle-table'); |
| 73 | +
|
| 74 | + for (var i = 0; i < tables.length; i++) { |
| 75 | + tables[i].style.display = ""; |
| 76 | + } |
| 77 | + for (var i = 0; i < buttons.length; i++) { |
| 78 | + buttons[i].innerHTML = "Hide table"; |
| 79 | + } |
| 80 | +} |
| 81 | +
|
| 82 | +function hide_all_tables_in_section(section_id) { |
| 83 | + var section = document.getElementById(section_id); |
| 84 | + if (!section) return; |
| 85 | +
|
| 86 | + var tables = section.getElementsByTagName('table'); |
| 87 | + var buttons = section.getElementsByClassName('toggle-table'); |
| 88 | +
|
| 89 | + for (var i = 0; i < tables.length; i++) { |
| 90 | + tables[i].style.display = "none"; |
| 91 | + } |
| 92 | + for (var i = 0; i < buttons.length; i++) { |
| 93 | + buttons[i].innerHTML = "Show table"; |
| 94 | + } |
| 95 | +} |
| 96 | +
|
65 | 97 | function show_main_tables() { |
66 | 98 | var names = ["unexplained-errors", "info", "summary"]; |
67 | 99 | for (var i = 0; i < names.length; i++) { |
@@ -123,6 +155,24 @@ def _get_config(target): |
123 | 155 |
|
124 | 156 | config["postproc"].append([ESCAPE_WHITESPACE, r" "]) |
125 | 157 |
|
| 158 | + # Replace escaped show/hide all button markers with actual HTML |
| 159 | + config["postproc"].append( |
| 160 | + [ |
| 161 | + ESCAPE_SHOW_ALL_BUTTON + r"\{(.+?)\}", |
| 162 | + r'<button type="button" onclick="show_all_tables_in_section(' |
| 163 | + r"'\1')" |
| 164 | + r'">Show all tables</button>', |
| 165 | + ] |
| 166 | + ) |
| 167 | + config["postproc"].append( |
| 168 | + [ |
| 169 | + ESCAPE_HIDE_ALL_BUTTON + r"\{(.+?)\}", |
| 170 | + r'<button type="button" onclick="hide_all_tables_in_section(' |
| 171 | + r"'\1')" |
| 172 | + r'">Hide all tables</button>', |
| 173 | + ] |
| 174 | + ) |
| 175 | + |
126 | 176 | # Hide tables by default. |
127 | 177 | config["postproc"].append( |
128 | 178 | [ |
@@ -193,6 +243,8 @@ def _get_config(target): |
193 | 243 | config["postproc"].append([r"BEGINCOLOR(.*?)SEP(.*?)ENDCOLOR", r"\1"]) |
194 | 244 | config["postproc"].append([ESCAPE_WORDBREAK, r""]) |
195 | 245 | config["postproc"].append([ESCAPE_WHITESPACE, r" "]) |
| 246 | + config["postproc"].append([ESCAPE_SHOW_ALL_BUTTON + r"\{.+?\}", r""]) |
| 247 | + config["postproc"].append([ESCAPE_HIDE_ALL_BUTTON + r"\{.+?\}", r""]) |
196 | 248 |
|
197 | 249 | return config |
198 | 250 |
|
|
0 commit comments