[DRE-commits] [ruby-org] 147/303: Added tests for code syntax highlight feature

Jérémy Bobbio lunar at alioth.debian.org
Fri Aug 9 17:33:46 UTC 2013


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository ruby-org.

commit 5f55ceead9ada0c8dc9bafaca4d95f31a539dee3
Author: Waldemar Quevedo <waldemar.quevedo at gmail.com>
Date:   Sun Jun 10 19:52:05 2012 +0900

    Added tests for code syntax highlight feature
---
 .../advanced-code-coderay.html                     |  177 +++++++++++++++++
 .../advanced-code-coderay.org                      |  203 ++++++++++++++++++++
 .../advanced-code-no-color.html                    |   81 ++++++++
 .../advanced-code-no-color.org                     |  106 ++++++++++
 .../advanced-code-pygments.html                    |  203 ++++++++++++++++++++
 .../advanced-code-pygments.org                     |  202 +++++++++++++++++++
 .../code-coderay.html                              |   15 ++
 .../code-coderay.org                               |   16 ++
 .../code-no-color.html                             |   38 ++++
 .../code-no-color.org                              |   40 ++++
 .../code-pygments.html                             |   42 ++++
 .../code-pygments.org                              |   41 ++++
 12 files changed, 1164 insertions(+)

