< prev index next >

make/jdk/src/classes/build/tools/taglet/ExtLink.java

Print this page




  32 import java.util.regex.Pattern;
  33 import javax.lang.model.element.Element;
  34 
  35 import com.sun.source.doctree.DocTree;
  36 import com.sun.source.doctree.UnknownInlineTagTree;
  37 import jdk.javadoc.doclet.Taglet;
  38 
  39 import static com.sun.source.doctree.DocTree.Kind.*;
  40 import static jdk.javadoc.doclet.Taglet.Location.*;
  41 
  42 /**
  43  * An inline tag to conveniently insert an external link.
  44  * The tag can be used as follows:
  45  * {@extLink name description}, for example
  46  * <p>
  47  * {@code Please see {@extLink Borealis a spectacular} sight.}
  48  * <p>
  49  * will produce the following html
  50  * <p>
  51  * {@code
  52  * Please see <a href="https://www.oracle.com/pls/topic/lookup?ctx=javase9&id=Borealis">a spectacular</a> sight.
  53  * }
  54  */
  55 public class ExtLink implements Taglet {
  56 
  57     static final String TAG_NAME = "extLink";
  58 
  59     static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase9&amp;id=";
  60 
  61     static final Pattern TAG_PATTERN = Pattern.compile("(?s)(\\s*)(?<name>\\w+)(\\s+)(?<desc>.*)$");
  62 
  63     /**
  64      * Returns the set of locations in which the tag may be used.
  65      */
  66     @Override
  67     public Set<Location> getAllowedLocations() {
  68         return EnumSet.allOf(jdk.javadoc.doclet.Taglet.Location.class);
  69     }
  70 
  71     @Override
  72     public boolean isInlineTag() {
  73         return true;
  74     }
  75 
  76     @Override
  77     public String getName() {
  78         return TAG_NAME;
  79     }




  32 import java.util.regex.Pattern;
  33 import javax.lang.model.element.Element;
  34 
  35 import com.sun.source.doctree.DocTree;
  36 import com.sun.source.doctree.UnknownInlineTagTree;
  37 import jdk.javadoc.doclet.Taglet;
  38 
  39 import static com.sun.source.doctree.DocTree.Kind.*;
  40 import static jdk.javadoc.doclet.Taglet.Location.*;
  41 
  42 /**
  43  * An inline tag to conveniently insert an external link.
  44  * The tag can be used as follows:
  45  * {@extLink name description}, for example
  46  * <p>
  47  * {@code Please see {@extLink Borealis a spectacular} sight.}
  48  * <p>
  49  * will produce the following html
  50  * <p>
  51  * {@code
  52  * Please see <a href="https://www.oracle.com/pls/topic/lookup?ctx=javase10&id=Borealis">a spectacular</a> sight.
  53  * }
  54  */
  55 public class ExtLink implements Taglet {
  56 
  57     static final String TAG_NAME = "extLink";
  58 
  59     static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase10&amp;id=";
  60 
  61     static final Pattern TAG_PATTERN = Pattern.compile("(?s)(\\s*)(?<name>\\w+)(\\s+)(?<desc>.*)$");
  62 
  63     /**
  64      * Returns the set of locations in which the tag may be used.
  65      */
  66     @Override
  67     public Set<Location> getAllowedLocations() {
  68         return EnumSet.allOf(jdk.javadoc.doclet.Taglet.Location.class);
  69     }
  70 
  71     @Override
  72     public boolean isInlineTag() {
  73         return true;
  74     }
  75 
  76     @Override
  77     public String getName() {
  78         return TAG_NAME;
  79     }


< prev index next >