def node(self, data, tags): capture_tags = {} keys = tags.keys() err = [] # *[name=~/ي/][language("fa")] # *[name:fa=~/ي/] if (u'name' in keys) or (u'name:fa' in keys): match = False if not match: capture_tags = {} try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5eeade1c), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.language(self.father.config.options, u'fa')) except mapcss.RuleAbort: pass if not match: capture_tags = {} try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5eeade1c), mapcss._tag_capture(capture_tags, 0, tags, u'name:fa'))) except mapcss.RuleAbort: pass if match: # group:tr("Arabic letter detected in Farsi name") # -osmoseItemClassLevel:"5010/50109001:0/2" # throwError:tr("In Farsi, the Arabic letter '{0}' should be replaced by '{1}'","ي","ی") # fixAdd:concat("{0.key}=",replace("{0.value}","ي","ی")) # -osmoseAssertMatchWithContext:list('node name="روابط عمومي مجتمع مس شهربابك"','language=fa') # assertMatch:'node name:fa="روابط عمومي مجتمع مس شهربابك"' # assertNoMatch:'node name="روابط عمومي مجتمع مس شهربابك"' err.append({'class': 50109001, 'subclass': 0, 'text': mapcss.tr(u'In Farsi, the Arabic letter \'{0}\' should be replaced by \'{1}\'', u'ي', u'ی'), 'allow_fix_override': True, 'fix': { '+': dict([ (mapcss.concat(mapcss._tag_uncapture(capture_tags, u'{0.key}='), mapcss.replace(mapcss._tag_uncapture(capture_tags, u'{0.value}'), u'ي', u'ی'))).split('=', 1)]) }}) # *[name=~/ك/][language("fa")] # *[name:fa=~/ك/] if (u'name' in keys) or (u'name:fa' in keys): match = False if not match: capture_tags = {} try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_4234bf3b), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.language(self.father.config.options, u'fa')) except mapcss.RuleAbort: pass if not match: capture_tags = {} try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_4234bf3b), mapcss._tag_capture(capture_tags, 0, tags, u'name:fa'))) except mapcss.RuleAbort: pass if match: # group:tr("Arabic letter detected in Farsi name") # -osmoseItemClassLevel:"5010/50109001:1/2" # throwError:tr("In Farsi, the Arabic letter '{0}' should be replaced by '{1}'","ك","ک") # fixAdd:concat("{0.key}=",replace("{0.value}","ك","ک")) # -osmoseAssertMatchWithContext:list('node name="روابط عمومي مجتمع مس شهربابك"','language=fa') # assertMatch:'node name:fa="روابط عمومي مجتمع مس شهربابك"' # assertNoMatch:'node name="روابط عمومي مجتمع مس شهربابك"' err.append({'class': 50109001, 'subclass': 1, 'text': mapcss.tr(u'In Farsi, the Arabic letter \'{0}\' should be replaced by \'{1}\'', u'ك', u'ک'), 'allow_fix_override': True, 'fix': { '+': dict([ (mapcss.concat(mapcss._tag_uncapture(capture_tags, u'{0.key}='), mapcss.replace(mapcss._tag_uncapture(capture_tags, u'{0.value}'), u'ك', u'ک'))).split('=', 1)]) }}) return err
def way(self, data, tags, nds): capture_tags = {} keys = tags.keys() err = [] # *[name=~/ي/][language("fa")] # *[name:fa=~/ي/] if (u'name' in keys) or (u'name:fa' in keys): match = False if not match: capture_tags = {} try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5eeade1c), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.language(self.father.config.options, u'fa')) except mapcss.RuleAbort: pass if not match: capture_tags = {} try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_5eeade1c), mapcss._tag_capture(capture_tags, 0, tags, u'name:fa'))) except mapcss.RuleAbort: pass if match: # group:tr("Arabic letter detected in Farsi name") # -osmoseItemClassLevel:"5010/50109001/2" # throwError:tr("In Farsi, the Arabic letter '{0}' should be replaced by '{1}'","ي","ی") # fixAdd:concat("{0.key}=",replace("{0.value}","ي","ی")) # -osmoseAssertMatchWithContext:list('node name="روابط عمومي مجتمع مس شهربابك"','language=fa') # assertMatch:'node name:fa="روابط عمومي مجتمع مس شهربابك"' # assertNoMatch:'node name="روابط عمومي مجتمع مس شهربابك"' err.append({'class': 50109001, 'subclass': 0, 'text': mapcss.tr(u'In Farsi, the Arabic letter \'{0}\' should be replaced by \'{1}\'', u'ي', u'ی'), 'allow_fix_override': True, 'fix': { '+': dict([ (mapcss.concat(mapcss._tag_uncapture(capture_tags, u'{0.key}='), mapcss.replace(mapcss._tag_uncapture(capture_tags, u'{0.value}'), u'ي', u'ی'))).split('=', 1)]) }}) # *[name=~/ك/][language("fa")] # *[name:fa=~/ك/] if (u'name' in keys) or (u'name:fa' in keys): match = False if not match: capture_tags = {} try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_4234bf3b), mapcss._tag_capture(capture_tags, 0, tags, u'name')) and mapcss.language(self.father.config.options, u'fa')) except mapcss.RuleAbort: pass if not match: capture_tags = {} try: match = (mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_4234bf3b), mapcss._tag_capture(capture_tags, 0, tags, u'name:fa'))) except mapcss.RuleAbort: pass if match: # group:tr("Arabic letter detected in Farsi name") # -osmoseItemClassLevel:"5010/50109001/2" # throwError:tr("In Farsi, the Arabic letter '{0}' should be replaced by '{1}'","ك","ک") # fixAdd:concat("{0.key}=",replace("{0.value}","ك","ک")) # -osmoseAssertMatchWithContext:list('node name="روابط عمومي مجتمع مس شهربابك"','language=fa') # assertMatch:'node name:fa="روابط عمومي مجتمع مس شهربابك"' # assertNoMatch:'node name="روابط عمومي مجتمع مس شهربابك"' err.append({'class': 50109001, 'subclass': 0, 'text': mapcss.tr(u'In Farsi, the Arabic letter \'{0}\' should be replaced by \'{1}\'', u'ك', u'ک'), 'allow_fix_override': True, 'fix': { '+': dict([ (mapcss.concat(mapcss._tag_uncapture(capture_tags, u'{0.key}='), mapcss.replace(mapcss._tag_uncapture(capture_tags, u'{0.value}'), u'ك', u'ک'))).split('=', 1)]) }}) return err
def way(self, data, tags, nds): capture_tags = {} keys = tags.keys() err = [] # way[highway][destination][destination*="|"] # way[highway][/^destination:/][!/^destination:lanes/][!/^destination:.*:lanes/][/^destination:/=~/\|/] # way[waterway][destination][destination*="|"] # way[waterway][/^destination:/][!/^destination:lanes/][!/^destination:.*:lanes/][/^destination:/=~/\|/] if (u'destination' in keys and u'highway' in keys) or ( u'destination' in keys and u'waterway' in keys) or (u'highway' in keys) or (u'waterway' in keys): match = False if not match: capture_tags = {} try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') and mapcss._tag_capture(capture_tags, 1, tags, u'destination') and mapcss.string_contains( mapcss._tag_capture(capture_tags, 2, tags, u'destination'), mapcss._value_capture(capture_tags, 2, u'|'))) except mapcss.RuleAbort: pass if not match: capture_tags = {} try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'highway') and mapcss._tag_capture(capture_tags, 1, tags, self.re_53d7e349) and not mapcss._tag_capture( capture_tags, 2, tags, self.re_49b44b3d) and not mapcss._tag_capture( capture_tags, 3, tags, self.re_60b51c01) and mapcss.regexp_test( self.re_262d3d80, mapcss._match_regex(tags, self.re_53d7e349))) except mapcss.RuleAbort: pass if not match: capture_tags = {} try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') and mapcss._tag_capture(capture_tags, 1, tags, u'destination') and mapcss.string_contains( mapcss._tag_capture(capture_tags, 2, tags, u'destination'), mapcss._value_capture(capture_tags, 2, u'|'))) except mapcss.RuleAbort: pass if not match: capture_tags = {} try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'waterway') and mapcss._tag_capture(capture_tags, 1, tags, self.re_53d7e349) and not mapcss._tag_capture( capture_tags, 2, tags, self.re_49b44b3d) and not mapcss._tag_capture( capture_tags, 3, tags, self.re_60b51c01) and mapcss.regexp_test( self.re_262d3d80, mapcss._match_regex(tags, self.re_53d7e349))) except mapcss.RuleAbort: pass if match: # group:tr("Pipe characters should not be used in destination tag, only in destination:lanes") # -osmoseItemClassLevel:"3160/316010:0/3" # suggestAlternative:tr("In case of multiple values, use instead a semicolon to separate values") # throwError:tr("{0} contains a pipe character","{1.tag}") # fixAdd:concat("{1.key}=",replace("{1.value}","|",";")) # assertNoMatch:"way highway=primary destination:colour=Red" # assertMatch:"way highway=primary destination:colour=Red|Yellow" # assertNoMatch:"way highway=primary destination:lanes:backward=A8|Centre|Plage" # assertNoMatch:"way highway=primary destination:lanes=A8|Centre|Plage" # assertNoMatch:"way highway=primary destination:ref:lanes=A8|A10|A23" # assertNoMatch:"way highway=primary destination=A8" # assertMatch:"way highway=primary destination=A8|Centre|Plage" # assertNoMatch:"way highway=tertiary destination:ref:lanes:backward=B 3|B 3" # assertNoMatch:"way highway=tertiary destination:ref:to:lanes=A 7|" # assertNoMatch:"way waterway=river destination=East" # assertMatch:"way waterway=river destination=East|West" err.append({ 'class': 316010, 'subclass': 0, 'text': mapcss.tr(u'{0} contains a pipe character', mapcss._tag_uncapture(capture_tags, u'{1.tag}')), 'allow_fix_override': True, 'fix': { '+': dict([(mapcss.concat( mapcss._tag_uncapture(capture_tags, u'{1.key}='), mapcss.replace( mapcss._tag_uncapture(capture_tags, u'{1.value}'), u'|', u';'))).split('=', 1)]) } }) return err