[DRE-commits] [ruby-org] 108/303: Fixed bug in the new image link text code and updated test cases.

Jérémy Bobbio lunar at alioth.debian.org
Fri Aug 9 17:33:37 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 db2a99de59d60cdbd71ecc1594c1928a91c097ee
Author: Brian Dewey <bdewey at gmail.com>
Date:   Sat Sep 3 09:23:49 2011 -0700

    Fixed bug in the new image link text code and updated test cases.
---
 lib/org-ruby/html_output_buffer.rb        |    4 ++--
 spec/html_examples/inline-formatting.html |    4 ++++
 spec/html_examples/inline-formatting.org  |    4 ++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/org-ruby/html_output_buffer.rb b/lib/org-ruby/html_output_buffer.rb
index d930cae..6a5a327 100644
--- a/lib/org-ruby/html_output_buffer.rb
+++ b/lib/org-ruby/html_output_buffer.rb
@@ -158,8 +158,8 @@ module Orgmode
         end
         link = link.sub(/^file:/i, "") # will default to HTTP
         link = link.sub(/\.org$/i, ".html")
-        text = text.gsub(/([^\]]*\.(jpg|jpeg|gif|png))/xi) do |link|
-          "<img src=\"#{link}\" />"
+        text = text.gsub(/([^\]]*\.(jpg|jpeg|gif|png))/xi) do |img_link|
+          "<img src=\"#{img_link}\" />"
         end
         "<a href=\"#{link}\">#{text}</a>"
       end
diff --git a/spec/html_examples/inline-formatting.html b/spec/html_examples/inline-formatting.html
index 448a44b..f53ac24 100644
--- a/spec/html_examples/inline-formatting.html
+++ b/spec/html_examples/inline-formatting.html
@@ -12,3 +12,7 @@
 <ul>
   <li><a href="http://farm7.static.flickr.com/6078/6084185195_552aa270b2.jpg"><img src="http://farm7.static.flickr.com/6078/6084185195_552aa270b2.jpg" /></a></li>
 </ul>
+<p>Also, if you make the descriptive text be an image, then it will get formatted with an image tag, like so:</p>
+<ul>
+  <li><a href="http://www.xkcd.com"><img src="http://imgs.xkcd.com/comics/t_cells.png" /></a></li>
+</ul>
diff --git a/spec/html_examples/inline-formatting.org b/spec/html_examples/inline-formatting.org
index d2a65b7..c6f05e7 100644
--- a/spec/html_examples/inline-formatting.org
+++ b/spec/html_examples/inline-formatting.org
@@ -21,3 +21,7 @@ image, like this:
 
 - [[http://farm7.static.flickr.com/6078/6084185195_552aa270b2.jpg]]
 
+Also, if you make the descriptive text be an image, then it will get formatted
+with an image tag, like so:
+
+- [[http://www.xkcd.com][http://imgs.xkcd.com/comics/t_cells.png]]

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