mirror of https://gitlab.com/bashrc2/epicyon
Remove html from news items imported from rss
parent
24effb0929
commit
ff15cea822
|
@ -26,6 +26,7 @@ from posts import archivePostsForPerson
|
||||||
from content import removeHtmlTag
|
from content import removeHtmlTag
|
||||||
from content import dangerousMarkup
|
from content import dangerousMarkup
|
||||||
from content import validHashTag
|
from content import validHashTag
|
||||||
|
from utils import removeHtml
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
|
@ -506,14 +507,7 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
rssDescription = ''
|
rssDescription = ''
|
||||||
|
|
||||||
# get the rss description if it exists
|
# get the rss description if it exists
|
||||||
rssDescription = _removeControlCharacters(item[4])
|
rssDescription = '<p>' + removeHtml(item[4]) + '<p>'
|
||||||
if rssDescription.startswith('<![CDATA['):
|
|
||||||
rssDescription = rssDescription.replace('<![CDATA[', '')
|
|
||||||
rssDescription = rssDescription.replace(']]>', '')
|
|
||||||
rssDescription = rssDescription.replace(']]', '')
|
|
||||||
if '&' in rssDescription:
|
|
||||||
rssDescription = html.unescape(rssDescription)
|
|
||||||
rssDescription = '<p>' + rssDescription + '<p>'
|
|
||||||
|
|
||||||
mirrored = item[7]
|
mirrored = item[7]
|
||||||
postUrl = url
|
postUrl = url
|
||||||
|
@ -526,20 +520,9 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
postUrl += '/index.html'
|
postUrl += '/index.html'
|
||||||
|
|
||||||
# add the off-site link to the description
|
# add the off-site link to the description
|
||||||
if rssDescription and \
|
rssDescription += \
|
||||||
not dangerousMarkup(rssDescription, allowLocalNetworkAccess):
|
'<br><a href="' + postUrl + '">' + \
|
||||||
rssDescription += \
|
translate['Read more...'] + '</a>'
|
||||||
'<br><a href="' + postUrl + '">' + \
|
|
||||||
translate['Read more...'] + '</a>'
|
|
||||||
else:
|
|
||||||
rssDescription = \
|
|
||||||
'<a href="' + postUrl + '">' + \
|
|
||||||
translate['Read more...'] + '</a>'
|
|
||||||
|
|
||||||
# remove image dimensions
|
|
||||||
if '<img' in rssDescription:
|
|
||||||
rssDescription = removeHtmlTag(rssDescription, 'width')
|
|
||||||
rssDescription = removeHtmlTag(rssDescription, 'height')
|
|
||||||
|
|
||||||
followersOnly = False
|
followersOnly = False
|
||||||
# NOTE: the id when the post is created will not be
|
# NOTE: the id when the post is created will not be
|
||||||
|
|
Loading…
Reference in New Issue