[DRE-commits] [ruby-org] 103/303: Make inline images clickable.

Jérémy Bobbio lunar at alioth.debian.org
Fri Aug 9 17:33:36 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 e39c8677017be9090f450b430fc27f8dec53f142
Author: Brian Dewey <bdewey at gmail.com>
Date:   Sat Sep 3 07:48:31 2011 -0700

    Make inline images clickable.
---
 Rakefile                                  |    8 +++-----
 lib/org-ruby.rb                           |    2 +-
 lib/org-ruby/html_output_buffer.rb        |    2 +-
 spec/html_examples/inline-formatting.html |    4 ++++
 spec/html_examples/inline-formatting.org  |    6 ++++++
 spec/html_examples/inline-images.html     |    2 +-
 spec/spec_helper.rb                       |    3 +--
 7 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/Rakefile b/Rakefile
index 1e32a3c..abb3def 100644
--- a/Rakefile
+++ b/Rakefile
@@ -8,8 +8,8 @@ end
 ensure_in_path 'lib'
 require 'org-ruby'
 
-task :default => 'test:run'
-task 'gem:release' => 'test:run'
+task :default => 'spec:run'
+task 'gem:release' => 'spec:run'
 
 Bones {
   readme_file 'README.rdoc'
@@ -18,10 +18,8 @@ Bones {
   email  'bdewey at gmail.com'
   url  'http://github.com/bdewey/org-ruby'
   version  OrgRuby::VERSION
-  colorize false                # Windows consoles won't colorize
-  gem.need_tar false            # Can't TAR from Windows
   depend_on 'rubypants'
-  spec.opts ['-D', '--color']
+  spec.opts ['--color']
 }
 
 
diff --git a/lib/org-ruby.rb b/lib/org-ruby.rb
index f274bef..b909c58 100644
--- a/lib/org-ruby.rb
+++ b/lib/org-ruby.rb
@@ -3,7 +3,7 @@ unless defined? ::OrgRuby
 module OrgRuby
 
   # :stopdoc:
-  VERSION = '0.5.4'
+  VERSION = '0.5.5'
   LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
   PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
   # :startdoc:
diff --git a/lib/org-ruby/html_output_buffer.rb b/lib/org-ruby/html_output_buffer.rb
index 9d094ff..b8df0eb 100644
--- a/lib/org-ruby/html_output_buffer.rb
+++ b/lib/org-ruby/html_output_buffer.rb
@@ -146,7 +146,7 @@ module Orgmode
         "#{Tags[marker][:open]}#{s}#{Tags[marker][:close]}"
       end
       str = @re_help.rewrite_images(str) do |link|
-        "<img src=\"#{link}\" />"
+        "<a href=\"#{link}\"><img src=\"#{link}\" /></a>"
       end
       str = @re_help.rewrite_links(str) do |link, text|
         text ||= link
diff --git a/spec/html_examples/inline-formatting.html b/spec/html_examples/inline-formatting.html
index a299a87..448a44b 100644
--- a/spec/html_examples/inline-formatting.html
+++ b/spec/html_examples/inline-formatting.html
@@ -8,3 +8,7 @@
 </ul>
 <p>Note the last one <b>is not</b> a link, as the source doesn’t include it in double-brackets and I don’t auto-recognize URLs.</p>
 <p>I should also handle links with <a href="http://www.xkcd.com">helpful text</a>.</p>
+<p>Helpful addition from <a href="https://github.com/punchagan">punchagan</a>, we now recognize when the link goes to an image and make the link anchor be the image, like this:</p>
+<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>
diff --git a/spec/html_examples/inline-formatting.org b/spec/html_examples/inline-formatting.org
index e3ed59a..d2a65b7 100644
--- a/spec/html_examples/inline-formatting.org
+++ b/spec/html_examples/inline-formatting.org
@@ -15,3 +15,9 @@ double-brackets and I don't auto-recognize URLs.
 
 I should also handle links with [[http://www.xkcd.com][helpful text]].
 
+Helpful addition from [[https://github.com/punchagan][punchagan]], we now
+recognize when the link goes to an image and make the link anchor be the
+image, like this:
+
+- [[http://farm7.static.flickr.com/6078/6084185195_552aa270b2.jpg]]
+
diff --git a/spec/html_examples/inline-images.html b/spec/html_examples/inline-images.html
index e31af9f..562f6c2 100644
--- a/spec/html_examples/inline-images.html
+++ b/spec/html_examples/inline-images.html
@@ -1,6 +1,6 @@
 <p class="title">Inline Images</p>
 <p>Per the org-mode <a href="http://orgmode.org/manual/Images-and-tables.html#Images-and-tables">spec</a>, you can include inline images as links without any descriptive link text, like this:</p>
-<p><img src="http://farm5.static.flickr.com/4049/4358074549_5efb8b4903.jpg" /></p>
+<p><a href="http://farm5.static.flickr.com/4049/4358074549_5efb8b4903.jpg"><img src="http://farm5.static.flickr.com/4049/4358074549_5efb8b4903.jpg" /></a></p>
 <p>I currently do not support the caption/link syntax, but I can include the inline image. I recognize the following image file types:</p>
 <ul>
   <li>.jpg</li>
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 9b976cd..fd37bc6 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -7,8 +7,7 @@ RememberFile = File.join(File.dirname(__FILE__), %w[data remember.org])
 FreeformFile = File.join(File.dirname(__FILE__), %w[data freeform.org])
 FreeformExampleFile = File.join(File.dirname(__FILE__), %w[data freeform-example.org])
 
-
-Spec::Runner.configure do |config|
+RSpec.configure do |config|
   # == Mock Framework
   #
   # RSpec uses it's own mocking framework by default. If you prefer to

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