Commit d7ab5ac6bc288ae3b75ac3da8ead6019942fc2d7

Golmote 2014-12-21T15:35:47

Examples work in progress

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
diff --git a/examples.html b/examples.html
index da1a3dc..82b37a7 100644
--- a/examples.html
+++ b/examples.html
@@ -88,389 +88,7 @@
 	<h1>Per language examples</h1>
 	<div id="languages"></div>
 </section>
-<div id="examples"></div>
-
-<section class="language-markup">
-	<h1>Markup</h1>
-
-	<h2>Empty tag</h2>
-	<pre><code>&lt;p>&lt;/p></code></pre>
-
-	<h2>Tag that spans multiple lines</h2>
-	<pre><code>&lt;p
->hello!
-&lt;/p></code></pre>
-
-	<h2>Name-attribute pair</h2>
-	<pre><code>&lt;p>&lt;/p></code></pre>
-
-	<h2>Name-attribute pair without quotes</h2>
-	<pre><code>&lt;p class=prism>&lt;/p></code></pre>
-
-	<h2>Attribute without value</h2>
-	<pre><code>&lt;p data-foo>&lt;/p></code></pre>
-	<pre><code>&lt;p data-foo >&lt;/p></code></pre>
-
-	<h2>Namespaces</h2>
-	<pre><code>&lt;html:p foo:bar="baz" foo:weee>&lt;/html:p></code></pre>
-
-	<h2>XML prolog</h2>
-	<pre><code>&lt;?xml version="1.0" encoding="utf-8"?>
-&lt;svg>&lt;/svg></code></pre>
-
-	<h2>DOCTYPE</h2>
-	<pre><code>&lt;!DOCTYPE html>
-&lt;html>&lt;/html></code></pre>
-
-	<h2>CDATA section</h2>
-	<pre><code>&lt;ns1:description>&lt;![CDATA[
-  CDATA is &lt;not> magical.
-]]>&lt;/ns1:description></code></pre>
-
-	<h2>Comment</h2>
-	<pre><code>&lt;!-- I'm a comment -->
-And i'm not</code></pre>
-
-	<h2>Entities</h2>
-	<pre><code>&amp;amp; &amp;#x2665; &amp;#160; &amp;#x152;</code></pre>
-
-	<h2>Embedded JS and CSS</h2>
-	<pre><code>&lt;!DOCTYPE html>
-&lt;html lang="en">
-&lt;head>
-	&lt;meta charset="utf-8" />
-	&lt;title>I can haz embedded CSS and JS&lt;/title>
-	&lt;style>
-		@media print {
-			p { color: red !important; }
-		}
-	&lt;/style>
-&lt;/head>
-&lt;body>
-	&lt;h1>I can haz embedded CSS and JS&lt;/h1>
-	&lt;script>
-	if (true) {
-		console.log('foo');
-	}
-	&lt;/script>
-
-&lt;/body>
-&lt;/html></code></pre>
-
-	<h2>Invalid HTML</h2>
-	<pre><code>&lt;l &lt;/ul></code></pre>
-
-	<h2>Multi-line attribute values</h2>
-	<pre><code>&lt;p title="foo
-bar
-baz"></code></pre>
-</section>
-
-<section class="language-css">
-	<h1>CSS</h1>
-
-	<h2>Empty rule</h2>
-	<pre><code>*{} * {} p {}</code></pre>
-	<pre><code>ul,
-ol {}</code></pre>
-
-	<h2>Simple rule</h2>
-	<pre><code>p { color: red; }</code></pre>
-
-	<h2>Important rule</h2>
-	<pre><code>p { color: red !important; }</code></pre>
-
-	<h2>@ rule</h2>
-	<pre><code>@media screen and (min-width: 100px) {}</code></pre>
-
-	<h2>LESS variable</h2>
-	<pre><code>@main-color: red;
-.foo {
-  background: @main-color;
-}</code></pre>
-
-	<h2>Comment</h2>
-	<pre><code>/* Simple comment here */</code></pre>
-
-	<h2>String</h2>
-	<pre><code>content: 'foo';</code></pre>
-
-	<h2>URL</h2>
-	<pre><code>content: url(foo.png);</code></pre>
-</section>
-
-<section class="language-javascript">
-	<h1>JavaScript</h1>
-
-	<h2>Variable assignment</h2>
-	<pre><code>var foo = "bar", baz = 5;</code></pre>
-
-	<h2>Operators</h2>
-	<pre><code>(1 + 2 * 3)/4 >= 3 &amp;&amp; 4 &lt; 5 || 6 > 7</code></pre>
-
-	<h2>Indented code</h2>
-	<pre><code>if (true) {
-	while (true) {
-		doSomething();
-	}
-}</code></pre>
-
-	<h2>Regex with slashes</h2>
-	<pre><code>var foo = /([^/])\/(\\?.|\[.+?])+?\/[gim]{0,3}/g;</code></pre>
-
-	<h2>Regex that ends with double slash</h2>
-	<pre><code>var bar = /\/\*[\w\W]*?\*\//g;</code></pre>
-
-	<h2>Single line comments &amp; regexes</h2>
-	<pre><code>// http://lea.verou.me
-var comment = /\/\*[\w\W]*?\*\//g;</code></pre>
-
-	<h2>Link in comment</h2>
-	<pre><code>// http://lea.verou.me
-/* http://lea.verou.me */</code></pre>
-
-	<h2>Nested strings</h2>
-	<pre><code>var foo = "foo", bar = "He \"said\" 'hi'!"</code></pre>
-
-	<h2>Strings inside comments</h2>
-	<pre><code>// "foo"</code></pre>
-	<pre><code>/* "foo" */</code></pre>
-
-	<h2>Strings with slashes</h2>
-	<pre><code>env.content + '&lt;/' + env.tag + '>'</code></pre>
-	<pre><code>var foo = "/" + "/";</code></pre>
-	<pre><code>var foo = "http://prismjs.com"; // Strings are strings and comments are comments ;)</code></pre>
-
-	<h2>Regex inside single line comment</h2>
-	<pre><code>// hey, /this doesn’t fail!/ :D</code></pre>
-
-	<h2>Two or more division operators on the same line</h2>
-	<pre><code>var foo = 5 / 6 / 7;</code></pre>
-
-	<h2>A division operator on the same line as a regex</h2>
-	<pre><code>var foo = 1/2, bar = /a/g;</code></pre>
-	<pre><code>var foo = /a/, bar = 3/4;</code></pre>
-</section>
-
-<section class="language-java">
-	<h1>Java</h1>
-
-	<h2>Java Language Keywords</h2>
-	<pre><code>
-abstract continue for        new       switch
-assert   default  goto       package   synchronized
-boolean  do       if         private   this
-break    double   implements protected throw
-byte     else     import     public    throws
-case     enum     instanceof return    transient
-catch    extends  int        short     try
-char     final    interface  static    void
-class    finally  long       strictfp  volatile
-const    float    native     super     while
-
-	</code></pre>
-
-	<h2>Operators</h2>
-	<pre><code>// postfix
-expr++ expr--
-// unary
-++expr --expr +expr -expr ~ !
-// multiplicative
-* / %
-// additive
-+ -
-// shift
-<< >> >>>
-// relational
-< > <= >= instanceof
-// equality
-== !=
-// bitwise AND
-&
-// bitwise exclusive OR
-^
-// bitwise inclusive OR
-|
-// logical AND
-&&
-// logical OR
-||
-// ternary
-? :
-// assignment
-= += -= *= /= %= &= ^= |= <<= >>= >>>=
-	</code></pre>
-
-	<h2>Simple class example</h2>
-
-	<pre><code>package com.prismjs;
-
-import java.io.*;
-
-@SuppressWarnings("unchecked")
-public class PrismJS {
-
-	public static Integer test = 0;
-
-	/**
-	 * Javadoc style comment
-	 *
-	 * @param args
-	 */
-	public static void main(String[] args) {
-		// Let's create some variables
-		int numArgs = args.length;
-		Integer a = 0x1;
-		String test = "" + "Hello" + " \"World\"!";
-		double dvalue = 1.23;
-		int optest = 0;
-		optest += 321 - 45 * 1247 / 425 % 123;
-
-		/*
-		 * Multiline comment
-		 */
-		for (int i = 0; i < numArgs; i++) {
-			// Simple line comment
-			System.out.println("Arg value= " + args[i]);
-		}
-
-		do {
-			System.out.println("Do while ok!");
-		} while (false);
-	}
-}
-
-	</code></pre>
-	<p>As you can notice String keyword is not highlighted because it's not a Java language keyword (cf. <a href="http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html">Java Language Keywords</a>). The main reason is that String is not a primitive type such as <em>int</em> but a class type like <em>Integer</em>.</p>
-</section>
-
-<section class="language-coffeescript">
-	<h1>Coffeescript</h1>
-
-	<h2>Variable assignment</h2>
-	<pre><code>foo = "bar"</code></pre>
-
-	<h2>Operators</h2>
-	<pre><code>(1 + 2 * 3)/4 >= 3 &amp;&amp; 4 &lt; 5 || 6 > 7</code></pre>
-
-	<h2>Indented code</h2>
-	<pre><code>if true
-	while true
-		doSomething()
-	</code></pre>
-
-	<h2>Regex with slashes</h2>
-	<pre><code>var foo = /([^/])\/(\\?.|\[.+?])+?\/[gim]{0,3}/g;</code></pre>
-
-	<h2>Single line comments</h2>
-	<pre><code># This is a comment</code></pre>
-
-	<h2>Link in comment</h2>
-	<pre><code># http://lea.verou.me
-###
-Block Comment
-### </code></pre>
-
-	<h2>Nested strings</h2>
-	<pre><code>var foo = "foo", bar = "He \"said\" 'hi'!"</code></pre>
-
-	<h2>String inside comment</h2>
-	<pre><code># "foo"</code></pre>
-
-
-	<h2>Strings with slashes</h2>
-	<pre><code>env.content + '&lt;/' + env.tag + '>'</code></pre>
-	<pre><code>var foo = "/" + "/";</code></pre>
-
-	<h2>Two or more division operators on the same line</h2>
-	<pre><code>foo = 5 / 6 / 7;</code></pre>
-
-	<h2>A division operator on the same line as a regex</h2>
-	<pre><code>foo = 1/2, bar = /a/g;</code></pre>
-	<pre><code>foo = /a/, bar = 3/4;</code></pre>
-
-	<h2>A function</h2>
-	<pre><code>
-_buttonClick: (a, b) ->
-	@hide()
-	</code></pre>
-
-	<h2>An Object</h2>
-	<pre><code>
-code = {
-	css: "Cascading Style Sheets"
-	cs: "CoffeeScript"
-}
-	</code></pre>
-
-		<h2>Class Definition</h2>
-	<pre><code>
-class CoffeeScript extends Prism.Javascript
-	</code></pre>
-</section>
-
-<section class="language-http">
-	<h1>HTTP</h1>
-
-	<h2>Request Examples</h2>
-	<p>A simple HTTP GET request:</p>
-	<pre><code>GET https://example.tld/v1/:serviceName/users.json?sort=:sortMethod HTTP/1.1</code></pre>
-	<p>Here is an HTTP POST with a body:</p>
-	<pre><code>POST https://example.tld/v1/:serviceName/users.json HTTP/1.1
-Content-Type: application/json
-
-{
-	"names": ["test1", "test2"],
-	"version": 1.0
-}
-</code></pre>
-
-	<h2>Response Examples</h2>
-	<p>JSON response body:</p>
-	<pre><code>HTTP/1.1 200 OK
-Content-Type: application/json
-X-Response-Time: 6ms
-
-{
-	"users": [
-		{
-			"name": "John",
-			"points": 24
-		},
-		{
-			"name": "Lea",
-			"points": 15
-		}
-	]
-}
-</code></pre>
-	<p>XML response body:</p>
-	<pre><code>HTTP/1.1 200 OK
-Content-Type: application/xml
-X-Response-Time: 10ms
-
-&lt;root&gt;
-	&lt;status code="0"&gt;
-		Successful
-	&lt;/status&gt;
-&lt;/root&gt;
-</code></pre>
-</section>
-
-<section id="failures" class="language-javascript">
-	<h1>Known failures (JavaScript)</h1>
-	<p>There are certain edge cases where Prism will fail.
-	There are always such cases in every regex-based syntax highlighter.
-	However, Prism dares to be open and honest about them.
-	If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.
-	</p>
-
-	<h2>Comment-like substrings</h2>
-	<pre><code>"foo /* bar */ baz"; "foo // bar";</code></pre>
-
-	<h2>Two quotes of the same type (i.e. both single or both double) inside a regex</h2>
-	<pre><code>foo = /"foo"/;</code></pre>
-</section>
+<section id="examples"></section>
 
 <footer data-src="templates/footer.html" data-type="text/html"></footer>
 
