author | mcimadamore |
Fri, 16 Dec 2016 15:27:47 +0000 | |
changeset 42828 | cce89649f958 |
parent 33360 | d8ef08003d35 |
child 43261 | d377e97291d8 |
permissions | -rw-r--r-- |
14952 | 1 |
/* |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
2 |
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. |
14952 | 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 com.sun.tools.doclint; |
|
27 |
||
28 |
import java.util.Collections; |
|
29 |
import java.util.EnumMap; |
|
30 |
import java.util.EnumSet; |
|
31 |
import java.util.HashMap; |
|
32 |
import java.util.Map; |
|
33360 | 33 |
import java.util.Set; |
14952 | 34 |
import javax.lang.model.element.Name; |
35 |
||
33360 | 36 |
import com.sun.tools.javac.util.StringUtils; |
25452 | 37 |
|
33360 | 38 |
import static com.sun.tools.doclint.HtmlTag.Attr.*; |
14952 | 39 |
|
40 |
/** |
|
41 |
* Enum representing HTML tags. |
|
42 |
* |
|
43 |
* The intent of this class is to embody the semantics of W3C HTML 4.01 |
|
44 |
* to the extent supported/used by javadoc. |
|
19658 | 45 |
* In time, we may wish to transition javadoc and doclint to using HTML 5. |
14952 | 46 |
* |
47 |
* This is derivative of com.sun.tools.doclets.formats.html.markup.HtmlTag. |
|
48 |
* Eventually, these two should be merged back together, and possibly made |
|
49 |
* public. |
|
50 |
* |
|
51 |
* @see <a href="http://www.w3.org/TR/REC-html40/">HTML 4.01 Specification</a> |
|
19658 | 52 |
* @see <a href="http://www.w3.org/TR/html5/">HTML 5 Specification</a> |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
53 |
* @see <a href="http://www.w3.org/TR/wai-aria/ ">WAI-ARIA Specification</a> |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
54 |
* @see <a href="http://www.w3.org/TR/aria-in-html/#recommendations-table">WAI-ARIA Recommendations Table</a> |
14952 | 55 |
* @author Bhavesh Patel |
56 |
* @author Jonathan Gibbons (revised) |
|
57 |
*/ |
|
58 |
public enum HtmlTag { |
|
59 |
A(BlockType.INLINE, EndKind.REQUIRED, |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
60 |
attrs(AttrKind.ALL, HREF, TARGET, ID), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
61 |
attrs(AttrKind.HTML4, REV, CHARSET, SHAPE, COORDS, NAME)), |
14952 | 62 |
|
25452 | 63 |
ABBR(BlockType.INLINE, EndKind.REQUIRED, |
64 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
65 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
66 |
ACRONYM(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, |
25452 | 67 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
68 |
||
69 |
ADDRESS(BlockType.INLINE, EndKind.REQUIRED, |
|
70 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
71 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
72 |
ARTICLE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
73 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
74 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
75 |
ASIDE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
76 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
77 |
|
14952 | 78 |
B(BlockType.INLINE, EndKind.REQUIRED, |
79 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
80 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
81 |
BDI(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
82 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
83 |
BIG(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
84 |
EnumSet.of(Flag.EXPECT_CONTENT)), |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
85 |
|
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
86 |
BLOCKQUOTE(BlockType.BLOCK, EndKind.REQUIRED, |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
87 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), |
14952 | 88 |
|
89 |
BODY(BlockType.OTHER, EndKind.REQUIRED), |
|
90 |
||
91 |
BR(BlockType.INLINE, EndKind.NONE, |
|
92 |
attrs(AttrKind.USE_CSS, CLEAR)), |
|
93 |
||
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
94 |
CAPTION(BlockType.TABLE_ITEM, EndKind.REQUIRED, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
95 |
EnumSet.of(Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
96 |
attrs(AttrKind.USE_CSS, ALIGN)), |
14952 | 97 |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
98 |
CENTER(HtmlVersion.HTML4, BlockType.BLOCK, EndKind.REQUIRED, |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
99 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), |
14952 | 100 |
|
101 |
CITE(BlockType.INLINE, EndKind.REQUIRED, |
|
102 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
103 |
||
104 |
CODE(BlockType.INLINE, EndKind.REQUIRED, |
|
105 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
106 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
107 |
COL(BlockType.TABLE_ITEM, EndKind.NONE, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
108 |
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF, VALIGN, WIDTH)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
109 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
110 |
COLGROUP(BlockType.TABLE_ITEM, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
111 |
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF, VALIGN, WIDTH)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
112 |
@Override |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
113 |
public boolean accepts(HtmlTag t) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
114 |
return (t == COL); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
115 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
116 |
}, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
117 |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
118 |
DD(BlockType.LIST_ITEM, EndKind.OPTIONAL, |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
119 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)), |
14952 | 120 |
|
25452 | 121 |
DEL(BlockType.INLINE, EndKind.REQUIRED, |
122 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST), |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
123 |
attrs(AttrKind.ALL, Attr.CITE, Attr.DATETIME)), |
25452 | 124 |
|
20253 | 125 |
DFN(BlockType.INLINE, EndKind.REQUIRED, |
126 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
127 |
||
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
128 |
DIV(BlockType.BLOCK, EndKind.REQUIRED, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
129 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
130 |
attrs(AttrKind.USE_CSS, ALIGN)), |
14952 | 131 |
|
132 |
DL(BlockType.BLOCK, EndKind.REQUIRED, |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
133 |
EnumSet.of(Flag.EXPECT_CONTENT), |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
134 |
attrs(AttrKind.USE_CSS, COMPACT)) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
135 |
@Override |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
136 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
137 |
return (t == DT) || (t == DD); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
138 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
139 |
}, |
14952 | 140 |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
141 |
DT(BlockType.LIST_ITEM, EndKind.OPTIONAL, |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
142 |
EnumSet.of(Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)), |
14952 | 143 |
|
144 |
EM(BlockType.INLINE, EndKind.REQUIRED, |
|
145 |
EnumSet.of(Flag.NO_NEST)), |
|
146 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
147 |
FONT(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, // tag itself is deprecated |
14952 | 148 |
EnumSet.of(Flag.EXPECT_CONTENT), |
149 |
attrs(AttrKind.USE_CSS, SIZE, COLOR, FACE)), |
|
150 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
151 |
FOOTER(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
152 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
153 |
@Override |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
154 |
public boolean accepts(HtmlTag t) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
155 |
switch (t) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
156 |
case HEADER: case FOOTER: case MAIN: |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
157 |
return false; |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
158 |
default: |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
159 |
return (t.blockType == BlockType.BLOCK) || (t.blockType == BlockType.INLINE); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
160 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
161 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
162 |
}, |
14952 | 163 |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
164 |
FIGURE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
165 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), |
14952 | 166 |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
167 |
FIGCAPTION(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
168 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
169 |
FRAME(HtmlVersion.HTML4, BlockType.OTHER, EndKind.NONE), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
170 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
171 |
FRAMESET(HtmlVersion.HTML4, BlockType.OTHER, EndKind.REQUIRED), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
172 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
173 |
H1(BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
174 |
attrs(AttrKind.USE_CSS, ALIGN)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
175 |
H2(BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
176 |
attrs(AttrKind.USE_CSS, ALIGN)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
177 |
H3(BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
178 |
attrs(AttrKind.USE_CSS, ALIGN)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
179 |
H4(BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
180 |
attrs(AttrKind.USE_CSS, ALIGN)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
181 |
H5(BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
182 |
attrs(AttrKind.USE_CSS, ALIGN)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
183 |
H6(BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
184 |
attrs(AttrKind.USE_CSS, ALIGN)), |
14952 | 185 |
|
186 |
HEAD(BlockType.OTHER, EndKind.REQUIRED), |
|
187 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
188 |
HEADER(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
189 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
190 |
@Override |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
191 |
public boolean accepts(HtmlTag t) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
192 |
switch (t) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
193 |
case HEADER: case FOOTER: case MAIN: |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
194 |
return false; |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
195 |
default: |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
196 |
return (t.blockType == BlockType.BLOCK) || (t.blockType == BlockType.INLINE); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
197 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
198 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
199 |
}, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
200 |
|
19658 | 201 |
HR(BlockType.BLOCK, EndKind.NONE, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
202 |
attrs(AttrKind.HTML4, WIDTH), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
203 |
attrs(AttrKind.USE_CSS, ALIGN, NOSHADE, SIZE)), |
14952 | 204 |
|
205 |
HTML(BlockType.OTHER, EndKind.REQUIRED), |
|
206 |
||
207 |
I(BlockType.INLINE, EndKind.REQUIRED, |
|
208 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
209 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
210 |
IFRAME(BlockType.OTHER, EndKind.REQUIRED), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
211 |
|
14952 | 212 |
IMG(BlockType.INLINE, EndKind.NONE, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
213 |
attrs(AttrKind.ALL, SRC, ALT, HEIGHT, WIDTH), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
214 |
attrs(AttrKind.HTML5, CROSSORIGIN), |
14952 | 215 |
attrs(AttrKind.OBSOLETE, NAME), |
216 |
attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)), |
|
217 |
||
25452 | 218 |
INS(BlockType.INLINE, EndKind.REQUIRED, |
219 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST), |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
220 |
attrs(AttrKind.ALL, Attr.CITE, Attr.DATETIME)), |
25452 | 221 |
|
222 |
KBD(BlockType.INLINE, EndKind.REQUIRED, |
|
223 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
224 |
||
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
225 |
LI(BlockType.LIST_ITEM, EndKind.OPTIONAL, |
18001 | 226 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE), |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
227 |
attrs(AttrKind.ALL, VALUE), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
228 |
attrs(AttrKind.USE_CSS, TYPE)), |
14952 | 229 |
|
230 |
LINK(BlockType.OTHER, EndKind.NONE), |
|
231 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
232 |
MAIN(HtmlVersion.HTML5, BlockType.OTHER, EndKind.REQUIRED), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
233 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
234 |
MARK(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
235 |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
236 |
MENU(BlockType.BLOCK, EndKind.REQUIRED) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
237 |
@Override |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
238 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
239 |
return (t == LI); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
240 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
241 |
}, |
14952 | 242 |
|
243 |
META(BlockType.OTHER, EndKind.NONE), |
|
244 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
245 |
NAV(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
246 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
247 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
248 |
NOFRAMES(HtmlVersion.HTML4, BlockType.OTHER, EndKind.REQUIRED), |
14952 | 249 |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
250 |
NOSCRIPT(BlockType.BLOCK, EndKind.REQUIRED), |
14952 | 251 |
|
252 |
OL(BlockType.BLOCK, EndKind.REQUIRED, |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
253 |
EnumSet.of(Flag.EXPECT_CONTENT), |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
254 |
attrs(AttrKind.ALL, START, TYPE), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
255 |
attrs(AttrKind.HTML5, REVERSED), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
256 |
attrs(AttrKind.USE_CSS, COMPACT)) { |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
257 |
@Override |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
258 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
259 |
return (t == LI); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
260 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
261 |
}, |
14952 | 262 |
|
263 |
P(BlockType.BLOCK, EndKind.OPTIONAL, |
|
264 |
EnumSet.of(Flag.EXPECT_CONTENT), |
|
265 |
attrs(AttrKind.USE_CSS, ALIGN)), |
|
266 |
||
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
267 |
PRE(BlockType.BLOCK, EndKind.REQUIRED, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
268 |
EnumSet.of(Flag.EXPECT_CONTENT), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
269 |
attrs(AttrKind.USE_CSS, WIDTH)) { |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
270 |
@Override |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
271 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
272 |
switch (t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
273 |
case IMG: case BIG: case SMALL: case SUB: case SUP: |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
274 |
return false; |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
275 |
default: |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
276 |
return (t.blockType == BlockType.INLINE); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
277 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
278 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
279 |
}, |
14952 | 280 |
|
25452 | 281 |
Q(BlockType.INLINE, EndKind.REQUIRED, |
282 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
283 |
||
284 |
S(BlockType.INLINE, EndKind.REQUIRED, |
|
285 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
286 |
||
287 |
SAMP(BlockType.INLINE, EndKind.REQUIRED, |
|
288 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
289 |
||
14952 | 290 |
SCRIPT(BlockType.OTHER, EndKind.REQUIRED), |
291 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
292 |
SECTION(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
293 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
294 |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
295 |
SMALL(BlockType.INLINE, EndKind.REQUIRED, |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
296 |
EnumSet.of(Flag.EXPECT_CONTENT)), |
14952 | 297 |
|
298 |
SPAN(BlockType.INLINE, EndKind.REQUIRED, |
|
299 |
EnumSet.of(Flag.EXPECT_CONTENT)), |
|
300 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
301 |
STRIKE(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, |
25452 | 302 |
EnumSet.of(Flag.EXPECT_CONTENT)), |
303 |
||
14952 | 304 |
STRONG(BlockType.INLINE, EndKind.REQUIRED, |
305 |
EnumSet.of(Flag.EXPECT_CONTENT)), |
|
306 |
||
307 |
SUB(BlockType.INLINE, EndKind.REQUIRED, |
|
308 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
309 |
||
310 |
SUP(BlockType.INLINE, EndKind.REQUIRED, |
|
311 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
312 |
||
313 |
TABLE(BlockType.BLOCK, EndKind.REQUIRED, |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
314 |
EnumSet.of(Flag.EXPECT_CONTENT), |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
315 |
attrs(AttrKind.ALL, BORDER), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
316 |
attrs(AttrKind.HTML4, SUMMARY, CELLPADDING, CELLSPACING, Attr.FRAME, RULES, WIDTH), |
19658 | 317 |
attrs(AttrKind.USE_CSS, ALIGN, BGCOLOR)) { |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
318 |
@Override |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
319 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
320 |
switch (t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
321 |
case CAPTION: |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
322 |
case COLGROUP: |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
323 |
case THEAD: case TBODY: case TFOOT: |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
324 |
case TR: // HTML 3.2 |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
325 |
return true; |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
326 |
default: |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
327 |
return false; |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
328 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
329 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
330 |
}, |
14952 | 331 |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
332 |
TBODY(BlockType.TABLE_ITEM, EndKind.REQUIRED, |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
333 |
EnumSet.of(Flag.EXPECT_CONTENT), |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
334 |
attrs(AttrKind.ALL, VALIGN), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
335 |
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF)) { |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
336 |
@Override |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
337 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
338 |
return (t == TR); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
339 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
340 |
}, |
14952 | 341 |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
342 |
TD(BlockType.TABLE_ITEM, EndKind.OPTIONAL, |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
343 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE), |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
344 |
attrs(AttrKind.ALL, COLSPAN, ROWSPAN, HEADERS, VALIGN), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
345 |
attrs(AttrKind.HTML4, AXIS, Attr.ABBR, SCOPE, ALIGN, CHAR, CHAROFF), |
14952 | 346 |
attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)), |
347 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
348 |
TEMPLATE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
349 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
350 |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
351 |
TFOOT(BlockType.TABLE_ITEM, EndKind.REQUIRED, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
352 |
attrs(AttrKind.ALL, VALIGN), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
353 |
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF)) { |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
354 |
@Override |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
355 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
356 |
return (t == TR); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
357 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
358 |
}, |
14952 | 359 |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
360 |
TH(BlockType.TABLE_ITEM, EndKind.OPTIONAL, |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
361 |
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE), |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
362 |
attrs(AttrKind.ALL, COLSPAN, ROWSPAN, HEADERS, SCOPE, Attr.ABBR, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
363 |
VALIGN), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
364 |
attrs(AttrKind.HTML4, AXIS, ALIGN, CHAR, CHAROFF), |
14952 | 365 |
attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)), |
366 |
||
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
367 |
THEAD(BlockType.TABLE_ITEM, EndKind.REQUIRED, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
368 |
attrs(AttrKind.ALL, VALIGN), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
369 |
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF)) { |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
370 |
@Override |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
371 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
372 |
return (t == TR); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
373 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
374 |
}, |
14952 | 375 |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
376 |
TIME(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
377 |
|
14952 | 378 |
TITLE(BlockType.OTHER, EndKind.REQUIRED), |
379 |
||
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
380 |
TR(BlockType.TABLE_ITEM, EndKind.OPTIONAL, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
381 |
attrs(AttrKind.ALL, VALIGN), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
382 |
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF), |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
383 |
attrs(AttrKind.USE_CSS, BGCOLOR)) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
384 |
@Override |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
385 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
386 |
return (t == TH) || (t == TD); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
387 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
388 |
}, |
14952 | 389 |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
390 |
TT(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, |
14952 | 391 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
392 |
||
393 |
U(BlockType.INLINE, EndKind.REQUIRED, |
|
394 |
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), |
|
395 |
||
396 |
UL(BlockType.BLOCK, EndKind.REQUIRED, |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
397 |
EnumSet.of(Flag.EXPECT_CONTENT), |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
398 |
attrs(AttrKind.HTML4, COMPACT, TYPE)) { |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
399 |
@Override |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
400 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
401 |
return (t == LI); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
402 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
403 |
}, |
14952 | 404 |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
405 |
WBR(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED), |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
406 |
|
14952 | 407 |
VAR(BlockType.INLINE, EndKind.REQUIRED); |
408 |
||
409 |
/** |
|
410 |
* Enum representing the type of HTML element. |
|
411 |
*/ |
|
412 |
public static enum BlockType { |
|
413 |
BLOCK, |
|
414 |
INLINE, |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
415 |
LIST_ITEM, |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
416 |
TABLE_ITEM, |
22163 | 417 |
OTHER |
14952 | 418 |
} |
419 |
||
420 |
/** |
|
421 |
* Enum representing HTML end tag requirement. |
|
422 |
*/ |
|
423 |
public static enum EndKind { |
|
424 |
NONE, |
|
425 |
OPTIONAL, |
|
22163 | 426 |
REQUIRED |
14952 | 427 |
} |
428 |
||
429 |
public static enum Flag { |
|
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
430 |
ACCEPTS_BLOCK, |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
431 |
ACCEPTS_INLINE, |
14952 | 432 |
EXPECT_CONTENT, |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
433 |
NO_NEST |
14952 | 434 |
} |
435 |
||
436 |
public static enum Attr { |
|
437 |
ABBR, |
|
438 |
ALIGN, |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
439 |
ALINK, |
14952 | 440 |
ALT, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
441 |
ARIA_ACTIVEDESCENDANT, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
442 |
ARIA_CONTROLS, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
443 |
ARIA_DESCRIBEDBY, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
444 |
ARIA_EXPANDED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
445 |
ARIA_LABEL, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
446 |
ARIA_LABELLEDBY, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
447 |
ARIA_LEVEL, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
448 |
ARIA_MULTISELECTABLE, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
449 |
ARIA_OWNS, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
450 |
ARIA_POSINSET, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
451 |
ARIA_SETSIZE, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
452 |
ARIA_READONLY, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
453 |
ARIA_REQUIRED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
454 |
ARIA_SELECTED, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
455 |
ARIA_SORT, |
14952 | 456 |
AXIS, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
457 |
BACKGROUND, |
14952 | 458 |
BGCOLOR, |
459 |
BORDER, |
|
460 |
CELLSPACING, |
|
461 |
CELLPADDING, |
|
462 |
CHAR, |
|
463 |
CHAROFF, |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
464 |
CHARSET, |
25452 | 465 |
CITE, |
14952 | 466 |
CLEAR, |
467 |
CLASS, |
|
468 |
COLOR, |
|
469 |
COLSPAN, |
|
470 |
COMPACT, |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
471 |
COORDS, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
472 |
CROSSORIGIN, |
25452 | 473 |
DATETIME, |
14952 | 474 |
FACE, |
475 |
FRAME, |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
476 |
FRAMEBORDER, |
14952 | 477 |
HEADERS, |
478 |
HEIGHT, |
|
479 |
HREF, |
|
480 |
HSPACE, |
|
481 |
ID, |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
482 |
LINK, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
483 |
LONGDESC, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
484 |
MARGINHEIGHT, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
485 |
MARGINWIDTH, |
14952 | 486 |
NAME, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
487 |
NOSHADE, |
14952 | 488 |
NOWRAP, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
489 |
PROFILE, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
490 |
REV, |
14952 | 491 |
REVERSED, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
492 |
ROLE, |
14952 | 493 |
ROWSPAN, |
494 |
RULES, |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
495 |
SCHEME, |
14952 | 496 |
SCOPE, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
497 |
SCROLLING, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
498 |
SHAPE, |
14952 | 499 |
SIZE, |
500 |
SPACE, |
|
501 |
SRC, |
|
502 |
START, |
|
503 |
STYLE, |
|
504 |
SUMMARY, |
|
505 |
TARGET, |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
506 |
TEXT, |
14952 | 507 |
TYPE, |
508 |
VALIGN, |
|
18001 | 509 |
VALUE, |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
510 |
VERSION, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
511 |
VLINK, |
14952 | 512 |
VSPACE, |
513 |
WIDTH; |
|
514 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
515 |
private final String name; |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
516 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
517 |
Attr() { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
518 |
name = StringUtils.toLowerCase(name().replace("_", "-")); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
519 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
520 |
|
14952 | 521 |
public String getText() { |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
522 |
return name; |
14952 | 523 |
} |
524 |
||
22163 | 525 |
static final Map<String,Attr> index = new HashMap<>(); |
14952 | 526 |
static { |
527 |
for (Attr t: values()) { |
|
15370 | 528 |
index.put(t.getText(), t); |
14952 | 529 |
} |
530 |
} |
|
531 |
} |
|
532 |
||
533 |
public static enum AttrKind { |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
534 |
HTML4, |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
535 |
HTML5, |
14952 | 536 |
INVALID, |
537 |
OBSOLETE, |
|
538 |
USE_CSS, |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
539 |
ALL |
14952 | 540 |
} |
541 |
||
542 |
// This class exists to avoid warnings from using parameterized vararg type |
|
543 |
// Map<Attr,AttrKind> in signature of HtmlTag constructor. |
|
544 |
private static class AttrMap extends EnumMap<Attr,AttrKind> { |
|
545 |
private static final long serialVersionUID = 0; |
|
546 |
AttrMap() { |
|
547 |
super(Attr.class); |
|
548 |
} |
|
549 |
} |
|
550 |
||
551 |
||
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
552 |
public final HtmlVersion allowedVersion; |
14952 | 553 |
public final BlockType blockType; |
554 |
public final EndKind endKind; |
|
555 |
public final Set<Flag> flags; |
|
556 |
private final Map<Attr,AttrKind> attrs; |
|
557 |
||
558 |
HtmlTag(BlockType blockType, EndKind endKind, AttrMap... attrMaps) { |
|
42828
cce89649f958
8171371: Remove redundant type-arguments from generic method calls
mcimadamore
parents:
33360
diff
changeset
|
559 |
this(HtmlVersion.ALL, blockType, endKind, Collections.emptySet(), attrMaps); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
560 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
561 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
562 |
HtmlTag(HtmlVersion allowedVersion, BlockType blockType, EndKind endKind, AttrMap... attrMaps) { |
42828
cce89649f958
8171371: Remove redundant type-arguments from generic method calls
mcimadamore
parents:
33360
diff
changeset
|
563 |
this(allowedVersion, blockType, endKind, Collections.emptySet(), attrMaps); |
14952 | 564 |
} |
565 |
||
566 |
HtmlTag(BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) { |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
567 |
this(HtmlVersion.ALL, blockType, endKind, flags, attrMaps); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
568 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
569 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
570 |
HtmlTag(HtmlVersion allowedVersion, BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
571 |
this.allowedVersion = allowedVersion; |
14952 | 572 |
this.blockType = blockType; |
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
573 |
this.endKind = endKind; |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
574 |
this.flags = flags; |
22163 | 575 |
this.attrs = new EnumMap<>(Attr.class); |
14952 | 576 |
for (Map<Attr,AttrKind> m: attrMaps) |
577 |
this.attrs.putAll(m); |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
578 |
attrs.put(Attr.CLASS, AttrKind.ALL); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
579 |
attrs.put(Attr.ID, AttrKind.ALL); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
580 |
attrs.put(Attr.STYLE, AttrKind.ALL); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
581 |
attrs.put(Attr.ROLE, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
582 |
// for now, assume that all ARIA attributes are allowed on all tags. |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
583 |
attrs.put(Attr.ARIA_ACTIVEDESCENDANT, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
584 |
attrs.put(Attr.ARIA_CONTROLS, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
585 |
attrs.put(Attr.ARIA_DESCRIBEDBY, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
586 |
attrs.put(Attr.ARIA_EXPANDED, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
587 |
attrs.put(Attr.ARIA_LABEL, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
588 |
attrs.put(Attr.ARIA_LABELLEDBY, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
589 |
attrs.put(Attr.ARIA_LEVEL, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
590 |
attrs.put(Attr.ARIA_MULTISELECTABLE, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
591 |
attrs.put(Attr.ARIA_OWNS, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
592 |
attrs.put(Attr.ARIA_POSINSET, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
593 |
attrs.put(Attr.ARIA_READONLY, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
594 |
attrs.put(Attr.ARIA_REQUIRED, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
595 |
attrs.put(Attr.ARIA_SELECTED, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
596 |
attrs.put(Attr.ARIA_SETSIZE, AttrKind.HTML5); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
597 |
attrs.put(Attr.ARIA_SORT, AttrKind.HTML5); |
14952 | 598 |
} |
599 |
||
15371
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
600 |
public boolean accepts(HtmlTag t) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
601 |
if (flags.contains(Flag.ACCEPTS_BLOCK) && flags.contains(Flag.ACCEPTS_INLINE)) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
602 |
return (t.blockType == BlockType.BLOCK) || (t.blockType == BlockType.INLINE); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
603 |
} else if (flags.contains(Flag.ACCEPTS_BLOCK)) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
604 |
return (t.blockType == BlockType.BLOCK); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
605 |
} else if (flags.contains(Flag.ACCEPTS_INLINE)) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
606 |
return (t.blockType == BlockType.INLINE); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
607 |
} else |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
608 |
switch (blockType) { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
609 |
case BLOCK: |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
610 |
case INLINE: |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
611 |
return (t.blockType == BlockType.INLINE); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
612 |
case OTHER: |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
613 |
// OTHER tags are invalid in doc comments, and will be |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
614 |
// reported separately, so silently accept/ignore any content |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
615 |
return true; |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
616 |
default: |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
617 |
// any combination which could otherwise arrive here |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
618 |
// ought to have been handled in an overriding method |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
619 |
throw new AssertionError(this + ":" + t); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
620 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
621 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
622 |
|
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
623 |
public boolean acceptsText() { |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
624 |
// generally, anywhere we can put text we can also put inline tag |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
625 |
// so check if a typical inline tag is allowed |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
626 |
return accepts(B); |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
627 |
} |
8f719dc43e1f
8006251: doclint: incorrect position for diagnostic for illegal text in tags
jjg
parents:
15370
diff
changeset
|
628 |
|
14952 | 629 |
public String getText() { |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
20253
diff
changeset
|
630 |
return StringUtils.toLowerCase(name()); |
14952 | 631 |
} |
632 |
||
633 |
public Attr getAttr(Name attrName) { |
|
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
20253
diff
changeset
|
634 |
return Attr.index.get(StringUtils.toLowerCase(attrName.toString())); |
14952 | 635 |
} |
636 |
||
637 |
public AttrKind getAttrKind(Name attrName) { |
|
638 |
AttrKind k = attrs.get(getAttr(attrName)); // null-safe |
|
639 |
return (k == null) ? AttrKind.INVALID : k; |
|
640 |
} |
|
641 |
||
642 |
private static AttrMap attrs(AttrKind k, Attr... attrs) { |
|
643 |
AttrMap map = new AttrMap(); |
|
644 |
for (Attr a: attrs) map.put(a, k); |
|
645 |
return map; |
|
646 |
} |
|
647 |
||
33360 | 648 |
private static final Map<String, HtmlTag> index = new HashMap<>(); |
14952 | 649 |
static { |
650 |
for (HtmlTag t: values()) { |
|
15370 | 651 |
index.put(t.getText(), t); |
14952 | 652 |
} |
653 |
} |
|
654 |
||
33360 | 655 |
public static HtmlTag get(Name tagName) { |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
20253
diff
changeset
|
656 |
return index.get(StringUtils.toLowerCase(tagName.toString())); |
19511
59a48a75fac7
8022080: javadoc generates invalid HTML in Turkish locale
jjg
parents:
18001
diff
changeset
|
657 |
} |
14952 | 658 |
} |