Tue, 20 Aug 2013 14:55:20 -0700
8022080: javadoc generates invalid HTML in Turkish locale
Reviewed-by: bpatel
1 /*
2 * Copyright (c) 2010, 2013, 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 */
26 package com.sun.tools.doclets.formats.html.markup;
28 import java.util.Locale;
30 /**
31 * Enum representing HTML tags.
32 *
33 * <p><b>This is NOT part of any supported API.
34 * If you write code that depends on this, you do so at your own risk.
35 * This code and its internal interfaces are subject to change or
36 * deletion without notice.</b>
37 *
38 * @author Bhavesh Patel
39 */
40 public enum HtmlTag {
41 A(BlockType.INLINE, EndTag.END),
42 BLOCKQUOTE,
43 BODY(BlockType.OTHER, EndTag.END),
44 BR(BlockType.INLINE, EndTag.NOEND),
45 CAPTION,
46 CENTER,
47 CODE(BlockType.INLINE, EndTag.END),
48 DD,
49 DIR,
50 DIV,
51 DL,
52 DT,
53 EM(BlockType.INLINE, EndTag.END),
54 FONT(BlockType.INLINE, EndTag.END),
55 FRAME(BlockType.OTHER, EndTag.NOEND),
56 FRAMESET(BlockType.OTHER, EndTag.END),
57 H1,
58 H2,
59 H3,
60 H4,
61 H5,
62 H6,
63 HEAD(BlockType.OTHER, EndTag.END),
64 HR(BlockType.BLOCK, EndTag.NOEND),
65 HTML(BlockType.OTHER, EndTag.END),
66 I(BlockType.INLINE, EndTag.END),
67 IMG(BlockType.INLINE, EndTag.NOEND),
68 LI,
69 LISTING,
70 LINK(BlockType.OTHER, EndTag.NOEND),
71 MENU,
72 META(BlockType.OTHER, EndTag.NOEND),
73 NOFRAMES(BlockType.OTHER, EndTag.END),
74 NOSCRIPT(BlockType.OTHER, EndTag.END),
75 OL,
76 P,
77 PRE,
78 SCRIPT(BlockType.OTHER, EndTag.END),
79 SMALL(BlockType.INLINE, EndTag.END),
80 SPAN(BlockType.INLINE, EndTag.END),
81 STRONG(BlockType.INLINE, EndTag.END),
82 SUB(BlockType.INLINE, EndTag.END),
83 TABLE,
84 TBODY,
85 TD,
86 TH,
87 TITLE(BlockType.OTHER, EndTag.END),
88 TR,
89 TT(BlockType.INLINE, EndTag.END),
90 UL;
92 public final BlockType blockType;
93 public final EndTag endTag;
94 public final String value;
96 /**
97 * Enum representing the type of HTML element.
98 */
99 public static enum BlockType {
100 BLOCK,
101 INLINE,
102 OTHER;
103 }
105 /**
106 * Enum representing HTML end tag requirement.
107 */
108 public static enum EndTag {
109 END,
110 NOEND;
111 }
113 HtmlTag() {
114 this(BlockType.BLOCK, EndTag.END);
115 }
117 HtmlTag(BlockType blockType, EndTag endTag ) {
118 this.blockType = blockType;
119 this.endTag = endTag;
120 this.value = name().toLowerCase(Locale.US);
121 }
123 /**
124 * Returns true if the end tag is required. This is specific to the standard
125 * doclet and does not exactly resemble the W3C specifications.
126 *
127 * @return true if end tag needs to be displayed else return false
128 */
129 public boolean endTagRequired() {
130 return (endTag == EndTag.END);
131 }
133 public String toString() {
134 return value;
135 }
136 }