Chromium Code Reviews| Index: native_client_sdk/src/doc/doxygen/doxy_cleanup.py |
| diff --git a/native_client_sdk/src/doc/doxygen/doxy_cleanup.py b/native_client_sdk/src/doc/doxygen/doxy_cleanup.py |
| index 491fd047109cd921e33a57fdc24882a13cdd16fe..8db9bd2e4a955c4a2338b56313e4dad815b0adab 100755 |
| --- a/native_client_sdk/src/doc/doxygen/doxy_cleanup.py |
| +++ b/native_client_sdk/src/doc/doxygen/doxy_cleanup.py |
| @@ -136,6 +136,40 @@ class HTMLFixer(object): |
| attrs={'class' : re.compile('^(header|tabs[0-9]*|navpath)$')}) |
| [tag.extract() for tag in header_tags] |
| + def RemoveSeparators(self): |
| + '''Removes separator rows from tables |
| + |
| + This seems to only exist in newer versions of doxygen (1.8). |
| + ''' |
| + separator_tags = self.soup.findAll( |
| + name='tr', |
| + attrs={'class': re.compile(r'^separator:.*$')}) |
| + [tag.extract() for tag in separator_tags] |
| + |
| + def FixFragments(self): |
| + '''''' |
|
Sam Clegg
2014/09/20 00:02:36
Is this also a doxygen version thing? Maybe menti
binji
2014/09/22 17:54:02
Done.
|
| + first = True |
| + fragments = self.soup.findAll(name='div', attrs={'class': 'fragment'}) |
| + for fragment in fragments: |
| + # Replace: |
| + # <div class="fragment"> |
| + # <div class="line">...</div> |
| + # |
| + # With: |
| + # <div class="fragment"> |
| + # ... |
| + lines = fragment.findAll(name='div', attrs={'class': 'line'}) |
| + for line in lines: |
| + line.replaceWithChildren() |
| + |
| + # Wrap the contents of the fragment in a <pre>, but only if it isn't |
| + # already there. |
| + if not fragment.pre: |
| + pre = Tag(self.soup, name='pre', attrs={'class': 'fragment'}) |
| + for el in reversed(fragment.contents): |
| + pre.insert(0, el.extract()) |
| + fragment.append(pre) |
| + |
| def RemoveVersionNumbers(self, html): |
| '''Horrible hack to strip _#_# from struct names.''' |
| return re.sub(r'(_\d_\d)(?=[": <])', '', html) |
| @@ -143,6 +177,8 @@ class HTMLFixer(object): |
| def FixAll(self): |
| self.FixTableHeadings() |
| self.RemoveTopHeadings() |
| + self.RemoveSeparators() |
| + self.FixFragments() |
| html = str(self.soup) |
| html = self.RemoveVersionNumbers(html) |
| return html |
| @@ -189,6 +225,7 @@ def main(argv): |
| # Now, fix the HTML files we've kept. |
| Trace('Fixing HTML files...') |
| for root, _, files in os.walk(root_dir): |
| + files.sort() |
| for filename in files: |
| if not os.path.splitext(filename)[1] == '.html': |
| Trace('Skipping %s' % filename) |