Merge branch 'prism-examples'
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
diff --git a/examples/prism-clike.html b/examples/prism-clike.html
new file mode 100644
index 0000000..a1ec32f
--- /dev/null
+++ b/examples/prism-clike.html
@@ -0,0 +1,39 @@
+<h1>C-like</h1>
+<p>The C-like component is not really a language on its own,
+ it is the basis of many other components. To use it directly, however,
+ use the class "language-clike".</p>
+
+<h2>Comments</h2>
+<pre><code>// Single line comment
+/* Multi-line
+comment */</code></pre>
+
+<h2>Strings</h2>
+<pre><code>"foo \"bar\" baz";
+'foo \'bar\' baz';</code></pre>
+
+<h2>Numbers</h2>
+<pre><code>123
+123.456
+-123.456
+1e-23
+123.456E789
+0xaf
+0xAF
+</code></pre>
+
+<h2>Functions</h2>
+<pre><code>foo();
+Bar();
+_456();
+</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>
\ No newline at end of file
diff --git a/examples/prism-csharp.html b/examples/prism-csharp.html
new file mode 100644
index 0000000..84d760f
--- /dev/null
+++ b/examples/prism-csharp.html
@@ -0,0 +1,69 @@
+<h1>C#</h1>
+<p>To use this language, use the class "language-csharp".</p>
+
+<h2>Comments</h2>
+<pre><code>// Single line comment
+/* Multi-line
+comment */</code></pre>
+
+<h2>Strings</h2>
+<pre><code>"foo \"bar\" baz"
+'foo \'bar\' baz'
+@"Verbatim strings"
+</code></pre>
+
+<h2>Full example</h2>
+<pre><code>using System.Windows.Forms;
+using System.Drawing;
+
+public static DialogResult InputBox(string title, string promptText, ref string value)
+{
+ Form form = new Form();
+ Label label = new Label();
+ TextBox textBox = new TextBox();
+ Button buttonOk = new Button();
+ Button buttonCancel = new Button();
+
+ form.Text = title;
+ label.Text = promptText;
+ textBox.Text = value;
+
+ buttonOk.Text = "OK";
+ buttonCancel.Text = "Cancel";
+ buttonOk.DialogResult = DialogResult.OK;
+ buttonCancel.DialogResult = DialogResult.Cancel;
+
+ label.SetBounds(9, 20, 372, 13);
+ textBox.SetBounds(12, 36, 372, 20);
+ buttonOk.SetBounds(228, 72, 75, 23);
+ buttonCancel.SetBounds(309, 72, 75, 23);
+
+ label.AutoSize = true;
+ textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
+ buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+
+ form.ClientSize = new Size(396, 107);
+ form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });
+ form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
+ form.FormBorderStyle = FormBorderStyle.FixedDialog;
+ form.StartPosition = FormStartPosition.CenterScreen;
+ form.MinimizeBox = false;
+ form.MaximizeBox = false;
+ form.AcceptButton = buttonOk;
+ form.CancelButton = buttonCancel;
+
+ DialogResult dialogResult = form.ShowDialog();
+ value = textBox.Text;
+ return dialogResult;
+}</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>
\ No newline at end of file
diff --git a/examples/prism-gherkin.html b/examples/prism-gherkin.html
new file mode 100644
index 0000000..bc76f8c
--- /dev/null
+++ b/examples/prism-gherkin.html
@@ -0,0 +1,31 @@
+<h1>Gherkin</h1>
+<p>To use this language, use the class "language-gherkin".</p>
+
+<h2>Comments</h2>
+<pre><code>// Single line comment
+/* Multi-line
+comment */</code></pre>
+
+<h2>Strings</h2>
+<pre><code>"foo \"bar\" baz"
+'foo \'bar\' baz'</code></pre>
+
+<h2>Keywords</h2>
+<pre><code>Feature: Some terse yet descriptive text of what is desired
+ In order to realize a named business value
+ As an explicit system actor
+ I want to gain some beneficial outcome which furthers the goal
+
+ Additional text...
+
+ Scenario: Some determinable business situation
+ Given some precondition
+ And some other precondition
+ When some action by the actor
+ And some other action
+ And yet another action
+ Then some testable outcome is achieved
+ And something else we can check happens too
+
+ Scenario: A different situation
+ ...</code></pre>
diff --git a/examples/prism-groovy.html b/examples/prism-groovy.html
new file mode 100644
index 0000000..d4f0f8f
--- /dev/null
+++ b/examples/prism-groovy.html
@@ -0,0 +1,96 @@
+<h1>Groovy</h1>
+<p>To use this language, use the class "language-groovy".</p>
+
+<h2>Comments</h2>
+<pre><code>// Single line comment
+/* Multi-line
+comment */</code></pre>
+
+<h2>Strings</h2>
+<pre><code>"foo 'bar' baz"
+'foo "bar" baz'
+"""Multi-line
+string"""
+'''Multi-line
+string'''
+"String /containing/ slashes"
+</code></pre>
+
+<h2>Slashy strings (regex)</h2>
+<pre><code>/.*foo.*/
+/regex"containing quotes"/
+$/.*"(.*)".*/(.*)/$</code></pre>
+
+<h2>Interpolation inside GStrings and regex</h2>
+<pre><code>"The answer is ${21*2}"
+"The $foxtype ${foxcolor.join()} fox"
+/foo${21*2}baz/
+'No interpolation here : ${21*2}'</code></pre>
+
+<h2>Full example</h2>
+<pre><code>/*
+ The input string to parse is from...
+ <...the rest of the header comment from above...>
+*/
+boolean debugging = true
+
+if (debugging) {
+ // Test data
+ dfkOutput = '''
+Filesystem 1K-blocks Used Available Use% Mounted on
+/dev/sda1 4185956 1206996 2762888 31% /
+/dev/sda11 30679784 28324040 772140 98% /extra
+fas3050c-1-2.b:/vol/canis
+ 10485760 6599936 3885824 63% /nfs/data_d2/dog_data
+fas6070-1-1.b:/vol/felis
+ 314572800 54889600 259683200 18% /nfs/DATA-1/cat_data
+'''
+} else {
+ // Real data
+ dfkOutput = 'df -k'.execute().text
+}
+
+long kbAvail = 0
+
+regex = '''(?ix) # enable case-insensitive matches, extended patterns
+ (\\d+) # 1: The disk space we want
+ \\s+ # some whitespace
+ \\d+% # a number followed by??%
+ \\s+ # some more whitespace
+ (/nfs/data.*) # 2: partition name'''
+
+pattern = ~regex
+matcher = pattern.matcher(dfkOutput)
+
+if (debugging) {
+ println """matcher pattern:
+/---------------------------------\\
+${matcher.pattern()}
+\\---------------------------------/"""
+
+ println "match count=${matcher.getCount()}"
+}
+
+for (i=0; i < matcher.getCount(); i++) {
+ if (debugging) {
+ println " text matched in matcher[${i}]: '" + matcher[i][0] + "'"
+ println " free space in (group 1): '" + matcher[i][1] + "'"
+ println " partition name (group 2): '" + matcher[i][2] + "'"
+ }
+ kbAvail += matcher[i][1].toLong()
+}
+
+println "KB available=${kbAvail}"</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>Slashy strings containing (escaped) slashes</h3>
+<pre><code>/foo\/bar/</code></pre>
\ No newline at end of file
diff --git a/examples/prism-java.html b/examples/prism-java.html
new file mode 100644
index 0000000..14e0a19
--- /dev/null
+++ b/examples/prism-java.html
@@ -0,0 +1,76 @@
+<h1>Java</h1>
+<p>To use this language, use the class "language-java".</p>
+
+<h2>Comments</h2>
+<pre><code>// Single line comment
+/* Multi-line
+comment */</code></pre>
+
+<h2>Strings</h2>
+<pre><code>"foo \"bar\" baz";
+'foo \'bar\' baz';</code></pre>
+
+<h2>Numbers</h2>
+<pre><code>123
+123.456
+-123.456
+.3f
+1.3e9d
+0xaf
+0xAF
+0xFF.AEP-4
+</code></pre>
+
+<h2>Full example</h2>
+<pre><code>import java.util.Scanner;
+
+public class Life {
+ public static void show(boolean[][] grid){
+ String s = "";
+ for(boolean[] row : grid){
+ for(boolean val : row)
+ if(val)
+ s += "*";
+ else
+ s += ".";
+ s += "\n";
+ }
+ System.out.println(s);
+ }
+
+ public static boolean[][] gen(){
+ boolean[][] grid = new boolean[10][10];
+ for(int r = 0; r < 10; r++)
+ for(int c = 0; c < 10; c++)
+ if( Math.random() > 0.7 )
+ grid[r][c] = true;
+ return grid;
+ }
+
+ public static void main(String[] args){
+ boolean[][] world = gen();
+ show(world);
+ System.out.println();
+ world = nextGen(world);
+ show(world);
+ Scanner s = new Scanner(System.in);
+ while(s.nextLine().length() == 0){
+ System.out.println();
+ world = nextGen(world);
+ show(world);
+
+ }
+ }
+
+ // [...]
+}</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>
\ No newline at end of file
diff --git a/examples/prism-nsis.html b/examples/prism-nsis.html
new file mode 100644
index 0000000..d8cb73c
--- /dev/null
+++ b/examples/prism-nsis.html
@@ -0,0 +1,32 @@
+<h1>NSIS</h1>
+<p>To use this language, use the class "language-nsis".</p>
+
+<h2>Comments</h2>
+<pre><code>; Single line comment
+# Single line comment
+/* Multi-line
+comment */</code></pre>
+
+<h2>Strings</h2>
+<pre><code>"foo \"bar\" baz"
+'foo \'bar\' baz'</code></pre>
+
+<h2>Variables</h2>
+<pre><code>LicenseLangString myLicenseData ${LANG_ENGLISH} "bigtest.nsi"
+LicenseData $(myLicenseData)
+StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +2</code></pre>
+
+<h2>Compiler commands</h2>
+<pre><code>!define VERSION "1.0.3"
+!insertmacro MyFunc ""</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>
\ No newline at end of file
diff --git a/examples/prism-rip.html b/examples/prism-rip.html
new file mode 100644
index 0000000..5d19279
--- /dev/null
+++ b/examples/prism-rip.html
@@ -0,0 +1,15 @@
+<h1>Rip</h1>
+<p>To use this language, use the class "language-rip".</p>
+
+<h2>Comments</h2>
+<pre><code># This is a comment</code></pre>
+
+<h2>Strings</h2>
+<pre><code>"foo \"bar\" baz"
+'foo \'bar\' baz'</code></pre>
+
+<h2>Regex</h2>
+<pre><code>regular_expression = /abc/</code></pre>
+
+<h2>Symbols</h2>
+<pre><code>string_symbol = :rip </code></pre>
\ No newline at end of file
diff --git a/examples/prism-scss.html b/examples/prism-scss.html
new file mode 100644
index 0000000..bc42e66
--- /dev/null
+++ b/examples/prism-scss.html
@@ -0,0 +1,44 @@
+<h1>Sass (Scss)</h1>
+<p>To use this language, use the class "language-scss".</p>
+
+<h2>Comments</h2>
+<pre><code>// Single line comment
+/* Multi-line
+comment */</code></pre>
+
+<h2>At-rules</h2>
+<pre><code>@import "foo.scss";
+@media (min-width: 600px) {}
+.seriousError {
+ @extend .error;
+}
+@for $i from 1 through 3 {}
+</code></pre>
+
+<h2>Compass URLs</h2>
+<pre><code>@font-face {
+ font-family: "opensans";
+ src: font-url("opensans.ttf");
+}</code></pre>
+
+<h2>Variables</h2>
+<pre><code>$width: 5em;
+#main {
+ width: $width;
+}</code></pre>
+
+<h2>Interpolations are highlighted in property names</h2>
+<pre><code>p.#{$name} {
+ #{$attr}-color: blue;
+}
+</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>Media queries are not highlighted properly when not starting with a parenthesis.</h3>
+<pre><code>@media screen {}</code></pre>
\ No newline at end of file