make/jdk/src/classes/build/tools/taglet/ExtLink.java
changeset 50782 e92d48cf94f9
parent 49073 4f96cf952e71
child 52318 124af9276e44
equal deleted inserted replaced
50781:9f781ce22e7d 50782:e92d48cf94f9
    35 import com.sun.source.doctree.DocTree;
    35 import com.sun.source.doctree.DocTree;
    36 import com.sun.source.doctree.UnknownInlineTagTree;
    36 import com.sun.source.doctree.UnknownInlineTagTree;
    37 import jdk.javadoc.doclet.Taglet;
    37 import jdk.javadoc.doclet.Taglet;
    38 
    38 
    39 import static com.sun.source.doctree.DocTree.Kind.*;
    39 import static com.sun.source.doctree.DocTree.Kind.*;
    40 import static jdk.javadoc.doclet.Taglet.Location.*;
       
    41 
    40 
    42 /**
    41 /**
    43  * An inline tag to conveniently insert an external link.
    42  * An inline tag to conveniently insert an external link.
    44  * The tag can be used as follows:
    43  * The tag can be used as follows:
    45  * {@extLink name description}, for example
    44  * {@extLink name description}, for example
    51  * {@code
    50  * {@code
    52  * Please see <a href="https://www.oracle.com/pls/topic/lookup?ctx=javase10&id=Borealis">a spectacular</a> sight.
    51  * Please see <a href="https://www.oracle.com/pls/topic/lookup?ctx=javase10&id=Borealis">a spectacular</a> sight.
    53  * }
    52  * }
    54  */
    53  */
    55 public class ExtLink implements Taglet {
    54 public class ExtLink implements Taglet {
       
    55     static final String SPEC_VERSION;
       
    56 
       
    57     static {
       
    58         SPEC_VERSION = System.getProperty("extlink.spec.version");
       
    59         if (SPEC_VERSION == null) {
       
    60             throw new RuntimeException("extlink.spec.version property not set");
       
    61         }
       
    62     }
    56 
    63 
    57     static final String TAG_NAME = "extLink";
    64     static final String TAG_NAME = "extLink";
    58 
    65 
    59     static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase10&amp;id=";
    66     static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase" +
       
    67         SPEC_VERSION + "&amp;id=";
    60 
    68 
    61     static final Pattern TAG_PATTERN = Pattern.compile("(?s)(\\s*)(?<name>\\w+)(\\s+)(?<desc>.*)$");
    69     static final Pattern TAG_PATTERN = Pattern.compile("(?s)(\\s*)(?<name>\\w+)(\\s+)(?<desc>.*)$");
       
    70 
    62 
    71 
    63     /**
    72     /**
    64      * Returns the set of locations in which the tag may be used.
    73      * Returns the set of locations in which the tag may be used.
    65      */
    74      */
    66     @Override
    75     @Override