[DRE-commits] [ruby-org] 130/303: Fixed bug when angle links and normal links are on the same paragraph

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 7c61bd76206517e08bd00504931ac41dc04f2a93
Author: Waldemar Quevedo <waldemar.quevedo at mail.rakuten.com>
Date:   Sat Mar 31 12:49:06 2012 +0900

    Fixed bug when angle links and normal links are on the same paragraph
---
 lib/org-ruby/regexp_helper.rb             |   13 ++++---------
 spec/html_examples/inline-formatting.html |    5 +++++
 spec/html_examples/inline-formatting.org  |   10 ++++++++++
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/lib/org-ruby/regexp_helper.rb b/lib/org-ruby/regexp_helper.rb
index 801cff0..0a48762 100644
--- a/lib/org-ruby/regexp_helper.rb
+++ b/lib/org-ruby/regexp_helper.rb
@@ -141,17 +141,12 @@ module Orgmode
     # HTML-style link, and that is how things will get recorded in
     # +result+.
     def rewrite_links(str) #  :yields: link, text
-      i = str.gsub(@org_link_regexp) do |match|
+      str.gsub(@org_link_regexp) do |match|
         yield $1, nil
-      end
-      if str =~ @org_angle_link_text_regexp
-        i.gsub(@org_angle_link_text_regexp) do |match|
-          yield "#{$2}:#{$3}", nil
-        end
-      else
-        i.gsub(@org_link_text_regexp) do |match|
+      end.gsub(@org_link_text_regexp) do |match|
           yield $1, $2
-        end
+      end.gsub(@org_angle_link_text_regexp) do |match|
+          yield "#{$2}:#{$3}", nil
       end
     end
 
diff --git a/spec/html_examples/inline-formatting.html b/spec/html_examples/inline-formatting.html
index 2b8476f..74e8d24 100644
--- a/spec/html_examples/inline-formatting.html
+++ b/spec/html_examples/inline-formatting.html
@@ -18,3 +18,8 @@
 </ul>
 <p>Helpful addition from <a href="https://github.com/wallyqs">wallyqs</a>:</p>
 <p>While “naked” links don’t work (like http://www.google.com), angle links do work. This should look like a link: <a href="http://www.google.com">http://www.google.com</a>.</p>
+<p>It should be possible to use both kind of links on the same paragraph:</p>
+<p>This is an angle link <a href="http://google.com">http://google.com</a> and this is a bracket link <a href="https://github.com/bdewey/org-ruby">to a repository</a>.</p>
+<p>This is a bracket link <a href="https://github.com/bdewey/org-ruby">to a repository</a> and this is an angle link <a href="http://google.com">http://google.com</a>.</p>
+<p>This is a bracket link <a href="https://github.com/bdewey/org-ruby">to a repository</a> and this is a bracket link too  <a href="https://github.com/bdewey/org-ruby">to a repository</a>.</p>
+<p>This is an angle link <a href="http://google.com">http://google.com</a> and this is an angle link too <a href="http://google.com">http://google.com</a>.</p>
diff --git a/spec/html_examples/inline-formatting.org b/spec/html_examples/inline-formatting.org
index 1a45e4d..46f93fe 100644
--- a/spec/html_examples/inline-formatting.org
+++ b/spec/html_examples/inline-formatting.org
@@ -31,3 +31,13 @@ Helpful addition from [[https://github.com/wallyqs][wallyqs]]:
 
 While "naked" links don't work (like http://www.google.com), angle links
 do work. This should look like a link: <http://www.google.com>.
+
+It should be possible to use both kind of links on the same paragraph:
+
+This is an angle link <http://google.com> and this is a bracket link [[https://github.com/bdewey/org-ruby][to a repository]].
+
+This is a bracket link [[https://github.com/bdewey/org-ruby][to a repository]] and this is an angle link <http://google.com>.
+
+This is a bracket link [[https://github.com/bdewey/org-ruby][to a repository]] and this is a bracket link too  [[https://github.com/bdewey/org-ruby][to a repository]].
+
+This is an angle link <http://google.com> and this is an angle link too <http://google.com>.

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