1 /*
   2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.javadoc.doclet;
  27 
  28 import java.util.Locale;
  29 import java.util.List;
  30 import java.util.Set;
  31 
  32 import javax.lang.model.element.Element;
  33 import javax.lang.model.SourceVersion;
  34 
  35 import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet;
  36 
  37 /**
  38  * This doclet generates HTML-formatted documentation for the specified modules,
  39  * packages and types.
  40  *
  41  * <h2><a id="user-defined-taglets">User-Defined Taglets</a></h2>
  42  *
  43  * The standard doclet supports user-defined {@link Taglet taglets},
  44  * which can be used to generate customized output for user-defined tags
  45  * in documentation comments.
  46  *
  47  * Taglets invoked by the standard doclet must return strings from
  48  * {@link Taglet#toString(List,Element) Taglet.toString} as follows:
  49  *
  50  * <dl>
  51  * <dt> <i>Inline Tags</i>
  52  * <dd> The returned string must be
  53  *      <a href="https://www.w3.org/TR/html52/dom.html#flow-content">flow content</a>,
  54  *      or any valid fragment of HTML code that may appear in the body of a document.
  55  *      There may be additional constraints, depending on how the tag is to be
  56  *      used in a documentation comment: for example, if the tag may be used
  57  *      within an inline element such as {@code <b>} or {@code <i>}, the taglet
  58  *      must not return a string containing block tags, like {@code <h3>} or
  59  *      {@code <p>}.
  60  * <dt> <i>Block Tags</i>
  61  * <dd> The returned string must be suitable content for a definition list,
  62  *      or {@code <dl>} element. It will typically be a series of pairs
  63  *      of {@code <dt>} and {@code <dd>} elements.
  64  * </dl>
  65  *
  66  * @see <a href="{@docRoot}/../specs/javadoc/doc-comment-spec.html">
  67  *      Documentation Comment Specification for the Standard Doclet</a>
  68  */
  69 public class StandardDoclet implements Doclet {
  70 
  71     private final HtmlDoclet htmlDoclet;
  72 
  73     public StandardDoclet() {
  74         htmlDoclet = new HtmlDoclet(this);
  75     }
  76 
  77     @Override
  78     public void init(Locale locale, Reporter reporter) {
  79         htmlDoclet.init(locale, reporter);
  80     }
  81 
  82     @Override
  83     public String getName() {
  84         return "Standard";
  85     }
  86 
  87     @Override
  88     public Set<? extends Doclet.Option> getSupportedOptions() {
  89         return htmlDoclet.getSupportedOptions();
  90     }
  91 
  92     @Override
  93     public SourceVersion getSupportedSourceVersion() {
  94         return htmlDoclet.getSupportedSourceVersion();
  95     }
  96 
  97     @Override
  98     public boolean run(DocletEnvironment docEnv) {
  99         return htmlDoclet.run(docEnv);
 100     }
 101 }