adding highlight and anchor links
This commit is contained in:
parent
38e702923c
commit
bbc6e1a627
|
@ -395,9 +395,22 @@ class HTML2Text(HTMLParser.HTMLParser):
|
||||||
self.inheader = True
|
self.inheader = True
|
||||||
self.o(hn(tag)*"#" + ' ')
|
self.o(hn(tag)*"#" + ' ')
|
||||||
else:
|
else:
|
||||||
|
if attrs.get('id', False): self.o('{#' + attrs.get['id'] + '}')
|
||||||
self.inheader = False
|
self.inheader = False
|
||||||
return # prevent redundant emphasis marks on headers
|
return # prevent redundant emphasis marks on headers
|
||||||
|
|
||||||
|
if tag == 'span' and 'class' in attrs:
|
||||||
|
if attrs['class'] == 'highlight':
|
||||||
|
if start:
|
||||||
|
self.o('`')
|
||||||
|
else:
|
||||||
|
self.o('`')
|
||||||
|
elif attrs['class'] == 'lead':
|
||||||
|
if start:
|
||||||
|
self.o(self.strong_mark)
|
||||||
|
else:
|
||||||
|
self.o(self.strong_mark)
|
||||||
|
|
||||||
if tag in ['p', 'div']:
|
if tag in ['p', 'div']:
|
||||||
if self.google_doc:
|
if self.google_doc:
|
||||||
if start and google_has_height(tag_style):
|
if start and google_has_height(tag_style):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user