mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-06-05 22:09:23 +02:00
Filename as title for untitled pages, title attr. adition, add TXT input pages + file formats fixes
This commit is contained in:
@ -32,7 +32,7 @@ def StripAttrs(HTML):
|
||||
t.attrs = {}
|
||||
return str(Soup)
|
||||
|
||||
def StripTags(HTML, ToStrip):
|
||||
def StripTags(HTML, ToStrip): # Remove desired tags from the HTML
|
||||
Soup = MkSoup(HTML)
|
||||
Tags = Soup.find_all()
|
||||
for t in Tags:
|
||||
@ -40,6 +40,14 @@ def StripTags(HTML, ToStrip):
|
||||
t.replace_with('')
|
||||
return str(Soup)
|
||||
|
||||
def ImgAltToTitle(HTML): # Adds title attr. to <img> which don't have it, but have alt text
|
||||
Soup = MkSoup(HTML)
|
||||
Tags = Soup.find_all('img')
|
||||
for t in Tags:
|
||||
if 'alt' in t.attrs and 'title' not in t.attrs:
|
||||
t.attrs.update({'title': t.attrs['alt']})
|
||||
return str(Soup)
|
||||
|
||||
def AddToTagStartEnd(HTML, MatchStart, MatchEnd, AddStart, AddEnd): # This doesn't handle nested tags
|
||||
StartPos = None
|
||||
for i,e in enumerate(HTML):
|
||||
|
Reference in New Issue
Block a user