[gtk-doc] tools/c10e-html: run fixup conditionally
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] tools/c10e-html: run fixup conditionally
- Date: Thu, 10 May 2018 19:43:14 +0000 (UTC)
commit fed55be5678cc8b609e5def1e65c3e985cac8f49
Author: Stefan Sauer <ensonic users sf net>
Date: Thu May 10 19:23:23 2018 +0200
tools/c10e-html: run fixup conditionally
We only want to run this on the html files.
tools/c10e-html.py | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/tools/c10e-html.py b/tools/c10e-html.py
index a568125..f020f67 100755
--- a/tools/c10e-html.py
+++ b/tools/c10e-html.py
@@ -13,36 +13,37 @@ import sys
from bs4 import BeautifulSoup
-def prettify(filename):
+def prettify(filename, parser='lxml', fixup=False):
with open(filename, 'r') as doc:
- soup = BeautifulSoup(doc.read(), 'lxml')
+ soup = BeautifulSoup(doc.read(), parser)
with open(filename, 'w') as doc:
html = soup.prettify()
- # strip things that mkhtml2 is not producing to reduce the diff
- html = html.replace('a class="link" href', 'a href')
- html = html.replace(' target="_top"', '')
- html = html.replace('summary="Navigation header" ', '')
- html = html.replace(""" <a name="idx">
+ if fixup:
+ # strip things that mkhtml2 is not producing to reduce the diff
+ html = html.replace('a class="link" href', 'a href')
+ html = html.replace(' target="_top"', '')
+ html = html.replace('summary="Navigation header" ', '')
+ html = html.replace(""" <a name="idx">
</a>
""", '')
- html = re.sub(""" <div class="footer">
+ html = re.sub(""" <div class="footer">
<hr/>
Generated by GTK-Doc V[.0-9]*
</div>
""", '', html)
- html = re.sub(r'\s*<p>\s*</p>', '', html)
- html = re.sub(r'\s*<a name="id-[.0-9]+">\s*</a>', '', html)
- html = re.sub(r'\s*<div class="titlepage">\s*</div>', '', html)
- html = re.sub(r'\s*<meta content="DocBook[^>]*>', '', html)
- html = re.sub(r'\s*<meta content="GTK-Doc[^>]*>', '', html)
+ html = re.sub(r'\s*<p>\s*</p>', '', html)
+ html = re.sub(r'\s*<a name="id-[.0-9]+">\s*</a>', '', html)
+ html = re.sub(r'\s*<div class="titlepage">\s*</div>', '', html)
+ html = re.sub(r'\s*<meta content="DocBook[^>]*>', '', html)
+ html = re.sub(r'\s*<meta content="GTK-Doc[^>]*>', '', html)
doc.write(html)
def main(htmldir):
for filename in glob.glob(os.path.join(htmldir, '*.devhelp2')):
- prettify(filename)
+ prettify(filename, parser='lxml-xml')
for filename in glob.glob(os.path.join(htmldir, '*.html')):
- prettify(filename)
+ prettify(filename, fixup=True)
if __name__ == '__main__':
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]