move quoting hack to wiki loader

The bad quotes around the type for special phrases
specifically occure in the Wiki pages, so it should be
removed by the loader and not in the generic SpecialPhrase
object.
This commit is contained in:
Sarah Hoffmann
2022-05-30 14:32:36 +02:00
parent cce0e5ea38
commit e828d0d3f7
4 changed files with 15 additions and 21 deletions

View File

@@ -37,6 +37,8 @@ class SPWikiLoader:
self.occurence_pattern = re.compile(
r'\| *([^\|]+) *\|\| *([^\|]+) *\|\| *([^\|]+) *\|\| *([^\|]+) *\|\| *([\-YN])'
)
# Hack around a bug where building=yes was imported with quotes into the wiki
self.type_fix_pattern = re.compile(r'\"|"')
self._load_languages()
@@ -52,7 +54,10 @@ class SPWikiLoader:
matches = self.occurence_pattern.findall(loaded_xml)
for match in matches:
yield SpecialPhrase(match[0], match[1], match[2], match[3])
yield SpecialPhrase(match[0],
match[1],
self.type_fix_pattern.sub('', match[2]),
match[3])
def _load_languages(self):