diff --git a/examples/prism-css.html b/examples/prism-css.html
index 7249454..73cda7e 100644
--- a/examples/prism-css.html
+++ b/examples/prism-css.html
@@ -1,31 +1,31 @@
-<h2>CSS</h2>
+<h1>CSS</h1>
 <p>To use this language, use the class "language-css".</p>
 
-<h3>Empty rule</h3>
+<h2>Empty rule</h2>
 <pre><code>*{} * {} p {}</code></pre>
 <pre><code>ul,
 ol {}</code></pre>
 
-<h3>Simple rule</h3>
+<h2>Simple rule</h2>
 <pre><code>p { color: red; }</code></pre>
 
-<h3>Important rule</h3>
+<h2>Important rule</h2>
 <pre><code>p { color: red !important; }</code></pre>
 
-<h3>@ rule</h3>
+<h2>@ rule</h2>
 <pre><code>@media screen and (min-width: 100px) {}</code></pre>
 
-<h3>LESS variable</h3>
+<h2>LESS variable</h2>
 <pre><code>@main-color: red;
 .foo {
 	background: @main-color;
 }</code></pre>
 
-<h3>Comment</h3>
+<h2>Comment</h2>
 <pre><code>/* Simple comment here */</code></pre>
 
-<h3>String</h3>
+<h2>String</h2>
 <pre><code>content: 'foo';</code></pre>
 
