[DRE-commits] [ruby-org] 129/303: Fixed issue with InlineExampleRegexp when a colon was at the beginning of line (fixes #21 and #6)

Jérémy Bobbio lunar at alioth.debian.org
Fri Aug 9 17:33:42 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 76deba1e6b46e0c6c8e7e5bf40553a2491307310
Author: Waldemar Quevedo <waldemar.quevedo at gmail.com>
Date:   Tue Mar 20 00:07:34 2012 +0900

    Fixed issue with InlineExampleRegexp when a colon was at the beginning of line (fixes #21 and #6)
---
 lib/org-ruby/line.rb                  |    2 +-
 spec/html_examples/advanced-code.html |   40 +++++++++++++++++++++++++--------
 spec/html_examples/advanced-code.org  |   24 ++++++++++++++++++++
 spec/line_spec.rb                     |    2 +-
 4 files changed, 57 insertions(+), 11 deletions(-)

diff --git a/lib/org-ruby/line.rb b/lib/org-ruby/line.rb
index 6db2ad1..05cb046 100644
--- a/lib/org-ruby/line.rb
+++ b/lib/org-ruby/line.rb
@@ -162,7 +162,7 @@ module Orgmode
       block_type =~ /^(EXAMPLE|SRC)$/i
     end
 
-    InlineExampleRegexp = /^\s*:/
+    InlineExampleRegexp = /^\s*:\s/
 
     # Test if the line matches the "inline example" case:
     # the first character on the line is a colon.
diff --git a/spec/html_examples/advanced-code.html b/spec/html_examples/advanced-code.html
index da6835c..d19933c 100644
--- a/spec/html_examples/advanced-code.html
+++ b/spec/html_examples/advanced-code.html
@@ -3,15 +3,15 @@
 <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?   
-                         ...........
-                        ............
-                                   .
-                        .  .   .   .
-                        .          ..
-                        ....... .....
-                            .  .
-                            ....
+  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>
@@ -57,3 +57,25 @@ user> (take 20 fib-seq)
 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_examples/advanced-code.org b/spec/html_examples/advanced-code.org
index 552f177..6e4205b 100644
--- a/spec/html_examples/advanced-code.org
+++ b/spec/html_examples/advanced-code.org
@@ -80,3 +80,27 @@ 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/line_spec.rb b/spec/line_spec.rb
index d22c4b2..99c7113 100644
--- a/spec/line_spec.rb
+++ b/spec/line_spec.rb
@@ -24,7 +24,7 @@ describe Orgmode::Line do
     end
   end
 
-  [": inline", " :inline", "\t\t:\tinline"].each do |inline_example|
+  [": inline", " : inline", "\t\t:\tinline"].each do |inline_example|
     it "should recognize this inline example: #{inline_example}" do
       Orgmode::Line.new(inline_example).inline_example?.should be_true
     end

-- 
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