merge-requests/30/head
Bob Mottram 2020-10-11 11:31:26 +01:00
parent f3c1482e87
commit abcda1af1e
2 changed files with 1 additions and 17 deletions

View File

@ -31,20 +31,6 @@ def removeHtmlTag(htmlStr: str, tag: str) -> str:
return htmlStr return htmlStr
def setHtmlTag(htmlStr: str, tag: str, value: str) -> str:
"""Sets the value of a given tag from a html string
"""
matchStr = ' ' + tag + '="'
if matchStr not in htmlStr:
return htmlStr
sections = htmlStr.split(matchStr, 1)
if '"' not in sections[1]:
return htmlStr
htmlStr = sections[0] + matchStr + value + '"' + \
sections[1].split('"', 1)[1]
return htmlStr
def removeQuotesWithinQuotes(content: str) -> str: def removeQuotesWithinQuotes(content: str) -> str:
"""Removes any blockquote inside blockquote """Removes any blockquote inside blockquote
""" """

View File

@ -12,7 +12,6 @@ import datetime
from collections import OrderedDict from collections import OrderedDict
from newswire import getDictFromNewswire from newswire import getDictFromNewswire
from posts import createNewsPost from posts import createNewsPost
from content import setHtmlTag
from content import removeHtmlTag from content import removeHtmlTag
from content import dangerousMarkup from content import dangerousMarkup
from utils import loadJson from utils import loadJson
@ -135,8 +134,7 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str,
# remove image dimensions # remove image dimensions
if '<img' in rssDescription: if '<img' in rssDescription:
# set the width of the image rssDescription = removeHtmlTag(rssDescription, 'width')
rssDescription = setHtmlTag(rssDescription, 'width', '100px')
rssDescription = removeHtmlTag(rssDescription, 'height') rssDescription = removeHtmlTag(rssDescription, 'height')
followersOnly = False followersOnly = False