diff --git a/spec/html_code_syntax_highlight_examples/advanced-code-coderay.html b/spec/html_code_syntax_highlight_examples/advanced-code-coderay.html
new file mode 100644
index 0000000..2eb253c
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/advanced-code-coderay.html
@@ -0,0 +1,177 @@
+<p class="title">advanced-code-coderay.org</p>
+<p>Turns out there’s more way to do code than just BEGIN_EXAMPLE.</p>
+<h1><span class="heading-number heading-number-1">1 </span>Inline examples</h1>
+<p>This should work:</p>
+<pre class="example">
+  fixed width? how does this work?   
+                        ...........
+                       ............
+                                  .
+                       .  .   .   .
+                       .          ..
+                       ....... .....
+                           .  .
+                           ....
+</pre>
+<p>Two ASCII blobs.</p>
+<h1><span class="heading-number heading-number-1">2 </span>BEGIN_SRC</h1>
+<p>And this:</p>
+<pre class="src">
+<code class="ruby">
+    <span style="color:#777"># Finds all emphasis matches in a string.</span>
+    <span style="color:#777"># Supply a block that will get the marker and body as parameters.</span>
+    <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">match_all</span>(str)
+      str.scan(<span style="color:#33B">@org_emphasis_regexp</span>) <span style="color:#080;font-weight:bold">do</span> |match|
+        <span style="color:#080;font-weight:bold">yield</span> <span style="color:#d70">$2</span>, <span style="color:#d70">$3</span>
+      <span style="color:#080;font-weight:bold">end</span>
+    <span style="color:#080;font-weight:bold">end</span>
+</code>
+</pre>
+<p>Now let’s test case-insensitive code blocks.</p>
+<pre class="src">
+<code class="ruby">
+    <span style="color:#777"># Finds all emphasis matches in a string.</span>
+    <span style="color:#777"># Supply a block that will get the marker and body as parameters.</span>
+    <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">match_all</span>(str)
+      str.scan(<span style="color:#33B">@org_emphasis_regexp</span>) <span style="color:#080;font-weight:bold">do</span> |match|
+        <span style="color:#080;font-weight:bold">yield</span> <span style="color:#d70">$2</span>, <span style="color:#d70">$3</span>
+      <span style="color:#080;font-weight:bold">end</span>
+    <span style="color:#080;font-weight:bold">end</span>
+</code>
+</pre>
+<pre class="src">
+<code class="clojure">
+(<span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">fib-seq</span>
+  (<span style="color:#080;font-weight:bold">concat</span>
+   [<span style="color:#00D">0</span> <span style="color:#00D">1</span>]
+   ((<span style="color:#080;font-weight:bold">fn</span> rfib [a b]
+        (lazy-cons (<span style="color:#080;font-weight:bold">+</span> a b) (rfib b (<span style="color:#080;font-weight:bold">+</span> a b)))) <span style="color:#00D">0</span> <span style="color:#00D">1</span>)))
+ 
+user> (<span style="color:#080;font-weight:bold">take</span> <span style="color:#00D">20</span> fib-seq)
+(<span style="color:#00D">0</span> <span style="color:#00D">1</span> <span style="color:#00D">1</span> <span style="color:#00D">2</span> <span style="color:#00D">3</span> <span style="color:#00D">5</span> <span style="color:#00D">8</span> <span style="color:#00D">13</span> <span style="color:#00D">21</span> <span style="color:#00D">34</span> <span style="color:#00D">55</span> <span style="color:#00D">89</span> <span style="color:#00D">144</span> <span style="color:#00D">233</span> <span  [...]
+</code>
+</pre>
+<p>Even if no language is set, it is still wrapped in code tags but class is empty.</p>
+<pre class="src">
+<code class="">
+echo 'Defaults env_keeps="http_proxy https_proxy ftp_proxy"' | sudo tee -a /etc/sudoers
+</code>
+</pre>
+<h1><span class="heading-number heading-number-1">3 </span>It should be possible to write a colon at the beginning of an example</h1>
+<blockquote>
+  <p>I really love to write about :symbols. They sure are the best things in the world!</p>
+</blockquote>
+<pre class="src">
+<code class="ruby">
+{
+<span style="color:#A60">:one</span> => <span style="color:#00D">1</span>,
+<span style="color:#A60">:two</span> => <span style="color:#00D">2</span>
+}
+</code>
+</pre>
+<pre class="src">
+<code class="clojure">
+(defproject helloworld <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">0.1</span><span style="color:#710">"</span></span>
+<span style="color:#A60">:dependencies</span> [[org.clojure/clojure
+                 <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">1.1.0-master-SNAPSHOT</span><span style="color:#710">"</span></span>]
+              [org.clojure/clojure-contrib
+                 <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">1.0-SNAPSHOT</span><span style="color:#710">"</span></span>]]
+<span style="color:#A60">:main</span> helloworld)
+</code>
+</pre>
+<h1><span class="heading-number heading-number-1">4 </span>Code syntax highlight with Coderay</h1>
+<h2><span class="heading-number heading-number-2">4.1 </span>No language selected</h2>
+<pre class="src">
+<code class="">
+Nothing to see here
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.2 </span>CSS example</h2>
+<pre class="src">
+<code class="css">
+ <span style="color:#339;font-weight:bold">*</span> {
+  <span style="color:#777">/* apply a natural box layout model to all elements */</span>
+  <span style="color:#606">box-sizing</span>: <span style="color:#088">border-box</span>; 
+  <span style="color:#606">-moz-box-sizing</span>: <span style="color:#088">border-box</span>; 
+  <span style="color:#606">-webkit-box-sizing</span>: <span style="color:#088">border-box</span>; 
+ }
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.3 </span>HTML example</h2>
+<pre class="src">
+<code class="html">
+<span style="color:#070"><html></span>
+  <span style="color:#070"><head></span>
+    <span style="color:#070"><title></span>Hello<span style="color:#070"></title></span>
+  <span style="color:#070"></head></span>
+  <span style="color:#070"><body></span>
+    <span style="color:#070"><h1></span>Hello<span style="color:#070"></h1></span>
+  <span style="color:#070"></body></span>
+<span style="color:#070"></html></span>
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.4 </span>Ruby example</h2>
+<pre class="src">
+<code class="ruby">
+<span style="color:#080;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">Post</span> << <span style="color:#036;font-weight:bold">ActiveRecord</span>::<span style="color:#036;font-weight:bold">Base</span>
+  <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">print_title</span>
+    puts <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="background-color:hsla(0,0%,0%,0.07);color:black"><span style="font-weight:bold;color:#666">#{</span><span style="color:#069">self</span>.title<span style="font-weight:bold;color:#666">}</span></span><span style="color:#710">"</span></span>
+  <span style="color:#080;font-weight:bold">end</span>
+<span style="color:#080;font-weight:bold">end</span>
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.5 </span>Python example</h2>
+<pre class="src">
+<code class="python">
+<span style="color:#080;font-weight:bold">import</span> <span style="color:#B44;font-weight:bold">mapnik</span>
+
+m = mapnik.Map(<span style="color:#00D">600</span>, <span style="color:#00D">800</span>)
+m.background = Map.Color(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">'</span><span style="color:#D20">steelblue</span><span style="color:#710">'</span></span>)
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.6 </span>Javascript example</h2>
+<pre class="src">
+<code class="javascript">
+exports = <span style="color:#963">this</span>;
+
+(<span style="color:#080;font-weight:bold">function</span>(<span style="color:#369;font-weight:bold">$</span>){
+
+<span style="color:#080;font-weight:bold">var</span> Posts = {};
+
+Posts.<span style="color:#06B;font-weight:bold">index</span> = <span style="color:#080;font-weight:bold">function</span>(){
+<span style="color:#777">// TODO</span>
+};
+
+})(jQuery);
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.7 </span>JSON example</h2>
+<pre class="src">
+<code class="json">
+{ <span style="color:#F00;background-color:#FAA">n</span><span style="color:#F00;background-color:#FAA">a</span><span style="color:#F00;background-color:#FAA">m</span><span style="color:#F00;background-color:#FAA">e</span>: <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Waldemar</span><span style="color:#710">"</span></span>
+, <span style="color:#F00;background-color:#FAA">s</span><span style="color:#F00;background-color:#FAA">u</span><span style="color:#F00;background-color:#FAA">r</span><span style="color:#F00;background-color:#FAA">n</span><span style="color:#F00;background-color:#FAA">a</span><span style="color:#F00;background-color:#FAA">m</span><span style="color:#F00;background-color:#FAA">e</span>: <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style= [...]
+}
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.8 </span>PHP example</h2>
+<pre class="src">
+<code class="php">
+<span style="color:#369;font-weight:bold">echo</span> <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Hello</span><span style="color:#710">"</span></span>;
+<span style="color:#369;font-weight:bold">phpinfo</span>();
+<span style="color:#369;font-weight:bold">var_dump</span>(some_var);
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.9 </span>Elisp example</h2>
+<pre class="src">
+<code class="scheme">
+(defun hello()
+  (interactive)
+  (message "hello"))
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.10 </span>Not supported language example</h2>
+<pre class="src">
+<code class="notsupported">
+!+!+++!++!++!++!+
+</code>
+</pre>
diff --git a/spec/html_code_syntax_highlight_examples/advanced-code-coderay.org b/spec/html_code_syntax_highlight_examples/advanced-code-coderay.org
new file mode 100644
index 0000000..199021b
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/advanced-code-coderay.org
@@ -0,0 +1,203 @@
+#+TITLE:     advanced-code-coderay.org
+#+AUTHOR:    Brian Dewey
+#+EMAIL:     bdewey at gmail.com
+#+DATE:      2009-12-30 Wed
+#+DESCRIPTION: More types of code support
+#+KEYWORDS: 
+#+LANGUAGE:  en
+#+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS:   TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc
+#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
+#+EXPORT_SELECT_TAGS: export
+#+EXPORT_EXCLUDE_TAGS: noexport
+#+LINK_UP:   
+#+LINK_HOME: 
+
+Turns out there's more way to do code than just BEGIN_EXAMPLE. 
+
+* Inline examples
+
+This should work:
+
+:   fixed width? how does this work?   
+:                         ...........
+:                        ............
+:                                   .
+:                        .  .   .   .
+:                        .          ..
+:                        ....... .....
+:                            .  .
+:                            ....
+
+Two ASCII blobs.
+
+* BEGIN_SRC
+:PROPERTIES:
+:ARCHIVE_TIME: 2009-12-26 Sat 22:16
+:ARCHIVE_FILE: ~/brians-brain/content/projects/orgmode_parser.org
+:ARCHIVE_OLPATH: <%= @page.title %>/Future Development
+:ARCHIVE_CATEGORY: orgmode_parser
+:ARCHIVE_TODO: DONE
+:END:
+
+And this:
+
+#+BEGIN_SRC ruby
+    # Finds all emphasis matches in a string.
+    # Supply a block that will get the marker and body as parameters.
+    def match_all(str)
+      str.scan(@org_emphasis_regexp) do |match|
+        yield $2, $3
+      end
+    end
+#+END_SRC
+
+Now let's test case-insensitive code blocks.
+
+#+begin_src ruby
+    # Finds all emphasis matches in a string.
+    # Supply a block that will get the marker and body as parameters.
+    def match_all(str)
+      str.scan(@org_emphasis_regexp) do |match|
+        yield $2, $3
+      end
+    end
+#+end_src
+
+#+begin_src clojure
+(def fib-seq
+  (concat
+   [0 1]
+   ((fn rfib [a b]
+        (lazy-cons (+ a b) (rfib b (+ a b)))) 0 1)))
+ 
+user> (take 20 fib-seq)
+(0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181)
+#+end_src
+
+Even if no language is set, it is still wrapped in code tags but class is empty.
+
+#+BEGIN_SRC 
+echo 'Defaults env_keeps="http_proxy https_proxy ftp_proxy"' | sudo tee -a /etc/sudoers
+#+END_SRC
+
+* It should be possible to write a colon at the beginning of an example
+
+#+BEGIN_QUOTE
+I really love to write about
+:symbols. They sure are the
+best things in the world!
+#+END_QUOTE
+
+#+BEGIN_SRC ruby
+{
+:one => 1,
+:two => 2
+}
+#+END_SRC
+
+#+BEGIN_SRC clojure
+(defproject helloworld "0.1"
+:dependencies [[org.clojure/clojure
+                 "1.1.0-master-SNAPSHOT"]
+              [org.clojure/clojure-contrib
+                 "1.0-SNAPSHOT"]]
+:main helloworld)
+#+END_SRC
+
+* Code syntax highlight with Coderay
+
+** No language selected
+
+#+BEGIN_SRC 
+Nothing to see here
+#+END_SRC
+
+** CSS example
+
+#+BEGIN_SRC css
+ * {
+  /* apply a natural box layout model to all elements */
+  box-sizing: border-box; 
+  -moz-box-sizing: border-box; 
+  -webkit-box-sizing: border-box; 
+ }
+#+END_SRC
+
+** HTML example
+
+#+BEGIN_SRC html
+<html>
+  <head>
+    <title>Hello</title>
+  </head>
+  <body>
+    <h1>Hello</h1>
+  </body>
+</html>
+#+END_SRC
+
+** Ruby example
+
+#+BEGIN_SRC ruby
+class Post << ActiveRecord::Base
+  def print_title
+    puts "#{self.title}"
+  end
+end
+#+END_SRC
+
+** Python example
+
+#+BEGIN_SRC python
+import mapnik
+
+m = mapnik.Map(600, 800)
+m.background = Map.Color('steelblue')
+#+END_SRC
+
+** Javascript example
+
+#+BEGIN_SRC javascript
+exports = this;
+
+(function($){
+
+var Posts = {};
+
+Posts.index = function(){
+// TODO
+};
+
+})(jQuery);
+#+END_SRC
+
+** JSON example
+
+#+BEGIN_SRC json
+{ name: "Waldemar"
+, surname: "Quevedo"
+}
+#+END_SRC
+
+** PHP example
+
+#+BEGIN_SRC php
+echo "Hello";
+phpinfo();
+var_dump(some_var);
+#+END_SRC
+
+** Elisp example
+
+#+BEGIN_SRC scheme
+(defun hello()
+  (interactive)
+  (message "hello"))
+#+END_SRC
+
+** Not supported language example
+
+#+BEGIN_SRC notsupported
+!+!+++!++!++!++!+
+#+END_SRC
diff --git a/spec/html_code_syntax_highlight_examples/advanced-code-no-color.html b/spec/html_code_syntax_highlight_examples/advanced-code-no-color.html
new file mode 100644
index 0000000..d19933c
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/advanced-code-no-color.html
@@ -0,0 +1,81 @@
+<p class="title">advanced-code.org</p>
+<p>Turns out there’s more way to do code than just BEGIN_EXAMPLE.</p>
+<h1><span class="heading-number heading-number-1">1 </span>Inline examples</h1>
+<p>This should work:</p>
+<pre class="example">
+  fixed width? how does this work?   
+                        ...........
+                       ............
+                                  .
+                       .  .   .   .
+                       .          ..
+                       ....... .....
+                           .  .
+                           ....
+</pre>
+<p>Two ASCII blobs.</p>
+<h1><span class="heading-number heading-number-1">2 </span>BEGIN_SRC</h1>
+<p>And this:</p>
+<pre class="src">
+<code class="ruby">
+    # Finds all emphasis matches in a string.
+    # Supply a block that will get the marker and body as parameters.
+    def match_all(str)
+      str.scan(@org_emphasis_regexp) do |match|
+        yield $2, $3
+      end
+    end
+</code>
+</pre>
+<p>Now let’s test case-insensitive code blocks.</p>
+<pre class="src">
+<code class="ruby">
+    # Finds all emphasis matches in a string.
+    # Supply a block that will get the marker and body as parameters.
+    def match_all(str)
+      str.scan(@org_emphasis_regexp) do |match|
+        yield $2, $3
+      end
+    end
+</code>
+</pre>
+<pre class="src">
+<code class="clojure">
+(def fib-seq
+  (concat
+   [0 1]
+   ((fn rfib [a b]
+        (lazy-cons (+ a b) (rfib b (+ a b)))) 0 1)))
+ 
+user> (take 20 fib-seq)
+(0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181)
+</code>
+</pre>
+<p>Even if no language is set, it is still wrapped in code tags but class is empty.</p>
+<pre class="src">
+<code class="">
+echo 'Defaults env_keeps="http_proxy https_proxy ftp_proxy"' | sudo tee -a /etc/sudoers
+</code>
+</pre>
+<h1><span class="heading-number heading-number-1">3 </span>It should be possible to write a colon at the beginning of an example</h1>
+<blockquote>
+  <p>I really love to write about :symbols. They sure are the best things in the world!</p>
+</blockquote>
+<pre class="src">
+<code class="ruby">
+{
+:one => 1,
+:two => 2
+}
+</code>
+</pre>
+<pre class="src">
+<code class="clojure">
+(defproject helloworld "0.1"
+:dependencies [[org.clojure/clojure
+                 "1.1.0-master-SNAPSHOT"]
+              [org.clojure/clojure-contrib
+                 "1.0-SNAPSHOT"]]
+:main helloworld)
+</code>
+</pre>
diff --git a/spec/html_code_syntax_highlight_examples/advanced-code-no-color.org b/spec/html_code_syntax_highlight_examples/advanced-code-no-color.org
new file mode 100644
index 0000000..6e4205b
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/advanced-code-no-color.org
@@ -0,0 +1,106 @@
+#+TITLE:     advanced-code.org
+#+AUTHOR:    Brian Dewey
+#+EMAIL:     bdewey at gmail.com
+#+DATE:      2009-12-30 Wed
+#+DESCRIPTION: More types of code support
+#+KEYWORDS: 
+#+LANGUAGE:  en
+#+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS:   TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc
+#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
+#+EXPORT_SELECT_TAGS: export
+#+EXPORT_EXCLUDE_TAGS: noexport
+#+LINK_UP:   
+#+LINK_HOME: 
+
+Turns out there's more way to do code than just BEGIN_EXAMPLE. 
+
+* Inline examples
+
+This should work:
+
+:   fixed width? how does this work?   
+:                         ...........
+:                        ............
+:                                   .
+:                        .  .   .   .
+:                        .          ..
+:                        ....... .....
+:                            .  .
+:                            ....
+
+Two ASCII blobs.
+
+* BEGIN_SRC
+:PROPERTIES:
+:ARCHIVE_TIME: 2009-12-26 Sat 22:16
+:ARCHIVE_FILE: ~/brians-brain/content/projects/orgmode_parser.org
+:ARCHIVE_OLPATH: <%= @page.title %>/Future Development
+:ARCHIVE_CATEGORY: orgmode_parser
+:ARCHIVE_TODO: DONE
+:END:
+
+And this:
+
+#+BEGIN_SRC ruby
+    # Finds all emphasis matches in a string.
+    # Supply a block that will get the marker and body as parameters.
+    def match_all(str)
+      str.scan(@org_emphasis_regexp) do |match|
+        yield $2, $3
+      end
+    end
+#+END_SRC
+
+Now let's test case-insensitive code blocks.
+
+#+begin_src ruby
+    # Finds all emphasis matches in a string.
+    # Supply a block that will get the marker and body as parameters.
+    def match_all(str)
+      str.scan(@org_emphasis_regexp) do |match|
+        yield $2, $3
+      end
+    end
+#+end_src
+
+#+begin_src clojure
+(def fib-seq
+  (concat
+   [0 1]
+   ((fn rfib [a b]
+        (lazy-cons (+ a b) (rfib b (+ a b)))) 0 1)))
+ 
+user> (take 20 fib-seq)
+(0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181)
+#+end_src
+
+Even if no language is set, it is still wrapped in code tags but class is empty.
+
+#+BEGIN_SRC 
+echo 'Defaults env_keeps="http_proxy https_proxy ftp_proxy"' | sudo tee -a /etc/sudoers
+#+END_SRC
+
+* It should be possible to write a colon at the beginning of an example
+
+#+BEGIN_QUOTE
+I really love to write about
+:symbols. They sure are the
+best things in the world!
+#+END_QUOTE
+
+#+BEGIN_SRC ruby
+{
+:one => 1,
+:two => 2
+}
+#+END_SRC
+
+#+BEGIN_SRC clojure
+(defproject helloworld "0.1"
+:dependencies [[org.clojure/clojure
+                 "1.1.0-master-SNAPSHOT"]
+              [org.clojure/clojure-contrib
+                 "1.0-SNAPSHOT"]]
+:main helloworld)
+#+END_SRC
diff --git a/spec/html_code_syntax_highlight_examples/advanced-code-pygments.html b/spec/html_code_syntax_highlight_examples/advanced-code-pygments.html
new file mode 100644
index 0000000..30b5ca5
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/advanced-code-pygments.html
@@ -0,0 +1,203 @@
+<p class="title">advanced-code.org</p>
+<p>Turns out there’s more way to do code than just BEGIN_EXAMPLE.</p>
+<h1><span class="heading-number heading-number-1">1 </span>Inline examples</h1>
+<p>This should work:</p>
+<pre class="example">
+  fixed width? how does this work?   
+                        ...........
+                       ............
+                                  .
+                       .  .   .   .
+                       .          ..
+                       ....... .....
+                           .  .
+                           ....
+</pre>
+<p>Two ASCII blobs.</p>
+<h1><span class="heading-number heading-number-1">2 </span>BEGIN_SRC</h1>
+<p>And this:</p>
+<pre class="src">
+<code class="ruby">
+<div class="highlight"><pre>    <span class="c1"># Finds all emphasis matches in a string.</span>
+    <span class="c1"># Supply a block that will get the marker and body as parameters.</span>
+    <span class="k">def</span> <span class="nf">match_all</span><span class="p">(</span><span class="n">str</span><span class="p">)</span>
+      <span class="n">str</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="vi">@org_emphasis_regexp</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">match</span><span class="o">|</span>
+        <span class="k">yield</span> <span class="vg">$2</span><span class="p">,</span> <span class="vg">$3</span>
+      <span class="k">end</span>
+    <span class="k">end</span>
+</pre>
+</div>
+</code>
+</pre>
+<p>Now let’s test case-insensitive code blocks.</p>
+<pre class="src">
+<code class="ruby">
+<div class="highlight"><pre>    <span class="c1"># Finds all emphasis matches in a string.</span>
+    <span class="c1"># Supply a block that will get the marker and body as parameters.</span>
+    <span class="k">def</span> <span class="nf">match_all</span><span class="p">(</span><span class="n">str</span><span class="p">)</span>
+      <span class="n">str</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="vi">@org_emphasis_regexp</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">match</span><span class="o">|</span>
+        <span class="k">yield</span> <span class="vg">$2</span><span class="p">,</span> <span class="vg">$3</span>
+      <span class="k">end</span>
+    <span class="k">end</span>
+</pre>
+</div>
+</code>
+</pre>
+<pre class="src">
+<code class="clojure">
+<div class="highlight"><pre><span class="p">(</span><span class="k">def </span><span class="nv">fib-seq</span>
+  <span class="p">(</span><span class="nf">concat</span>
+   <span class="p">[</span><span class="mi">0</span> <span class="mi">1</span><span class="p">]</span>
+   <span class="p">((</span><span class="k">fn </span><span class="nv">rfib</span> <span class="p">[</span><span class="nv">a</span> <span class="nv">b</span><span class="p">]</span>
+        <span class="p">(</span><span class="nb">lazy-cons </span><span class="p">(</span><span class="nb">+ </span><span class="nv">a</span> <span class="nv">b</span><span class="p">)</span> <span class="p">(</span><span class="nf">rfib</span> <span class="nv">b</span> <span class="p">(</span><span class="nb">+ </span><span class="nv">a</span> <span class="nv">b</span><span class="p">))))</span> <span class="mi">0</span> <span class="mi">1</span><span class="p">)))</span>
+ 
+<span class="nv">user></span> <span class="p">(</span><span class="nb">take </span><span class="mi">20</span> <span class="nv">fib-seq</span><span class="p">)</span>
+<span class="p">(</span><span class="mi">0</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">3</span> <span class="mi">5</span> <span class="mi">8</span> <span class="mi">13</span> <span class="mi">21</span> <span class="mi">34</span> <span class="mi">55</span> <span class="mi">89</span> <span class="mi">144</span> <span class="mi">233</span> <span class="mi">377</span> <span class="mi">610</span> <span class="mi">987</span> <span class [...]
+</pre>
+</div>
+</code>
+</pre>
+<p>Even if no language is set, it is still wrapped in code tags but class is empty.</p>
+<pre class="src">
+<code class="">
+echo 'Defaults env_keeps="http_proxy https_proxy ftp_proxy"' | sudo tee -a /etc/sudoers
+</code>
+</pre>
+<h1><span class="heading-number heading-number-1">3 </span>It should be possible to write a colon at the beginning of an example</h1>
+<blockquote>
+  <p>I really love to write about :symbols. They sure are the best things in the world!</p>
+</blockquote>
+<pre class="src">
+<code class="ruby">
+<div class="highlight"><pre><span class="p">{</span>
+<span class="ss">:one</span> <span class="o">=></span> <span class="mi">1</span><span class="p">,</span>
+<span class="ss">:two</span> <span class="o">=></span> <span class="mi">2</span>
+<span class="p">}</span>
+</pre>
+</div>
+</code>
+</pre>
+<pre class="src">
+<code class="clojure">
+<div class="highlight"><pre><span class="p">(</span><span class="kd">defproject </span><span class="nv">helloworld</span> <span class="s">"0.1"</span>
+<span class="ss">:dependencies</span> <span class="p">[[</span><span class="nv">org.clojure/clojure</span>
+                 <span class="s">"1.1.0-master-SNAPSHOT"</span><span class="p">]</span>
+              <span class="p">[</span><span class="nv">org.clojure/clojure-contrib</span>
+                 <span class="s">"1.0-SNAPSHOT"</span><span class="p">]]</span>
+<span class="ss">:main</span> <span class="nv">helloworld</span><span class="p">)</span>
+</pre>
+</div>
+</code>
+</pre>
+<h1><span class="heading-number heading-number-1">4 </span>Code syntax highlight with Pygments</h1>
+<h2><span class="heading-number heading-number-2">4.1 </span>No language selected</h2>
+<pre class="src">
+<code class="">
+Nothing to see here
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.2 </span>CSS example</h2>
+<pre class="src">
+<code class="css">
+<div class="highlight"><pre> <span class="o">*</span> <span class="p">{</span>
+  <span class="c">/* apply a natural box layout model to all elements */</span>
+  <span class="n">box</span><span class="o">-</span><span class="n">sizing</span><span class="o">:</span> <span class="k">border</span><span class="o">-</span><span class="n">box</span><span class="p">;</span> 
+  <span class="o">-</span><span class="n">moz</span><span class="o">-</span><span class="n">box</span><span class="o">-</span><span class="n">sizing</span><span class="o">:</span> <span class="k">border</span><span class="o">-</span><span class="n">box</span><span class="p">;</span> 
+  <span class="o">-</span><span class="n">webkit</span><span class="o">-</span><span class="n">box</span><span class="o">-</span><span class="n">sizing</span><span class="o">:</span> <span class="k">border</span><span class="o">-</span><span class="n">box</span><span class="p">;</span> 
+ <span class="p">}</span>
+</pre>
+</div>
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.3 </span>HTML example</h2>
+<pre class="src">
+<code class="html">
+<div class="highlight"><pre><span class="nt"><html></span>
+  <span class="nt"><head></span>
+    <span class="nt"><title></span>Hello<span class="nt"></title></span>
+  <span class="nt"></head></span>
+  <span class="nt"><body></span>
+    <span class="nt"><h1></span>Hello<span class="nt"></h1></span>
+  <span class="nt"></body></span>
+<span class="nt"></html></span>
+</pre>
+</div>
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.4 </span>Ruby example</h2>
+<pre class="src">
+<code class="ruby">
+<div class="highlight"><pre><span class="k">class</span> <span class="nc">Post</span> <span class="o"><<</span> <span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Base</span>
+  <span class="k">def</span> <span class="nf">print_title</span>
+    <span class="nb">puts</span> <span class="s2">"</span><span class="si">#{</span><span class="nb">self</span><span class="o">.</span><span class="n">title</span><span class="si">}</span><span class="s2">"</span>
+  <span class="k">end</span>
+<span class="k">end</span>
+</pre>
+</div>
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.5 </span>Python example</h2>
+<pre class="src">
+<code class="python">
+<div class="highlight"><pre><span class="kn">import</span> <span class="nn">mapnik</span>
+
+<span class="n">m</span> <span class="o">=</span> <span class="n">mapnik</span><span class="o">.</span><span class="n">Map</span><span class="p">(</span><span class="mi">600</span><span class="p">,</span> <span class="mi">800</span><span class="p">)</span>
+<span class="n">m</span><span class="o">.</span><span class="n">background</span> <span class="o">=</span> <span class="n">Map</span><span class="o">.</span><span class="n">Color</span><span class="p">(</span><span class="s">'steelblue'</span><span class="p">)</span>
+</pre>
+</div>
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.6 </span>Javascript example</h2>
+<pre class="src">
+<code class="javascript">
+<div class="highlight"><pre><span class="nx">exports</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
+
+<span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">$</span><span class="p">){</span>
+
+<span class="kd">var</span> <span class="nx">Posts</span> <span class="o">=</span> <span class="p">{};</span>
+
+<span class="nx">Posts</span><span class="p">.</span><span class="nx">index</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span>
+<span class="c1">// TODO</span>
+<span class="p">};</span>
+
+<span class="p">})(</span><span class="nx">jQuery</span><span class="p">);</span>
+</pre>
+</div>
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.7 </span>JSON example</h2>
+<pre class="src">
+<code class="json">
+<div class="highlight"><pre><span class="p">{</span> <span class="err">name:</span> <span class="nt">"Waldemar"</span>
+<span class="p">,</span> <span class="err">surname:</span> <span class="nt">"Quevedo"</span>
+<span class="p">}</span>
+</pre>
+</div>
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.8 </span>PHP example</h2>
+<pre class="src">
+<code class="php">
+<div class="highlight"><pre><span class="x">echo "Hello";</span>
+<span class="x">phpinfo();</span>
+<span class="x">var_dump(some_var);</span>
+</pre>
+</div>
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.9 </span>Elisp example</h2>
+<pre class="src">
+<code class="scheme">
+<div class="highlight"><pre><span class="p">(</span><span class="nf">defun</span> <span class="nv">hello</span><span class="p">()</span>
+  <span class="p">(</span><span class="nf">interactive</span><span class="p">)</span>
+  <span class="p">(</span><span class="nf">message</span> <span class="s">"hello"</span><span class="p">))</span>
+</pre>
+</div>
+</code>
+</pre>
+<h2><span class="heading-number heading-number-2">4.10 </span>Not supported language example</h2>
+<pre class="src">
+<code class="notsupported">
+!+!+++!++!++!++!+
+</code>
+</pre>
diff --git a/spec/html_code_syntax_highlight_examples/advanced-code-pygments.org b/spec/html_code_syntax_highlight_examples/advanced-code-pygments.org
new file mode 100644
index 0000000..ea2d8b4
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/advanced-code-pygments.org
@@ -0,0 +1,202 @@
+#+TITLE:     advanced-code.org
+#+AUTHOR:    Brian Dewey
+#+EMAIL:     bdewey at gmail.com
+#+DATE:      2009-12-30 Wed
+#+DESCRIPTION: More types of code support
+#+KEYWORDS: 
+#+LANGUAGE:  en
+#+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS:   TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc
+#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
+#+EXPORT_SELECT_TAGS: export
+#+EXPORT_EXCLUDE_TAGS: noexport
+#+LINK_UP:   
+#+LINK_HOME: 
+
+Turns out there's more way to do code than just BEGIN_EXAMPLE. 
+
+* Inline examples
+
+This should work:
+
+:   fixed width? how does this work?   
+:                         ...........
+:                        ............
+:                                   .
+:                        .  .   .   .
+:                        .          ..
+:                        ....... .....
+:                            .  .
+:                            ....
+
+Two ASCII blobs.
+
+* BEGIN_SRC
+:PROPERTIES:
+:ARCHIVE_TIME: 2009-12-26 Sat 22:16
+:ARCHIVE_FILE: ~/brians-brain/content/projects/orgmode_parser.org
+:ARCHIVE_OLPATH: <%= @page.title %>/Future Development
+:ARCHIVE_CATEGORY: orgmode_parser
+:ARCHIVE_TODO: DONE
+:END:
+
+And this:
+
+#+BEGIN_SRC ruby
+    # Finds all emphasis matches in a string.
+    # Supply a block that will get the marker and body as parameters.
+    def match_all(str)
+      str.scan(@org_emphasis_regexp) do |match|
+        yield $2, $3
+      end
+    end
+#+END_SRC
+
+Now let's test case-insensitive code blocks.
+
+#+begin_src ruby
+    # Finds all emphasis matches in a string.
+    # Supply a block that will get the marker and body as parameters.
+    def match_all(str)
+      str.scan(@org_emphasis_regexp) do |match|
+        yield $2, $3
+      end
+    end
+#+end_src
+
+#+begin_src clojure
+(def fib-seq
+  (concat
+   [0 1]
+   ((fn rfib [a b]
+        (lazy-cons (+ a b) (rfib b (+ a b)))) 0 1)))
+ 
+user> (take 20 fib-seq)
+(0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181)
+#+end_src
+
+Even if no language is set, it is still wrapped in code tags but class is empty.
+
+#+BEGIN_SRC 
+echo 'Defaults env_keeps="http_proxy https_proxy ftp_proxy"' | sudo tee -a /etc/sudoers
+#+END_SRC
+
+* It should be possible to write a colon at the beginning of an example
+
+#+BEGIN_QUOTE
+I really love to write about
+:symbols. They sure are the
+best things in the world!
+#+END_QUOTE
+
+#+BEGIN_SRC ruby
+{
+:one => 1,
+:two => 2
+}
+#+END_SRC
+
+#+BEGIN_SRC clojure
+(defproject helloworld "0.1"
+:dependencies [[org.clojure/clojure
+                 "1.1.0-master-SNAPSHOT"]
+              [org.clojure/clojure-contrib
+                 "1.0-SNAPSHOT"]]
+:main helloworld)
+#+END_SRC
+* Code syntax highlight with Pygments
+
+** No language selected
+
+#+BEGIN_SRC 
+Nothing to see here
+#+END_SRC
+
+** CSS example
+
+#+BEGIN_SRC css
+ * {
+  /* apply a natural box layout model to all elements */
+  box-sizing: border-box; 
+  -moz-box-sizing: border-box; 
+  -webkit-box-sizing: border-box; 
+ }
+#+END_SRC
+
+** HTML example
+
+#+BEGIN_SRC html
+<html>
+  <head>
+    <title>Hello</title>
+  </head>
+  <body>
+    <h1>Hello</h1>
+  </body>
+</html>
+#+END_SRC
+
+** Ruby example
+
+#+BEGIN_SRC ruby
+class Post << ActiveRecord::Base
+  def print_title
+    puts "#{self.title}"
+  end
+end
+#+END_SRC
+
+** Python example
+
+#+BEGIN_SRC python
+import mapnik
+
+m = mapnik.Map(600, 800)
+m.background = Map.Color('steelblue')
+#+END_SRC
+
+** Javascript example
+
+#+BEGIN_SRC javascript
+exports = this;
+
+(function($){
+
+var Posts = {};
+
+Posts.index = function(){
+// TODO
+};
+
+})(jQuery);
+#+END_SRC
+
+** JSON example
+
+#+BEGIN_SRC json
+{ name: "Waldemar"
+, surname: "Quevedo"
+}
+#+END_SRC
+
+** PHP example
+
+#+BEGIN_SRC php
+echo "Hello";
+phpinfo();
+var_dump(some_var);
+#+END_SRC
+
+** Elisp example
+
+#+BEGIN_SRC scheme
+(defun hello()
+  (interactive)
+  (message "hello"))
+#+END_SRC
+
+** Not supported language example
+
+#+BEGIN_SRC notsupported
+!+!+++!++!++!++!+
+#+END_SRC
diff --git a/spec/html_code_syntax_highlight_examples/code-coderay.html b/spec/html_code_syntax_highlight_examples/code-coderay.html
new file mode 100644
index 0000000..3a0943e
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/code-coderay.html
@@ -0,0 +1,15 @@
+<h1 class="title">Simple Code Syntax highlighting test</h1>
+<pre class="src">
+<code class="ruby">
+<span style="color:#080;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">Coderay</span>
+  <span style="color:#080;font-weight:bold">class</span> << <span style="color:#B06;font-weight:bold">self</span>
+    <span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">colorize</span>
+      <span style="color:#777"># Do colorizing stuff here</span>
+      heredoc = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710"><<EOF</span></span><span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#D20">
+    Some text yay!!!</span><span style="color:#710">
+EOF</span></span>
+    <span style="color:#080;font-weight:bold">end</span>
+  <span style="color:#080;font-weight:bold">end</span>
+<span style="color:#080;font-weight:bold">end</span>
+</code>
+</pre>
diff --git a/spec/html_code_syntax_highlight_examples/code-coderay.org b/spec/html_code_syntax_highlight_examples/code-coderay.org
new file mode 100644
index 0000000..f8c5a68
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/code-coderay.org
@@ -0,0 +1,16 @@
+* Simple Code Syntax highlighting test
+
+#+BEGIN_SRC ruby
+class Coderay
+  class << self
+    def colorize
+      # Do colorizing stuff here
+      heredoc = <<EOF
+    Some text yay!!!
+EOF
+    end
+  end
+end
+#+END_SRC
+
+  
diff --git a/spec/html_code_syntax_highlight_examples/code-no-color.html b/spec/html_code_syntax_highlight_examples/code-no-color.html
new file mode 100644
index 0000000..9010bd1
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/code-no-color.html
@@ -0,0 +1,38 @@
+<h1 class="title">Simple Code Syntax highlighting test</h1>
+<pre class="src">
+<code class="ruby">
+class Pygments
+  class << self
+    def colorize
+      # Do colorizing stuff here
+      heredoc = <<EOF
+    Some text yay!!!
+EOF
+    end
+  end
+end
+</code>
+</pre>
+<p>Now using EXAMPLE blocks instead:</p>
+<pre class="example">
+def hello()
+  puts "hello"
+end
+</pre>
+<p>Small case should work as well:</p>
+<pre class="example">
+class Hello
+  def say
+    puts "hola"
+  end
+end
+</pre>
+<pre class="src">
+<code class="ruby">
+class Piano
+  def play_note(note)
+  # TODO
+  end
+end
+</code>
+</pre>
diff --git a/spec/html_code_syntax_highlight_examples/code-no-color.org b/spec/html_code_syntax_highlight_examples/code-no-color.org
new file mode 100644
index 0000000..f9a21f6
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/code-no-color.org
@@ -0,0 +1,40 @@
+* Simple Code Syntax highlighting test
+
+#+BEGIN_SRC ruby
+class Pygments
+  class << self
+    def colorize
+      # Do colorizing stuff here
+      heredoc = <<EOF
+    Some text yay!!!
+EOF
+    end
+  end
+end
+#+END_SRC
+
+Now using EXAMPLE blocks instead:
+
+#+BEGIN_EXAMPLE
+def hello()
+  puts "hello"
+end
+#+END_EXAMPLE
+
+Small case should work as well:
+
+#+begin_example ruby
+class Hello
+  def say
+    puts "hola"
+  end
+end
+#+end_example
+
+#+begin_src ruby
+class Piano
+  def play_note(note)
+  # TODO
+  end
+end
+#+end_src
diff --git a/spec/html_code_syntax_highlight_examples/code-pygments.html b/spec/html_code_syntax_highlight_examples/code-pygments.html
new file mode 100644
index 0000000..0a22120
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/code-pygments.html
@@ -0,0 +1,42 @@
+<h1 class="title">Simple Code Syntax highlighting test</h1>
+<pre class="src">
+<code class="ruby">
+<div class="highlight"><pre><span class="k">class</span> <span class="nc">Pygments</span>
+  <span class="k">class</span> <span class="o"><<</span> <span class="nb">self</span>
+    <span class="k">def</span> <span class="nf">colorize</span>
+      <span class="c1"># Do colorizing stuff here</span>
+      <span class="n">heredoc</span> <span class="o">=</span> <span class="o"><<</span><span class="no">EOF</span>
+<span class="sh">    Some text yay!!!</span>
+<span class="no">EOF</span>
+    <span class="k">end</span>
+  <span class="k">end</span>
+<span class="k">end</span>
+</pre>
+</div>
+</code>
+</pre>
+<p>Now using EXAMPLE blocks instead:</p>
+<pre class="example">
+def hello()
+  puts "hello"
+end
+</pre>
+<p>Small case should work as well:</p>
+<pre class="example">
+class Hello
+  def say
+    puts "hola"
+  end
+end
+</pre>
+<pre class="src">
+<code class="ruby">
+<div class="highlight"><pre><span class="k">class</span> <span class="nc">Piano</span>
+  <span class="k">def</span> <span class="nf">play_note</span><span class="p">(</span><span class="n">note</span><span class="p">)</span>
+  <span class="c1"># TODO</span>
+  <span class="k">end</span>
+<span class="k">end</span>
+</pre>
+</div>
+</code>
+</pre>
diff --git a/spec/html_code_syntax_highlight_examples/code-pygments.org b/spec/html_code_syntax_highlight_examples/code-pygments.org
new file mode 100644
index 0000000..047d862
--- /dev/null
+++ b/spec/html_code_syntax_highlight_examples/code-pygments.org
@@ -0,0 +1,41 @@
+* Simple Code Syntax highlighting test
+
+#+BEGIN_SRC ruby
+class Pygments
+  class << self
+    def colorize
+      # Do colorizing stuff here
+      heredoc = <<EOF
+    Some text yay!!!
+EOF
+    end
+  end
+end
+#+END_SRC
+
+Now using EXAMPLE blocks instead:
+
+#+BEGIN_EXAMPLE
+def hello()
+  puts "hello"
+end
+#+END_EXAMPLE
+
+Small case should work as well:
+
+#+begin_example ruby
+class Hello
+  def say
+    puts "hola"
+  end
+end
+#+end_example
+
+#+begin_src ruby
+class Piano
+  def play_note(note)
+  # TODO
+  end
+end
+#+end_src
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-org.git



More information about the Pkg-ruby-extras-commits mailing list