Skip to content

Commit a9f20c1

Browse files
idodeclareVladimir Kotal
authored andcommitted
Use HTML5 DOCTYPE, as XHTML was not at all confirming anyway
Fixes #1296
1 parent acee724 commit a9f20c1

File tree

88 files changed

+287
-476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+287
-476
lines changed

src/org/opensolaris/opengrok/analysis/JFlexXrefUtils.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@
4949
*/
5050
public class JFlexXrefUtils {
5151

52+
/**
53+
* Matches an HTML 5 ID or Name:
54+
* <pre>
55+
* {@code
56+
* (?U)^\S+$
57+
* }
58+
* </pre>
59+
* (Edit above and paste below [in NetBeans] for easy String escaping.)
60+
*/
61+
private static final Pattern HTML5_ID_NAME = Pattern.compile("(?U)^\\S+$");
62+
5263
/**
5364
* Appends the {@code url} to the specified {@code out} {@link Writer}.
5465
* <p>If {@code doEndingPushback} is true, then
@@ -259,12 +270,14 @@ public static boolean writeSymbol(Writer out, Definitions defs,
259270
// this file? Otherwise, we may end up with multiple anchors with
260271
// the same name.)
261272
//
262-
// Note: In HTML 4, the name must start with a letter, and can
263-
// only contain letters, digits, hyphens, underscores, colons,
264-
// and periods. https://www.w3.org/TR/html4/types.html#type-name
265273
// Skip the anchor if the symbol name is not a valid anchor
266-
// name. This restriction is lifted in HTML 5.
267-
if (symbol.matches("[a-zA-Z][a-zA-Z0-9_:.-]*")) {
274+
// name. Note: In HTML 5, an ID or Name can be any string, with
275+
// the following restrictions: must be at least one character
276+
// long, must not contain any space characters.
277+
// https://www.w3.org/TR/2010/WD-html-markup-20100624/datatypes.html
278+
// Formerly for HTML 4, ID and Name were very restricted, as
279+
// explained by @tulinkry.
280+
if (HTML5_ID_NAME.matcher(symbol).matches()) {
268281
out.append("<a class=\"");
269282
out.append(style_class);
270283
out.append("\" name=\"");

test/org/opensolaris/opengrok/analysis/ada/AdaXrefTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,10 @@ private int writeAdaXref(InputStream iss, PrintStream oss)
8686
}
8787

8888
private String getHtmlBegin() {
89-
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
90-
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" +
91-
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" +
92-
"<html xmlns=\"http://www.w3.org/1999/xhtml\"" +
93-
" xml:lang=\"en\" lang=\"en\"\n" +
94-
" class=\"xref\">\n" +
89+
return "<!DOCTYPE html>\n" +
90+
"<html>\n" +
9591
"<head>\n" +
92+
"<meta charset=\"UTF-8\">\n" +
9693
"<title>sampleFile - OpenGrok cross reference" +
9794
" for /sampleFile</title></head><body>\n";
9895
}

test/org/opensolaris/opengrok/analysis/ada/ada_xrefres.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
5-
class="xref">
1+
<!DOCTYPE html>
2+
<html>
63
<head>
4+
<meta charset="UTF-8">
75
<title>sampleFile - OpenGrok cross reference for /sampleFile</title></head><body>
86
<a class="l" name="1" href="#1">1</a><span class="c">--</span>
97
<a class="l" name="2" href="#2">2</a><span class="c">-- CDDL HEADER START</span>

test/org/opensolaris/opengrok/analysis/c/CXrefTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,10 @@ private Definitions getTagsDefinitions() throws IOException {
109109
}
110110

111111
private static String getHtmlBegin() {
112-
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
113-
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" +
114-
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" +
115-
"<html xmlns=\"http://www.w3.org/1999/xhtml\"" +
116-
" xml:lang=\"en\" lang=\"en\"\n" +
117-
" class=\"xref\">\n" +
112+
return "<!DOCTYPE html>\n" +
113+
"<html>\n" +
118114
"<head>\n" +
115+
"<meta charset=\"UTF-8\">\n" +
119116
"<title>sampleFile - OpenGrok cross reference" +
120117
" for /sampleFile</title></head><body>\n";
121118
}

test/org/opensolaris/opengrok/analysis/c/CxxXrefTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,10 @@ private Definitions getTagsDefinitions() throws IOException {
108108
}
109109

110110
private static String getHtmlBegin() {
111-
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
112-
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" +
113-
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" +
114-
"<html xmlns=\"http://www.w3.org/1999/xhtml\"" +
115-
" xml:lang=\"en\" lang=\"en\"\n" +
116-
" class=\"xref\">\n" +
111+
return "<!DOCTYPE html>\n" +
112+
"<html>\n" +
117113
"<head>\n" +
114+
"<meta charset=\"UTF-8\">\n" +
118115
"<title>sampleFile - OpenGrok cross reference" +
119116
" for /sampleFile</title></head><body>\n";
120117
}

test/org/opensolaris/opengrok/analysis/c/c_xrefres.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
5-
class="xref">
1+
<!DOCTYPE html>
2+
<html>
63
<head>
4+
<meta charset="UTF-8">
75
<title>sampleFile - OpenGrok cross reference for /sampleFile</title></head><body>
86
<script type="text/javascript">/* <![CDATA[ */
97
function get_sym_list(){return [["Function","xf",[["abstime_to_reltime",70],["hrt2ts",40]]]];} /* ]]> */</script><a class="l" name="1" href="#1">1</a><span class='fold-space'>&nbsp;</span><span class="c">/*

test/org/opensolaris/opengrok/analysis/c/cc_xrefres.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
5-
class="xref">
1+
<!DOCTYPE html>
2+
<html>
63
<head>
4+
<meta charset="UTF-8">
75
<title>sampleFile - OpenGrok cross reference for /sampleFile</title></head><body>
86
<script type="text/javascript">/* <![CDATA[ */
97
function get_sym_list(){return [["Function","xf",[["Ancestor",37],["addInstance",84],["createTaggedAncestor",183],["definitionContains",223],["getDef",112],["getFieldName",100],["getInstOffset",124],["getNumInstances",118],["getPath",133],["getTag",106],["listTaggedAncestors",143],["~Ancestor",51]]]];} /* ]]> */</script><a class="l" name="1" href="#1">1</a><span class='fold-space'>&nbsp;</span><span class="c">/*

test/org/opensolaris/opengrok/analysis/clojure/ClojureXrefTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,10 @@ private Definitions getTagsDefinitions() throws IOException {
126126
}
127127

128128
private static String getHtmlBegin() {
129-
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
130-
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" +
131-
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" +
132-
"<html xmlns=\"http://www.w3.org/1999/xhtml\"" +
133-
" xml:lang=\"en\" lang=\"en\"\n" +
134-
" class=\"xref\">\n" +
129+
return "<!DOCTYPE html>\n" +
130+
"<html>\n" +
135131
"<head>\n" +
132+
"<meta charset=\"UTF-8\">\n" +
136133
"<title>sampleFile - OpenGrok cross reference" +
137134
" for /sampleFile</title></head><body>\n";
138135
}

test/org/opensolaris/opengrok/analysis/clojure/sample_xref.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
5-
class="xref">
1+
<!DOCTYPE html>
2+
<html>
63
<head>
4+
<meta charset="UTF-8">
75
<title>sampleFile - OpenGrok cross reference for /sampleFile</title></head><body>
86
<script type="text/javascript">/* <![CDATA[ */
97
function get_sym_list(){return [["Namespace","xn",[["koans.23-meta",195]]]];} /* ]]> */</script><a class="l" name="1" href="#1">1</a><span class="c">; Eclipse Public License, Version 1.0 (EPL-1.0) (plain text) THE ACCOMPANYING</span>
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
5-
class="xref">
1+
<!DOCTYPE html>
2+
<html>
63
<head>
4+
<meta charset="UTF-8">
75
<title>sampleFile - OpenGrok cross reference for /sampleFile</title></head><body>
86
<a class="l" name="1" href="#1">1</a> <span class="s">&quot;Oops this string never end</span></body>
97
</html>

0 commit comments

Comments
 (0)