-<h3>URL</h3>
+<h2>URL</h2>
 <pre><code>content: url(foo.png);</code></pre>
\ No newline at end of file
diff --git a/examples/prism-javascript.html b/examples/prism-javascript.html
index d7a8725..2ecd0a4 100644
--- a/examples/prism-javascript.html
+++ b/examples/prism-javascript.html
@@ -1,51 +1,64 @@
-<h2>JavaScript</h2>
+<h1>JavaScript</h1>
 <p>To use this language, use the class "language-javascript".</p>
 
-<h3>Variable assignment</h3>
+<h2>Variable assignment</h2>
 <pre><code>var foo = "bar", baz = 5;</code></pre>
 
-<h3>Operators</h3>
+<h2>Operators</h2>
 <pre><code>(1 + 2 * 3)/4 >= 3 &amp;&amp; 4 &lt; 5 || 6 > 7</code></pre>
 
-<h3>Indented code</h3>
+<h2>Indented code</h2>
 <pre><code>if (true) {
 	while (true) {
 	doSomething();
 	}
-	}</code></pre>
+}</code></pre>
 
-<h3>Regex with slashes</h3>
+<h2>Regex with slashes</h2>
 <pre><code>var foo = /([^/])\/(\\?.|\[.+?])+?\/[gim]{0,3}/g;</code></pre>
 
