Fix parsing of <time> tag and add extra handling for html tags.

This commit is contained in:
2026-04-18 10:18:59 -04:00
parent 0766f23220
commit 410558fc5b
2 changed files with 25 additions and 20 deletions

View File

@@ -258,10 +258,12 @@ class Sections:
for code in codes:
strItem=strItem.replace(code,"'")
strItem=strItem.replace("&amp;","&")
strItem=strItem.replace("&#x2018;","'")
strItem=strItem.replace("&#x2019;","'")
strItem=strItem.replace("&#x2018;","")
strItem=strItem.replace("&#x2019;","")
strItem=strItem.replace("&#x2014;","-")
strItem=strItem.replace("&#39;","'")
strItem=strItem.replace("???","'")
strItem=strItem.replace("&quot;","\"")
return strItem
def pad(str,filler,length):

View File

@@ -26,29 +26,34 @@ class StringHelper:
def betweenString(strItem, strBegin, strEnd):
if strItem is None:
return None
index=-1
index = -1
if strBegin is None:
index=0
index = 0
else:
index = strItem.index(strBegin)
if -1==index:
try:
if strBegin.startswith("<") and strBegin.endswith(">"):
tag_name = strBegin[1:-1] # e.g. "time"
index = strItem.index("<" + tag_name)
index = strItem.index(">", index) + 1
else:
index = strItem.index(strBegin) + len(strBegin)
except ValueError:
return None
if index == -1:
return None
str=None
if strBegin is not None:
str=strItem[index+len(strBegin):]
else:
str=strItem
str = strItem[index:] if strBegin is not None else strItem
if strEnd is None:
return str
index=str.index(strEnd)
if -1==index :
try:
index = str.index(strEnd)
except ValueError:
return None
sb=""
for strIndex in range(0, len(str)-1):
if index==strIndex:
sb = ""
for strIndex in range(0, len(str) - 1):
if index == strIndex:
break
sb=sb+str[strIndex]
return (sb)
sb = sb + str[strIndex]
return sb
class HttpNetRequest:
def __init__(self):
@@ -122,8 +127,6 @@ class DateTimeHelper:
except:
return False
# returns a datetime
@staticmethod
def applyRelativeTime(sometime,relativetime):