understand links in html titles
This commit is contained in:
parent
435ab36525
commit
e388b4f49c
|
@ -5,9 +5,10 @@
|
|||
- timg is supported as an alternative to chafa (with a little glitch)
|
||||
- "cp cache" put the path of the cached content in clipboard
|
||||
- "cp url X" will copy the URL of link X (suggested by Eoin Carney)
|
||||
- HTML renderering of <pre> has been improved
|
||||
- "fold" has been removed as it doesn’t work well and can be replaced with "!fold".
|
||||
- Improved clipboard URL detection an fixed crash when binary in clipboard
|
||||
- HTML: renderering of <pre> has been improved
|
||||
- HTML: links in titles were previously missed
|
||||
- Fixed crash when chafa is not installed (Thanks Xavier Hinault for the report)
|
||||
- Fixed crash when python-readability not installed (Thanks Nic for the report)
|
||||
- Fixed some URL being wronlgy interpreted as IPv6
|
||||
|
|
10
offpunk.py
10
offpunk.py
|
@ -866,13 +866,15 @@ class HtmlRenderer(AbstractRenderer):
|
|||
rendered_body += div#.strip() (this strip doesn’t play well with centered images)
|
||||
rendered_body += "\n\n"
|
||||
elif element.name in ["h1","h2","h3","h4","h5","h6"]:
|
||||
line = sanitize_string(element.get_text())
|
||||
#line = sanitize_string(element.get_text())
|
||||
if element.name in ["h1","h2"]:
|
||||
rendered_body += "\n"+"\x1b[1;34m\x1b[4m" + line + "\x1b[0m"+"\n"
|
||||
title_tag = "\x1b[1;34m\x1b[4m"
|
||||
elif element.name in ["h3","h4"]:
|
||||
rendered_body += "\n" + "\x1b[34m" + line + "\x1b[0m" + "\n"
|
||||
title_tag = "\x1b[34m"
|
||||
else:
|
||||
rendered_body += "\n" + "\x1b[34m\x1b[2m" + line + "\x1b[0m" + "\n"
|
||||
title_tag = "\x1b[34m\x1b[2m"
|
||||
for child in element.children:
|
||||
rendered_body += "\n" + title_tag + recursive_render(child) + "\x1b[0m" + "\n"
|
||||
elif element.name in ["pre","code"]:
|
||||
rendered_body += "\n"
|
||||
for child in element.children:
|
||||
|
|
Loading…
Reference in New Issue