Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit 82be2f2

Browse files
issue 92: capitalized element names break XML highlighting
1 parent c059069 commit 82be2f2

File tree

3 files changed

+77
-3
lines changed

3 files changed

+77
-3
lines changed

CHANGES.html

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
</head>
66
<body bgcolor="white">
77
<a style="float:right" href="README.html">README</a>
8+
9+
<h1>Known Issues</h1>
10+
<ul>
11+
<li>Perl formatting is really crappy. Partly because the author is lazy and
12+
partly because Perl is
13+
<a href="http://www.perlmonks.org/?node_id=663393">hard</a> to parse.
14+
<li>On some browsers, <code>&lt;code&gt;</code> elements with newlines in the text
15+
which use CSS to specify <code>white-space:pre</code> will have the newlines
16+
improperly stripped if the element is not attached to the document at the time
17+
the stripping is done. Also, on IE 6, all newlines will be stripped from
18+
<code>&lt;code&gt;</code> elements because of the way IE6 produces
19+
<code>innerHTML</code>. Workaround: use <code>&lt;pre&gt;</code> for code with
20+
newlines.
21+
</ul>
22+
823
<h1>Change Log</h1>
924
<h2>29 March 2007</h2>
1025
<ul>
@@ -62,7 +77,7 @@ <h2>6 Jan 2009</h2>
6277
<ul>
6378
<li>Language handlers for Visual Basic, Haskell, CSS, and WikiText</li>
6479
<li>Added <tt>.mxml</tt> extension to the markup style handler for
65-
Flex <a href="http://en.wikipedia.org/wiki/MXML">MXML files</a>. See
80+
Flex <a href="http://en.wikipedia.org/wiki/MXML">MXML files</a>. See
6681
<a
6782
href="http://code.google.com/p/google-code-prettify/issues/detail?id=37"
6883
>issue 37</a>.
@@ -83,5 +98,13 @@ <h2>21 May 2009</h2>
8398
number literals, Lua strings, C preprocessor directives,
8499
newlines in Wiki code on Windows, and newlines in IE6.</li>
85100
</ul>
101+
<h2>14 August</h2>
102+
<ul>
103+
<li>Fixed prettifying of <code>&lt;code&gt;</code> blocks with embedded newlines.
104+
</ul>
105+
<h2>3 October</h2>
106+
<ul>
107+
<li>Fixed prettifying of XML/HTML tags that contain uppercase letters.
108+
</ul>
86109
</body>
87110
</html>

