loop replace
This commit is contained in:
parent
0fc6e78a18
commit
d3ec7d147d
@ -506,6 +506,8 @@ class WPimport:
|
||||
self._logger.debug("{0} : {1}".format(page.content))
|
||||
if title[len(title)-1] == " ":
|
||||
title = title[:-1]
|
||||
if title[0] == " ":
|
||||
title = title[1:]
|
||||
page_is_exist = False
|
||||
|
||||
for index in range(1,10):
|
||||
@ -531,14 +533,10 @@ class WPimport:
|
||||
if len(i["title"]["rendered"]) == len(title):
|
||||
title_rendered = i["title"]["rendered"]
|
||||
else:
|
||||
title_rendered = i["title"]["rendered"].replace('’', "'")
|
||||
title_rendered = title_rendered.replace('–', '-')
|
||||
title_rendered = title_rendered.replace('…', '...')
|
||||
title_rendered = title_rendered.replace('« ', '"')
|
||||
title_rendered = title_rendered.replace(' »', '"')
|
||||
title_rendered = title_rendered.replace('« ', '"')
|
||||
title_rendered = title_rendered.replace(' »', '"')
|
||||
title_rendered = title_rendered.replace('’', "'")
|
||||
title_rendered = i["title"]["rendered"]
|
||||
list_replace = {'’': "'", '–': '-', '…': '...', '« ': '"', ' »': '"', '« ': '"', ' »': '"', '’': "'", '"‘': "'"}
|
||||
for old, new in list_replace.items():
|
||||
title_rendered = title_rendered.replace(old, new)
|
||||
self._logger.debug("{0} : Search title posts for |{2}| : |{1}|".format(self._name, title_rendered, title))
|
||||
self._logger.debug("{0} : SIze of title : {1} - {2}".format(self._name, len(title), len(title_rendered)))
|
||||
if title_rendered == title:
|
||||
|
Loading…
x
Reference in New Issue
Block a user