vendor/bundle/ruby/2.1.0/gems/org-ruby-0.9.12/lib/org-ruby/regexp_helper.rb
def rewrite_links str # :yields: link, text
      str.gsub! @org_link_regexp do |match|
        yield $1, $3
      end
      str.gsub! @org_angle_link_text_regexp do |match|
        yield $1, nil
      end

      str # for testing
    end
# = Summary
#
# Rewrite org-mode links in a string to markup suitable to the
# output format.
#
# = Usage
#
# Give this a block that expect the link and optional friendly
# text. Return how that link should get formatted.
#
# = Example
#
#   re = RegexpHelper.new
#   result = re.rewrite_links("[[http://www.bing.com]] and [[http://www.hotmail.com][Hotmail]]") do |link, text}
#       text ||= link
#       "<a href=\"#{link}\">#{text}</a>"
#    end
#
# In this example, the block body will get called two times. In the
# first instance, +text+ will be nil (the org-mode markup gives no
# friendly text for the link +http://www.bing.com+. In the second
# instance, the block will get text of *Hotmail* and the link
# +http://www.hotmail.com+. In both cases, the block returns an
# HTML-style link, and that is how things will get recorded in
# +result+.
Summary
Rewrite org-mode links in a string to markup suitable to the
output format.

Usage

Give this a block that expect the link and optional friendly
text. Return how that link should get formatted.

Example



In this example, the block body will get called two times.
Summary Rewrite org - mode links in a string to markup suitable to the output format . Usage Give this a block that expect the link and optional friendly text . Return how that link should get formatted . Example In this example the block body will get called two times .
def rewrite_links str 
      str.gsub! @org_link_regexp do |match|
        yield $1, $3
      end
      str.gsub! @org_angle_link_text_regexp do |match|
        yield $1, nil
      end
      str 
    end
def rewrite_links str str . gsub! @org_link_regexp do | match | yield $1 , $3 end str . gsub! @org_angle_link_text_regexp do | match | yield $1 , nil end str end
Summary
Rewrite org-mode links in a string to markup suitable to the
output format.
Summary Rewrite org - mode links in a string to markup suitable to the output format .
# :yields: link, text # for testing
str