forked from hans/Nominatim
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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user