going-flying.com gemini git repository
512c2327eb08f828fea3493ab431fcedc5ddb3b5 - Matthew Ernisse - 1615045942
handle del
diff --git a/files/thoughts-to-gemini.py b/files/thoughts-to-gemini.py index 5750fab..9ea95f7 100755 --- a/files/thoughts-to-gemini.py +++ b/files/thoughts-to-gemini.py @@ -124,9 +124,14 @@ class DeHTMLizer(object): def parseTag(self, tag): - # So, of the tags that I believe we'll encounter that we - # actually want to print, p and blockquote can have children - # tags. + ''' Convert HTML tags into various plain-text formatted + elements. Handle nested blockquote and p tags and create + a list of links in self.links that can be used in any way + the caller desires. + + Strips style and script elements completely. Converts + blockquote to >, pre to ```, strong to ** and a few more. + ''' nestable = ['blockquote', 'p'] noprint = ['style', 'script'] @@ -139,6 +144,9 @@ class DeHTMLizer(object): return f'«{tag.string}»{sNum!s}' + elif tag.name == 'del': + return f'{tag.string}^W' + elif tag.name == 'pre': return f'```\n{tag.string}\n```'