diff options
author | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2012-10-25 09:44:32 -0700 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2012-10-25 09:44:32 -0700 |
commit | fcd91ca5bb660d015cdab902271d3af8acb8ced6 (patch) | |
tree | 443cb251d9bc6d208d425bd1e18c782a038293ba | |
parent | 93365e10d31d7f286992cae8eb7880dd7d3b9046 (diff) | |
download | rel-html-fcd91ca5bb660d015cdab902271d3af8acb8ced6.tar.gz |
rel-html: add about print support
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
-rw-r--r-- | html/template.html | 2 | ||||
-rwxr-xr-x | rel-html.py | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/html/template.html b/html/template.html index ab03a06..aa1048b 100644 --- a/html/template.html +++ b/html/template.html @@ -75,7 +75,7 @@ </article> <aside> - <h3>aside</h3> + <h3 id="about"></h3> <!-- [html] about-title = some fancy title diff --git a/rel-html.py b/rel-html.py index b27771c..df4c22d 100755 --- a/rel-html.py +++ b/rel-html.py @@ -191,9 +191,13 @@ class rel_html_gen(HTMLParser): sys.stdout.write('\t\t\t\t</tr>') sys.stdout.write('\t\t\t</table>\n') + def handle_h1_about(self, tag, attributes): + self.skip_endtag = True + sys.stdout.write('%s</h1>\n' % (self.parser.html_about_title)) + sys.stdout.write('<p>%s</p>\n' % (self.parser.html_about)) def handle_h1_pass(self, tag, attributes): pass - def handle_h1(self, tag, attributes): + def handle_h(self, tag, attributes): def_run = self.handle_h1_pass for name, value in attributes: @@ -202,6 +206,8 @@ class rel_html_gen(HTMLParser): def_run = self.handle_h1_top elif (value == 'release_title'): def_run = self.handle_h1_release + elif (value == 'about'): + def_run = self.handle_h1_about sys.stdout.write('<%s' % tag) for name, value in attributes: @@ -221,8 +227,8 @@ class rel_html_gen(HTMLParser): self.skip_endtag = False if (tag == 'title'): self.handle_title(tag, attributes) - elif (tag == 'h1'): - self.handle_h1(tag, attributes) + elif (tag in {'h1', 'h2', 'h3'}): + self.handle_h(tag, attributes) else: self.handle_def_start(tag, attributes) def handle_endtag(self, tag): |