提交 771569ad 编写于 作者: L lana

Merge

...@@ -531,6 +531,17 @@ public class Checker extends DocTreePathScanner<Void, Void> { ...@@ -531,6 +531,17 @@ public class Checker extends DocTreePathScanner<Void, Void> {
} }
} }
break; break;
case VALUE:
if (currTag == HtmlTag.LI) {
String v = getAttrValue(tree);
if (v == null || v.isEmpty()) {
env.messages.error(HTML, tree, "dc.attr.lacks.value");
} else if (!validNumber.matcher(v).matches()) {
env.messages.error(HTML, tree, "dc.attr.not.number");
}
}
break;
} }
} }
} }
...@@ -543,6 +554,8 @@ public class Checker extends DocTreePathScanner<Void, Void> { ...@@ -543,6 +554,8 @@ public class Checker extends DocTreePathScanner<Void, Void> {
// http://www.w3.org/TR/html401/types.html#type-name // http://www.w3.org/TR/html401/types.html#type-name
private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*"); private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*");
private static final Pattern validNumber = Pattern.compile("-?[0-9]+");
// pattern to remove leading {@docRoot}/? // pattern to remove leading {@docRoot}/?
private static final Pattern docRoot = Pattern.compile("(?i)(\\{@docRoot *\\}/?)?(.*)"); private static final Pattern docRoot = Pattern.compile("(?i)(\\{@docRoot *\\}/?)?(.*)");
......
...@@ -131,7 +131,8 @@ public enum HtmlTag { ...@@ -131,7 +131,8 @@ public enum HtmlTag {
attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)), attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)),
LI(BlockType.LIST_ITEM, EndKind.OPTIONAL, LI(BlockType.LIST_ITEM, EndKind.OPTIONAL,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
attrs(AttrKind.OK, VALUE)),
LINK(BlockType.OTHER, EndKind.NONE), LINK(BlockType.OTHER, EndKind.NONE),
...@@ -339,6 +340,7 @@ public enum HtmlTag { ...@@ -339,6 +340,7 @@ public enum HtmlTag {
TARGET, TARGET,
TYPE, TYPE,
VALIGN, VALIGN,
VALUE,
VSPACE, VSPACE,
WIDTH; WIDTH;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
dc.anchor.already.defined = anchor already defined: {0} dc.anchor.already.defined = anchor already defined: {0}
dc.anchor.value.missing = no value given for anchor dc.anchor.value.missing = no value given for anchor
dc.attr.lacks.value = attribute lacks value dc.attr.lacks.value = attribute lacks value
dc.attr.not.number = attribute value is not a number
dc.attr.obsolete = attribute obsolete: {0} dc.attr.obsolete = attribute obsolete: {0}
dc.attr.obsolete.use.css = attribute obsolete, use CSS instead: {0} dc.attr.obsolete.use.css = attribute obsolete, use CSS instead: {0}
dc.attr.repeated = repeated attribute: {0} dc.attr.repeated = repeated attribute: {0}
......
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * @test /nodynamiccopyright/
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @bug 8006251 8013405
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8006251
* @summary test list tags * @summary test list tags
* @library .. * @library ..
* @build DocLintTester * @build DocLintTester
* @run main DocLintTester -Xmsgs ListTagsTest.java * @run main DocLintTester -Xmsgs -ref ListTagsTest.out ListTagsTest.java
*/ */
/** */ /** */
...@@ -35,6 +12,9 @@ public class ListTagsTest { ...@@ -35,6 +12,9 @@ public class ListTagsTest {
/** /**
* <dl> <dt> abc <dd> def </dl> * <dl> <dt> abc <dd> def </dl>
* <ol> <li> abc </ol> * <ol> <li> abc </ol>
* <ol> <li value="1"> abc </ol>
* <ol> <li value> bad </ol>
* <ol> <li value="a"> bad </ol>
* <ul> <li> abc </ul> * <ul> <li> abc </ul>
*/ */
public void supportedTags() { } public void supportedTags() { }
......
ListTagsTest.java:16: error: attribute lacks value
* <ol> <li value> bad </ol>
^
ListTagsTest.java:17: error: attribute value is not a number
* <ol> <li value="a"> bad </ol>
^
2 errors
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册