src/prettify.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ window['_pr_isIE6'] = function () {
11931193
[PR_ATTRIB_VALUE, /^(?:\"[^\"]*\"?|\'[^\']*\'?)/, null, '\"\'']
11941194
],
11951195
[
1196-
[PR_TAG, /^^<\/?[a-z](?:[\w:-]*\w)?|\/?>$/],
1196+
[PR_TAG, /^^<\/?[a-z](?:[\w:-]*\w)?|\/?>$/i],
11971197
[PR_ATTRIB_NAME, /^(?!style\b|on)[a-z](?:[\w:-]*\w)?/],
11981198
['lang-uq.val', /^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],
11991199
[PR_PUNCTUATION, /^[=<>\/]+/],

tests/prettify_test.html

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,26 @@ <h1>CSS w/ language specified</h1>
10131013
--&gt;
10141014
</pre>
10151015

1016+
<h1>Issue 79 CSS highlighting</h1>
1017+
<pre class=prettyprint>
1018+
&lt;style type='text/css'>
1019+
/* desert scheme ported from vim to google prettify */
1020+
code.prettyprint { display: block; padding: 2px; border: 1px solid #888;
1021+
background-color: #333; }
1022+
.str { color: #ffa0a0; } /* string - pink */
1023+
.kwd { color: #f0e68c; font-weight: bold; }
1024+
.com { color: #87ceeb; } /* comment - skyblue */
1025+
.typ { color: #98fb98; } /* type - lightgreen */
1026+
.lit { color: #cd5c5c; } /* literal - darkred */
1027+
.pun { color: #fff; } /* punctuation */
1028+
.pln { color: #fff; } /* plaintext */
1029+
.tag { color: #f0e68c; font-weight: bold; } /* html/xml tag - lightyellow*/
1030+
.atn { color: #bdb76b; font-weight: bold; } /* attribute name - khaki*/
1031+
.atv { color: #ffa0a0; } /* attribute value - pink */
1032+
.dec { color: #98fb98; } /* decimal - lightgreen */
1033+
&lt;/style>
1034+
</pre>
1035+
10161036
<h1>Issue 84 NBSPs</h1>
10171037
<pre class="prettyprint lang-java" id="issue84">super("&amp;nbsp;");</pre>
10181038

@@ -1029,6 +1049,21 @@ <h1>Issue 86</h1>
10291049
Two lines</xmp>
10301050
<p><code class="prettyprint" id="issue86_5">#One<br>
10311051
Two lines</code></p>
1052+
1053+
<h1>Issue 92</h1>
1054+
<pre class="prettyprint" id="issue92">
1055+
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
1056+
&lt;kml xmlns="http://www.opengis.net/kml/2.2"&gt;
1057+
&lt;Placemark&gt;
1058+
&lt;name&gt;Simple placemark&lt;/name&gt;
1059+
&lt;description&gt;Attached to the ground. Intelligently places itself
1060+
at the height of the underlying terrain.&lt;/description&gt;
1061+
&lt;Point&gt;
1062+
&lt;coordinates&gt;-122.0822035425683,37.42228990140251,0&lt;/coordinates&gt;
1063+
&lt;/Point&gt;
1064+
&lt;/Placemark&gt;
1065+
&lt;/kml&gt;
1066+
</pre>
10321067
</body>
10331068

10341069
<script type="text/javascript">
@@ -2402,7 +2437,23 @@ <h1>Issue 86</h1>
24022437
issue86_3: '`COM#One`END`PLN<br>' +
24032438
'`END`TYPTwo`END`PLN lines`END',
24042439
issue86_4: '`COM#One`END`PLN<br>' +
2405-
'`END`TYPTwo`END`PLN lines`END'
2440+
'`END`TYPTwo`END`PLN lines`END',
2441+
issue92: '`PUN&lt;?`END`PLNxml version`END`PUN=`END`STR"1.0"`END`PLN encoding`END`PUN=`END ' +
2442+
'`STR"UTF-8"`END`PUN?&gt;`END`PLN<br>' +
2443+
'`END`TAG&lt;kml`END`PLN `END`ATNxmlns`END`PUN=`END`ATV"http://www.opengis.net/kml/2.2"`END ' +
2444+
'`TAG&gt;`END`PLN<br>' +
2445+
'&nbsp; `END`TAG&lt;Placemark&gt;`END`PLN<br>' +
2446+
'&nbsp; &nbsp; `END`TAG&lt;name&gt;`END`PLNSimple placemark`END`TAG&lt;/name&gt;`END`PLN<br>' +
2447+
'&nbsp; &nbsp; `END`TAG&lt;description&gt;`END`PLNAttached to the ground. ' +
2448+
' Intelligently places itself <br>' +
2449+
'&nbsp; &nbsp; &nbsp; &nbsp;at the height of the underlying terrain.`END ' +
2450+
'`TAG&lt;/description&gt;`END`PLN<br>' +
2451+
'&nbsp; &nbsp; `END`TAG&lt;Point&gt;`END`PLN<br>' +
2452+
'&nbsp; &nbsp; &nbsp; `END`TAG&lt;coordinates&gt;`END ' +
2453+
'`PLN-122.0822035425683,37.42228990140251,0`END`TAG&lt;/coordinates&gt;`END`PLN<br>' +
2454+
'&nbsp; &nbsp; `END`TAG&lt;/Point&gt;`END`PLN<br>' +
2455+
'&nbsp; `END`TAG&lt;/Placemark&gt;`END`PLN<br>' +
2456+
'`END`TAG&lt;/kml&gt;`END'
24062457
};
24072458
</script>
24082459

0 commit comments

Comments
 (0)