From bbc6e1a6277729f6cdddb807cea4a7270d3e2cf9 Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 10 Oct 2021 15:36:17 +0300 Subject: [PATCH] adding highlight and anchor links --- migration/html2text.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/migration/html2text.py b/migration/html2text.py index 4882c691..9ebff9c7 100644 --- a/migration/html2text.py +++ b/migration/html2text.py @@ -395,8 +395,21 @@ class HTML2Text(HTMLParser.HTMLParser): self.inheader = True self.o(hn(tag)*"#" + ' ') else: + if attrs.get('id', False): self.o('{#' + attrs.get['id'] + '}') self.inheader = False 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 self.google_doc: