Changeset 18918 in josm for trunk/resources/data


Ignore:
Timestamp:
2023-12-19T17:09:19+01:00 (11 months ago)
Author:
taylor.smock
Message:

Fix #23290: Validate the regions a tag is expected to be in (patch by Sarabjeet108, modified)

Modifications are as follows:

  • Allow the use of the new region attributes for keys inside a preset
  • Basic tests

regions comes from Vespucci's extensions: https://vespucci.io/tutorials/presets/#extensions

Location:
trunk/resources/data
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/resources/data/defaultpresets.xml

    r18897 r18918  
    14661466                    <list_entry value="no" />
    14671467                </combo>
    1468                 <combo key="crossing_ref" text="Crossing type name (UK)" values="zebra,pelican,toucan,puffin,pegasus,tiger" />
     1468                <combo key="crossing_ref" text="Crossing type name (UK)" values="zebra,pelican,toucan,puffin,pegasus,tiger" regions="GB" />
    14691469                <combo key="kerb" text="Kerb" values="flush,lowered,no,raised,rolled,yes" values_context="kerb" />
    14701470                <combo key="supervised" text="Crossing attendant" delimiter="|" values="yes|no|06:00-20:00|Mo-Fr 09:00-18:00,Sa 08:00-14:00|May-Sep 09:30-12:30,14:15-19:30" values_i18n="false" values_sort="false" />
     
    15171517            </combo>
    15181518            <reference ref="crossing_markings" />
    1519             <combo key="crossing_ref" text="Crossing type name (UK)" values="zebra,pelican,toucan,puffin,pegasus,tiger" values_searchable="true" />
     1519            <combo key="crossing_ref" text="Crossing type name (UK)" values="zebra,pelican,toucan,puffin,pegasus,tiger" values_searchable="true" regions="GB" />
    15201520            <combo key="kerb" text="Kerb" values="flush,lowered,no,raised,rolled,yes" values_context="kerb" />
    15211521            <combo key="supervised" text="Crossing attendant" delimiter="|" values="yes|no|06:00-20:00|Mo-Fr 09:00-18:00,Sa 08:00-14:00|May-Sep 09:30-12:30,14:15-19:30" values_i18n="false" values_sort="false" />
     
    73097309                <list_entry value="sculpture" short_description="A non figurative sculpture which does not match any of the other categories." />
    73107310                <list_entry value="cross" short_description="A cross-shaped memorial." />
    7311                 <list_entry value="blue_plaque" short_description="A blue plaque commemorating a historical link to that location. (UK)" />
     7311                <list_entry value="blue_plaque" short_description="A blue plaque commemorating a historical link to that location. (UK)" regions="GB" />
    73127312                <list_entry value="obelisk" short_description="An obelisk." />
    73137313                <list_entry value="ghost_bike" short_description="A bicycle painted white permanently placed as memorial for a victim of a road accident (usually cyclists)." />
    7314                 <list_entry value="stolperstein" short_description="10cm × 10cm brass plaque commemorating victims of Nazi persecution. (EU,RU)" />
     7314                <list_entry value="stolperstein" short_description="10cm × 10cm brass plaque commemorating victims of Nazi persecution. (EU,RU)" regions="EU,RU" />
    73157315                <list_entry value="bench" short_description="A bench placed in memory of someone or something; usually has a plaque, and sometimes a statue sitting on (part of) it." />
    73167316            </combo>
     
    82628262            <check key="payment:laser" text="Laser" match="keyvalue" />
    82638263            <check key="payment:maestro" text="Maestro" match="keyvalue" />
    8264             <check key="payment:postfinance_card" text="PostFinance Card (ch)" match="keyvalue" />
     8264            <check key="payment:postfinance_card" text="PostFinance Card (ch)" match="keyvalue" region="CH" />
    82658265            <check key="payment:visa_debit" text="Visa Debit" match="keyvalue" />
    82668266            <check key="payment:visa_electron" text="Visa Electron" match="keyvalue" />
     
    82818281        <combo key="payment:electronic_purses" text="Electronic purses and Charge cards" values="yes,no" match="keyvalue" />
    82828282        <checkgroup columns="4">
    8283             <check key="payment:ep_avant" text="Avant (fi)" match="keyvalue" />
    8284             <check key="payment:ep_geldkarte" text="Geldkarte (de)" match="keyvalue" />
    8285             <check key="payment:ep_mep" text="Mep (pt)" match="keyvalue" />
    8286             <check key="payment:ep_minicash" text="Minicash (lu)" match="keyvalue" />
    8287             <check key="payment:ep_minipay" text="Minipay (it)" match="keyvalue" />
    8288             <check key="payment:ep_monedero4b" text="Mondero 4b (es)" match="keyvalue" />
     8283            <check key="payment:ep_avant" text="Avant (fi)" match="keyvalue" regions="FI" />
     8284            <check key="payment:ep_geldkarte" text="Geldkarte (de)" match="keyvalue" regions="DE" />
     8285            <check key="payment:ep_mep" text="Mep (pt)" match="keyvalue" regions="PT" />
     8286            <check key="payment:ep_minicash" text="Minicash (lu)" match="keyvalue" regions="LU" />
     8287            <check key="payment:ep_minipay" text="Minipay (it)" match="keyvalue" regions="IT" />
     8288            <check key="payment:ep_monedero4b" text="Mondero 4b (es)" match="keyvalue" regions="ES" />
    82898289        </checkgroup>
    82908290        <space />
     
    99699969                <text key="destination" text="Name of river/lake/sea/ocean it runs into" />
    99709970                <text key="ref" text="Reference" />
    9971                 <text key="ref:sandre" text="Reference Sandre (FR)" />
    9972                 <text key="ref:fgkz" text="Reference FGKZ (DE)" />
    9973                 <text key="ref:regine" text="Reference REGINE (NO)" />
    9974                 <text key="ref:gnis" text="Reference GNIS (USA)" />
    9975                 <text key="ref:gnbc" text="Reference GNBC (CA)" />
     9971                <text key="ref:sandre" text="Reference Sandre (FR)" regions="FR" />
     9972                <text key="ref:fgkz" text="Reference FGKZ (DE)" regions="DE" />
     9973                <text key="ref:regine" text="Reference REGINE (NO)" regions="NO" />
     9974                <text key="ref:gnis" text="Reference GNIS (USA)" regions="US" />
     9975                <text key="ref:gnbc" text="Reference GNBC (CA)" regions="CA" />
    99769976                <reference ref="wikipedia_wikidata" />
    99779977            </optional>
  • trunk/resources/data/tagging-preset.xsd

    r18812 r18918  
    107107            <extension base="tns:group-parent">
    108108                <attributeGroup ref="tns:attributes.name" />
     109                <attributeGroup ref="tns:attributes.regions"/>
    109110            </extension>
    110111        </complexContent>
     
    122123        <annotation>
    123124            <documentation>
    124                 Every item is one annotation set to select from. name is required, type and preset_name_label are recommended, icon and name_template are optional attributes.
     125                Every item is one annotation set to select from. name is required, type and preset_name_label are recommended and icon, name_template, regions and exclude_regions are optional attributes.
    125126            </documentation>
    126127        </annotation>
     
    135136        <attributeGroup ref="tns:attributes.name" />
    136137        <attributeGroup ref="tns:attributes.icon" />
     138        <attributeGroup ref="tns:attributes.regions"/>
    137139        <attribute name="type" type="string">
    138140            <annotation>
     
    365367        <annotation>
    366368            <documentation><![CDATA[
    367                 Used in <combo/> and <multiselect/>. More information see short_descriptions below. The attributes are value, display_value, short_description, icon and icon_size.
     369                Used in <combo/> and <multiselect/>. More information see short_descriptions below. The attributes are value, display_value, short_description, icon, icon_size, regions, and exclude_regions.
    368370            ]]></documentation>
    369371        </annotation>
     
    379381        </attribute>
    380382        <attributeGroup ref="tns:attributes.icon" />
     383        <attributeGroup ref="tns:attributes.regions"/>
    381384        <anyAttribute processContents="skip" />
    382385    </complexType>
     
    490493        <attribute name="match" type="tns:match" />
    491494        <attributeGroup ref="tns:attributes.icon" />
     495        <attributeGroup ref="tns:attributes.regions"/>
    492496
    493497        <attribute name="name" use="prohibited" />
     
    559563        <annotation>
    560564            <documentation>
    561                 To specify possible roles of members in relations. The key attribute is required, text, requisite, count, type and member_expression are optional.
     565                To specify possible roles of members in relations. The key attribute is required, text, requisite, count, type, member_expression, regions, and exclude_regions are optional.
    562566            </documentation>
    563567        </annotation>
     
    575579        <attribute name="member_expression" type="string" />
    576580        <attribute name="regexp" type="boolean" />
     581        <attributeGroup ref="tns:attributes.regions"/>
    577582        <anyAttribute processContents="skip" />
    578583    </complexType>
     
    730735    </attributeGroup>
    731736
     737    <attributeGroup name="attributes.regions">
     738        <attribute name="regions" type="string">
     739            <annotation>
     740                <documentation>
     741                    Comma separated list of countries this preset group or item is applicable for. If not specified, the preset is applicable for all countries.
     742                </documentation>
     743            </annotation>
     744        </attribute>
     745        <attribute name="exclude_regions" type="boolean">
     746            <annotation>
     747                <documentation>
     748                    If true, invert the meaning of regions.
     749                </documentation>
     750            </annotation>
     751        </attribute>
     752    </attributeGroup>
     753
    732754</schema>
Note: See TracChangeset for help on using the changeset viewer.