-<h3>Regex that ends with double slash</h3>
+<h2>Regex that ends with double slash</h2>
 <pre><code>var bar = /\/\*[\w\W]*?\*\//g;</code></pre>
 
-<h3>Single line comments &amp; regexes</h3>
+<h2>Single line comments &amp; regexes</h2>
 <pre><code>// http://lea.verou.me
-	var comment = /\/\*[\w\W]*?\*\//g;</code></pre>
+var comment = /\/\*[\w\W]*?\*\//g;</code></pre>
 
-<h3>Link in comment</h3>
+<h2>Link in comment</h2>
 <pre><code>// http://lea.verou.me
-	/* http://lea.verou.me */</code></pre>
+/* http://lea.verou.me */</code></pre>
 
-<h3>Nested strings</h3>
+<h2>Nested strings</h2>
 <pre><code>var foo = "foo", bar = "He \"said\" 'hi'!"</code></pre>
 
-<h3>Strings inside comments</h3>
-<pre><code>// "foo"</code></pre>
-<pre><code>/* "foo" */</code></pre>
+<h2>Strings inside comments</h2>
+<pre><code>// "foo"
+/* "foo" */</code></pre>
 
-<h3>Strings with slashes</h3>
-<pre><code>env.content + '&lt;/' + env.tag + '>'</code></pre>
-<pre><code>var foo = "/" + "/";</code></pre>
-<pre><code>var foo = "http://prismjs.com"; // Strings are strings and comments are comments ;)</code></pre>
+<h2>Strings with slashes</h2>
+<pre><code>env.content + '&lt;/' + env.tag + '>'
+var foo = "/" + "/";
+var foo = "http://prismjs.com"; // Strings are strings and comments are comments ;)</code></pre>
 
