Fix handling of <time> tag and replace html tags
This commit is contained in:
@@ -452,10 +452,12 @@ class Sections:
|
|||||||
for code in codes:
|
for code in codes:
|
||||||
strItem=strItem.replace(code,"'")
|
strItem=strItem.replace(code,"'")
|
||||||
strItem=strItem.replace("&","&")
|
strItem=strItem.replace("&","&")
|
||||||
strItem=strItem.replace("‘","'")
|
strItem=strItem.replace("‘","‘")
|
||||||
strItem=strItem.replace("’","'")
|
strItem=strItem.replace("’","’")
|
||||||
strItem=strItem.replace("—","-")
|
strItem=strItem.replace("—","-")
|
||||||
|
strItem=strItem.replace("'","'")
|
||||||
strItem=strItem.replace("???","'")
|
strItem=strItem.replace("???","'")
|
||||||
|
strItem=strItem.replace(""","\"")
|
||||||
return strItem
|
return strItem
|
||||||
|
|
||||||
def pad(str,filler,length):
|
def pad(str,filler,length):
|
||||||
|
|||||||
23
utility.py
23
utility.py
@@ -40,25 +40,30 @@ class StringHelper:
|
|||||||
if strBegin is None:
|
if strBegin is None:
|
||||||
index = 0
|
index = 0
|
||||||
else:
|
else:
|
||||||
index = strItem.index(strBegin)
|
try:
|
||||||
if -1==index:
|
if strBegin.startswith("<") and strBegin.endswith(">"):
|
||||||
return None
|
tag_name = strBegin[1:-1] # e.g. "time"
|
||||||
str=None
|
index = strItem.index("<" + tag_name)
|
||||||
if strBegin is not None:
|
index = strItem.index(">", index) + 1
|
||||||
str=strItem[index+len(strBegin):]
|
|
||||||
else:
|
else:
|
||||||
str=strItem
|
index = strItem.index(strBegin) + len(strBegin)
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
if index == -1:
|
||||||
|
return None
|
||||||
|
str = strItem[index:] if strBegin is not None else strItem
|
||||||
if strEnd is None:
|
if strEnd is None:
|
||||||
return str
|
return str
|
||||||
|
try:
|
||||||
index = str.index(strEnd)
|
index = str.index(strEnd)
|
||||||
if -1==index :
|
except ValueError:
|
||||||
return None
|
return None
|
||||||
sb = ""
|
sb = ""
|
||||||
for strIndex in range(0, len(str) - 1):
|
for strIndex in range(0, len(str) - 1):
|
||||||
if index == strIndex:
|
if index == strIndex:
|
||||||
break
|
break
|
||||||
sb = sb + str[strIndex]
|
sb = sb + str[strIndex]
|
||||||
return (sb)
|
return sb
|
||||||
|
|
||||||
class HttpNetRequest:
|
class HttpNetRequest:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user