src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/DocType.java
author jjg
Thu, 16 Nov 2017 15:12:13 -0800
changeset 47848 6b1311fbbaba
parent 47216 71c04702a3d5
child 53562 0d9dee001667
permissions -rw-r--r--
8190819: Merge HtmlWriter into HtmlDocument Reviewed-by: bpatel, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     1
/*
47848
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
     2
 * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     4
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    10
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    15
 * accompanied this code).
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    16
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    20
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    23
 * questions.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    24
 */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    25
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html.markup;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    27
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    28
/**
47848
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    29
 *  Supported DOCTYPE declarations.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    30
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7641
diff changeset
    31
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7641
diff changeset
    32
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7641
diff changeset
    33
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7641
diff changeset
    34
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7641
diff changeset
    35
 *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    36
 * @author Bhavesh Patel
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    37
 */
47848
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    38
public enum DocType {
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    39
    HTML4_TRANSITIONAL("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" "
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    40
            + "\"http://www.w3.org/TR/html4/loose.dtd\">"),
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    41
    HTML5("<!DOCTYPE HTML>");
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
    42
47848
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    43
    public final String text;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    44
47848
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    45
    DocType(String text) {
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    46
        this.text = text;
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
    47
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
    48
47848
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    49
    public static DocType forVersion(HtmlVersion v) {
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    50
        switch (v) {
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    51
            case HTML4: return HTML4_TRANSITIONAL;
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    52
            case HTML5: return HTML5;
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    53
            default: throw new IllegalArgumentException();
6b1311fbbaba 8190819: Merge HtmlWriter into HtmlDocument
jjg
parents: 47216
diff changeset
    54
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    55
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    56
}