Some markdown patches

This commit is contained in:
2022-07-29 18:12:13 +02:00
parent f62a26eb33
commit fb02893d21
8 changed files with 76 additions and 32 deletions

View File

@ -10,27 +10,9 @@
# TODO: Write the Python HTML2Gemtext converter
from Libs.bs4 import BeautifulSoup
from Modules.HTML import *
from Modules.Utils import *
"""
ClosedTags = (
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'p', 'span', 'pre', 'code',
'a', 'b', 'i', 'del', 'strong',
'div', 'details', 'summary',
'ol', 'ul', 'li', 'dl', 'dt', 'dd')
OpenTags = (
'img')
"""
def StripAttrs(HTML):
Soup = BeautifulSoup(HTML, 'html.parser')
Tags = Soup.find_all()
for t in Tags:
if 'href' not in t.attrs and 'src' not in t.attrs:
t.attrs = {}
return str(Soup)
def FixGemlogDateLine(Line):
if len(Line) >= 2 and Line[0] == '[' and Line[1].isdigit():
Line = Line[1:]