Changeset 35146 in osm for applications


Ignore:
Timestamp:
2019-09-27T14:43:08+02:00 (5 years ago)
Author:
donvip
Message:

fix wikimedia commons regex, add case insensitiveness

Location:
applications/editors/josm/plugins/tag2link
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/tag2link/resources/tag2link_sources.xml

    r35145 r35146  
    5050        </rule>
    5151        <rule>
    52             <condition k="image" v="File:.*"/>
     52            <condition k="image" v="(?i:File|Category):.*"/>
    5353            <link name="View image" href="https://commons.wikimedia.org/wiki/%v%" />
    5454        </rule>
     
    6969        </rule>
    7070        <rule>
    71             <condition k="wikimedia_commons" v="(File|Category):.*"/>
     71            <condition k="wikimedia_commons" v="(?i:File):.*"/>
    7272            <link name="View Commons file" href="https://commons.wikimedia.org/wiki/%v%" />
    7373        </rule>
    7474        <rule>
    75             <condition k="wikimedia_commons" v="Category:.*"/>
     75            <condition k="wikimedia_commons" v="(?i:Category):.*"/>
    7676            <link name="View Commons category" href="https://commons.wikimedia.org/wiki/%v%" />
    7777        </rule>
  • applications/editors/josm/plugins/tag2link/test/unit/org/openstreetmap/josm/plugins/tag2link/Tag2LinkRuleCheckerTest.java

    r35144 r35146  
    1919    @Test
    2020    public void testImageCommons() {
    21         final Collection<Link> links = Tag2LinkRuleChecker.getLinks(new Tag("image", "File:Witten Brücke Gasstraße.jpg"));
     21        Collection<Link> links = Tag2LinkRuleChecker.getLinks(new Tag("image", "File:Witten Brücke Gasstraße.jpg"));
    2222        assertEquals(1, links.size());
    2323        assertEquals("https://commons.wikimedia.org/wiki/File%3AWitten_Br%C3%BCcke_Gasstra%C3%9Fe.jpg", links.iterator().next().url);
     24        links = Tag2LinkRuleChecker.getLinks(new Tag("image", "category:JOSM"));
     25        assertEquals(1, links.size());
     26        assertEquals("https://commons.wikimedia.org/wiki/category%3AJOSM", links.iterator().next().url);
    2427    }
    2528
Note: See TracChangeset for help on using the changeset viewer.