Changeset 26936 in osm


Ignore:
Timestamp:
2011-10-23T02:31:31+02:00 (13 years ago)
Author:
donvip
Message:

tag2link 0.2a: add Mail support + initial work on UNESCO WHC

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

Legend:

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

    r26934 r26936  
    3030            <link name="View URL" href="%v%" />
    3131        </rule>
     32        <rule>
     33            <condition k="email" v="[^@]+@[^@]+" />
     34            <link name="Send Email" href="mailto:%v%" />
     35        </rule>
     36        <rule>
     37            <condition k="contact:email"  v="[^@]+@[^@]+" />
     38            <link name="Send Email" href="mailto:%v%" />
     39        </rule>
    3240    </source>
    3341   
    3442    <source name="Wikipedia">
    3543        <rule>
    36             <condition k="wikipedia(?::([\p{Lower}]{2,}))?" v="(?:([\p{Lower}]{2,}):)?(.*)" />
     44            <condition k="wikipedia(?::(\p{Lower}{2,}))?" v="(?:(\p{Lower}{2,}):)?(.*)" />
    3745            <link name="View %name% article" href="http://%k.1:v.1:en%.wikipedia.org/wiki/%v.2:v.1%" />
     46        </rule>
     47    </source>
     48
     49    <source name="WHC">
     50        <rule>
     51            <condition k="ref:whc" v="\p{Digit}+" />
     52            <link name="View UNESCO sheet" href="http://whc.unesco.org/%lang(en,fr):en%/list/%v%" />
    3853        </rule>
    3954    </source>
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPlugin.java

    r26934 r26936  
    2626
    2727/**
    28  * Main class of tag2links plugin.
     28 * Main class of tag2link plugin.
    2929 * @author Don-vip
    30  * @version 0.1b
     30 * @version 0.2a
    3131 * History:
     32 * 0.2a 23-Oct-2011 add Mail support + initial work on UNESCO WHC
    3233 * 0.1c 23-Oct-2011 add MHS rule (French heritage)
    3334 * 0.1b 22-Oct-2011 add CEF rule (French christian churches)
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkRuleChecker.java

    r26922 r26936  
    7474                                                }
    7575                                        }
     76                                        if (val == null) {
     77                                                Matcher lm = Pattern.compile("lang(?:\\(\\p{Lower}{2,}(?:,\\p{Lower}{2,})*\\))?(?::(\\p{Lower}{2,}))?").matcher(arg);
     78                                                if (lm.matches()) {
     79                                                        if (lm.groupCount() == 0) {
     80                                                                // TODO: get JOSM current language
     81                                                        } else {
     82                                                                // TODO: parse next groups
     83                                                        }
     84                                                }
     85                                        }
    7686                                        if (val != null) {
    7787                                                try {
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenLinkAction.java

    r26921 r26936  
    33import static org.openstreetmap.josm.tools.I18n.tr;
    44
     5import java.awt.Desktop;
    56import java.awt.event.ActionEvent;
     7import java.net.URI;
    68
    79import org.openstreetmap.josm.actions.JosmAction;
     
    2224    @Override
    2325    public void actionPerformed(ActionEvent e) {
     26        if (url.matches("mailto:.*")) {
     27                if (Desktop.isDesktopSupported()) {
     28                        try {
     29                                System.out.println("Sending "+url);
     30                                        Desktop.getDesktop().mail(new URI(url));
     31                                } catch (Exception ex) {
     32                                        ex.printStackTrace();
     33                                }
     34                }
     35        }
    2436        System.out.println("Opening "+url);
    2537        OpenBrowser.displayUrl(url);
Note: See TracChangeset for help on using the changeset viewer.