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
diff --git a/examples/prism-haml.html b/examples/prism-haml.html
new file mode 100644
index 0000000..fe7220d
--- /dev/null
+++ b/examples/prism-haml.html
@@ -0,0 +1,82 @@
+<h1>Haml</h1>
+<p>To use this language, use the class "language-haml".</p>
+
+<h2>Comments</h2>
+<pre><code>
+/ This is comment
+ on multiple lines
+/ This is a comment
+but this is not
+-# This is another comment
+ on multiple lines</code></pre>
+
+<h2>Doctype</h2>
+<pre><code>!!! XML
+!!!
+!!! 5</code></pre>
+
+<h2>Tags</h2>
+<pre><code>%div
+ %span
+%span(class="widget_#{@widget.number}")
+%div{:id => [@item.type, @item.number], :class => [@item.type, @item.urgency]}
+%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}
+%html{html_attrs('fr-fr')}
+%div[@user, :greeting]
+%img
+%pre><
+ foo
+ bar
+%img
+</code></pre>
+
+<h2>Markup</h2>
+<pre><code>%p
+ <div id="blah">Blah!</div></code></pre>
+
+<h2>Inline Ruby</h2>
+<pre><code>= ['hi', 'there', 'reader!'].join " "
+- foo = "hello"
+= link_to_remote "Add to cart",
+ :url => { :action => "add", :id => product.id },
+ :update => { :success => "cart", :failure => "error" }
+~ "Foo\n<pre>Bar\nBaz</pre>"
+%p
+ - case 2
+ - when 1
+ = "1!"
+ - when 2
+ = "2?"
+ - when 3
+ = "3."
+- (42...47).each do |i|
+ %p= i
+%p See, I can count!
+</code></pre>
+
+<h2>Filters</h2>
+
+<pre><code>%head
+ :css
+ #content: {
+ background: url('img/background.jpg');
+ }
+ div {
+ color: #333;
+ }
+ :javascript
+ (function() {
+ var test = "Do you like Prism?";
+ if(confirm(test)) {
+ do_something_great();
+ }
+ }());
+%body
+</code></pre>
+
+<p>Filters require the desired language to be loaded.
+On this page, check CoffeeScript <strong>before</strong> checking Haml should make
+the example below work properly.</p>
+<pre><code>script
+ :coffee
+ console.log 'This is coffee script'</code></pre>
\ No newline at end of file
diff --git a/examples/prism-handlebars.html b/examples/prism-handlebars.html
new file mode 100644
index 0000000..dc67ceb
--- /dev/null
+++ b/examples/prism-handlebars.html
@@ -0,0 +1,39 @@
+<h1>Handlebars</h1>
+<p>To use this language, use the class "language-handlebars".</p>
+
+<h2>Comments</h2>
+<pre><code>{{! This is a comment with <p>some markup</p> in it }}</code></pre>
+
+<h2>Variables</h2>
+<pre><code><p>{{ text }}</p>
+<h1>{{article.title}}</h1>
+{{{ triple_slash_is_supported }}}
+{{articles.[10].[#comments]}}</code></pre>
+
+<h2>Strings, numbers and booleans</h2>
+<pre><code>{{{link "See more..." story.url}}}
+{{ true }}
+{{ custom_helper 42 href="somepage.html" false }}</code></pre>
+
+<h2>Block helpers</h2>
+<pre><code><div class="body">
+ {{#bold}}{{body}}{{/bold}}
+</div>
+{{#with story}}
+ <div class="intro">{{{intro}}}</div>
+ <div class="body">{{{body}}}</div>
+{{/with}}
+<div class="{{#if test}}foo{{else}}bar{{/if}}"></div>
+{{#list array}}
+ {{@index}}. {{title}}
+{{/list}}</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>Handlebars tag in the middle of an HTML tag</h3>
+<pre><code><div{{#if test}} class="test"{{/if}}></div></code></pre>
\ No newline at end of file
diff --git a/examples/prism-ini.html b/examples/prism-ini.html
new file mode 100644
index 0000000..d404e42
--- /dev/null
+++ b/examples/prism-ini.html
@@ -0,0 +1,13 @@
+<h1>Ini</h1>
+<p>To use this language, use the class "language-ini".</p>
+
+<h2>Comments</h2>
+<pre><code>; This is a comment</code></pre>
+
+<h2>Section title</h2>
+<pre><code>[owner]
+[database]</code></pre>
+
+<h2>Properties</h2>
+<pre><code>name=prism
+file="somefile.txt"</code></pre>
\ No newline at end of file
diff --git a/examples/prism-latex.html b/examples/prism-latex.html
new file mode 100644
index 0000000..4d8769f
--- /dev/null
+++ b/examples/prism-latex.html
@@ -0,0 +1,15 @@
+<h1>LaTeX</h1>
+<p>To use this language, use the class "language-latex".</p>
+
+<h2>Comments</h2>
+<pre><code>% This is a comment</code></pre>
+
+<h2>Commands</h2>
+<pre><code>\begin{document}
+\documentstyle[twoside,epsfig]{article}
+\usepackage{epsfig,multicol}</code></pre>
+
+<h2>Math mode</h2>
+<pre><code>$\alpha$
+H$_{2}$O
+45$^{\circ}$C</code></pre>
\ No newline at end of file
diff --git a/examples/prism-php.html b/examples/prism-php.html
new file mode 100644
index 0000000..764e89e
--- /dev/null
+++ b/examples/prism-php.html
@@ -0,0 +1,66 @@
+<h1>PHP</h1>
+<p>To use this language, use the class "language-php".</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>Variables</h2>
+<pre><code>$some_var = 5;
+$otherVar = "Some text";
+$null = null;
+$false = FaLsE;</code></pre>
+
+<h2>Functions</h2>
+<pre><code>$json = json_encode($my_object);
+$array1 = array("a" => "green", "red", "blue", "red");
+$array2 = array("b" => "green", "yellow", "red");
+$result = array_diff($array1, $array2);</code></pre>
+
+<h2>Constants</h2>
+<pre><code>define('MAXSIZE', 42);
+echo MAXSIZE;
+json_decode($json, false, 512, JSON_BIGINT_AS_STRING)</code></pre>
+
+<h2>PHP 5.3+ support</h2>
+<pre><code>namespace my\name;
+$c = new \my\name\MyClass;
+$arr = [1,2,3];
+trait ezcReflectionReturnInfo {
+ function getReturnType() { /*1*/ }
+ function getReturnDescription() { /*2*/ }
+}
+function gen_one_to_three() {
+ for ($i = 1; $i <= 3; $i++) {
+ // Note that $i is preserved between yields.
+ yield $i;
+ }
+}</code></pre>
+
+<h2>PHP embedded in HTML</h2>
+<pre><code><div class="<?php echo $a ? 'foo' : 'bar'; ?>">
+<?php if($var < 42) {
+ echo "Something";
+} else {
+ echo "Something else";
+} ?>
+</div></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>A less-than sign and a greater-than sign on the same line</h3>
+<pre><code>if($a < $b && $b > $c) {}</code></pre>
+