[DRE-commits] [ruby-org] 87/303: Bumped version to 0.5.4. Made block commands case-insensitive.

Jérémy Bobbio lunar at alioth.debian.org
Fri Aug 9 17:33:33 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 49983d31fd2dbbc4f5930c9aeb972560ce5ab379
Author: Brian Dewey <bdewey at gmail.com>
Date:   Tue Nov 23 13:50:48 2010 -0800

    Bumped version to 0.5.4. Made block commands case-insensitive.
---
 lib/org-ruby.rb                       |    2 +-
 lib/org-ruby/line.rb                  |    8 ++++----
 lib/org-ruby/parser.rb                |   12 ++++++------
 spec/html_examples/advanced-code.html |   10 ++++++++++
 spec/html_examples/advanced-code.org  |   13 +++++++++++++
 5 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/lib/org-ruby.rb b/lib/org-ruby.rb
index f2d9481..f274bef 100644
--- a/lib/org-ruby.rb
+++ b/lib/org-ruby.rb
@@ -3,7 +3,7 @@ unless defined? ::OrgRuby
 module OrgRuby
 
   # :stopdoc:
-  VERSION = '0.5.3'
+  VERSION = '0.5.4'
   LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
   PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
   # :startdoc:
diff --git a/lib/org-ruby/line.rb b/lib/org-ruby/line.rb
index 58e9525..fe18ad2 100644
--- a/lib/org-ruby/line.rb
+++ b/lib/org-ruby/line.rb
@@ -112,14 +112,14 @@ module Orgmode
       table_row? or table_separator? or table_header?
     end
 
-    BlockRegexp = /^\s*#\+(BEGIN|END)_(\w*)/
+    BlockRegexp = /^\s*#\+(BEGIN|END)_(\w*)/i
 
     def begin_block?
-      @line =~ BlockRegexp && $1 == "BEGIN"
+      @line =~ BlockRegexp && $1 =~ /BEGIN/i
     end
 
     def end_block?
-      @line =~ BlockRegexp && $1 == "END"
+      @line =~ BlockRegexp && $1 =~ /END/i
     end
 
     def block_type
@@ -127,7 +127,7 @@ module Orgmode
     end
 
     def code_block_type?
-      block_type =~ /^(EXAMPLE|SRC)$/
+      block_type =~ /^(EXAMPLE|SRC)$/i
     end
 
     InlineExampleRegexp = /^\s*:/
diff --git a/lib/org-ruby/parser.rb b/lib/org-ruby/parser.rb
index 86ba9a1..719c91e 100644
--- a/lib/org-ruby/parser.rb
+++ b/lib/org-ruby/parser.rb
@@ -206,13 +206,13 @@ module Orgmode
         when :comment
           
           if line.begin_block?
-            output_buffer.push_mode(:blockquote) if line.block_type == "QUOTE"
-            output_buffer.push_mode(:src) if line.block_type == "SRC"
-            output_buffer.push_mode(:example) if line.block_type == "EXAMPLE"
+            output_buffer.push_mode(:blockquote) if line.block_type.casecmp("QUOTE") == 0
+            output_buffer.push_mode(:src) if line.block_type.casecmp("SRC") == 0
+            output_buffer.push_mode(:example) if line.block_type.casecmp("EXAMPLE") == 0
           elsif line.end_block?
-            output_buffer.pop_mode(:blockquote) if line.block_type == "QUOTE"
-            output_buffer.pop_mode(:src) if line.block_type == "SRC"
-            output_buffer.pop_mode(:example) if line.block_type == "EXAMPLE"
+            output_buffer.pop_mode(:blockquote) if line.block_type.casecmp("QUOTE")==0
+            output_buffer.pop_mode(:src) if line.block_type.casecmp("SRC")==0
+            output_buffer.pop_mode(:example) if line.block_type.casecmp("EXAMPLE")==0
           else
             output_buffer << line.line if output_buffer.preserve_whitespace?
           end
diff --git a/spec/html_examples/advanced-code.html b/spec/html_examples/advanced-code.html
index 16e8dc3..fd31a9c 100644
--- a/spec/html_examples/advanced-code.html
+++ b/spec/html_examples/advanced-code.html
@@ -34,3 +34,13 @@ END:
       end
     end
 </pre>
+<p>Now let’s test case-insensitive code blocks.</p>
+<pre class="src">
+    # 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
+</pre>
diff --git a/spec/html_examples/advanced-code.org b/spec/html_examples/advanced-code.org
index dc685d3..3dc8822 100644
--- a/spec/html_examples/advanced-code.org
+++ b/spec/html_examples/advanced-code.org
@@ -51,3 +51,16 @@ And this:
       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
+

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