-<h3>Regex inside single line comment</h3>
+<h2>Regex inside single line comment</h2>
 <pre><code>// hey, /this doesn’t fail!/ :D</code></pre>
 
-<h3>Two or more division operators on the same line</h3>
+<h2>Two or more division operators on the same line</h2>
 <pre><code>var foo = 5 / 6 / 7;</code></pre>
 
-<h3>A division operator on the same line as a regex</h3>
-<pre><code>var foo = 1/2, bar = /a/g;</code></pre>
-<pre><code>var foo = /a/, bar = 3/4;</code></pre>
\ No newline at end of file
+<h2>A division operator on the same line as a regex</h2>
+<pre><code>var foo = 1/2, bar = /a/g;
+var foo = /a/, bar = 3/4;</code></pre>
+
+<h2>Known failures</h2>
+<p>There are certain edge cases where Prism will fail.
+	There are always such cases in every regex-based syntax highlighter.
+	However, Prism dares to be open and honest about them.
+	If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.
+</p>
+
+<h3>Comment-like substrings</h3>
+<pre><code>"foo /* bar */ baz"; "foo // bar";</code></pre>
+
+<h3>Two quotes of the same type (i.e. both single or both double) inside a regex</h3>
+<pre><code>foo = /"foo"/;</code></pre>
\ No newline at end of file
diff --git a/examples/prism-markup.html b/examples/prism-markup.html
index e069143..d3a333c 100644
--- a/examples/prism-markup.html
+++ b/examples/prism-markup.html
@@ -1,49 +1,49 @@
-<h2>Markup</h2>
+<h1>Markup</h1>
 <p>To use this language, use the class "language-markup".</p>
 
-<h3>Empty tag</h3>
+<h2>Empty tag</h2>
 <pre><code>&lt;p>&lt;/p></code></pre>
 
-<h3>Tag that spans multiple lines</h3>
+<h2>Tag that spans multiple lines</h2>
 <pre><code>&lt;p
 >hello!
 &lt;/p></code></pre>
 
-<h3>Name-attribute pair</h3>
+<h2>Name-attribute pair</h2>
 <pre><code>&lt;p>&lt;/p></code></pre>
 
-<h3>Name-attribute pair without quotes</h3>
+<h2>Name-attribute pair without quotes</h2>
 <pre><code>&lt;p class=prism>&lt;/p></code></pre>
 
-<h3>Attribute without value</h3>
+<h2>Attribute without value</h2>
 <pre><code>&lt;p data-foo>&lt;/p>
 &lt;p data-foo >&lt;/p>
 </code></pre>
 
-<h3>Namespaces</h3>
+<h2>Namespaces</h2>
 <pre><code>&lt;html:p foo:bar="baz" foo:weee>&lt;/html:p></code></pre>
 
-<h3>XML prolog</h3>
+<h2>XML prolog</h2>
 <pre><code>&lt;?xml version="1.0" encoding="utf-8"?>
 &lt;svg>&lt;/svg></code></pre>
 
-<h3>DOCTYPE</h3>
+<h2>DOCTYPE</h2>
 <pre><code>&lt;!DOCTYPE html>
 &lt;html>&lt;/html></code></pre>
 
-<h3>CDATA section</h3>
+<h2>CDATA section</h2>
 <pre><code>&lt;ns1:description>&lt;![CDATA[
   CDATA is &lt;not> magical.
 ]]>&lt;/ns1:description></code></pre>
 
-<h3>Comment</h3>
+<h2>Comment</h2>
 <pre><code>&lt;!-- I'm a comment -->
 And i'm not</code></pre>
 
-<h3>Entities</h3>
+<h2>Entities</h2>
 <pre><code>&amp;amp; &amp;#x2665; &amp;#160; &amp;#x152;</code></pre>
 
-<h3>Embedded JS and CSS</h3>
+<h2>Embedded JS and CSS</h2>
 <pre><code>&lt;!DOCTYPE html>
 &lt;html lang="en">
 &lt;head>
@@ -66,10 +66,10 @@ And i'm not</code></pre>
 &lt;/body>
 &lt;/html></code></pre>
 
-<h3>Invalid HTML</h3>
+<h2>Invalid HTML</h2>
 <pre><code>&lt;l &lt;/ul></code></pre>
 
-<h3>Multi-line attribute values</h3>
+<h2>Multi-line attribute values</h2>
 <pre><code>&lt;p title="foo
 bar
 baz"></code></pre>
\ No newline at end of file