vendor/bundle/ruby/2.1.0/gems/org-ruby-0.9.12/lib/org-ruby/textile_output_buffer.rb
def inline_formatting(input)
      @re_help.rewrite_emphasis input do |marker, body|
        m = TextileMap[marker]
        "#{m}#{body}#{m}"
      end
      @re_help.rewrite_subp input do |type, text|
        if type == "_" then
          "~#{text}~"
        elsif type == "^" then
          "^#{text}^"
        end
      end
      @re_help.rewrite_links input do |link, defi|
        [link, defi].compact.each do |text|
          # We don't support search links right now. Get rid of it.
          text.sub!(/\A(file:[^\s]+)::[^\s]*?\Z/, "\\1")
          text.sub!(/\A(file:[^\s]+)\.org\Z/i, "\\1.textile")
          text.sub!(/\Afile:(?=[^\s]+\Z)/, "")
        end

        # We don't add a description for images in links, because its
        # empty value forces the image to be inlined.
        defi ||= link unless link =~ @re_help.org_image_file_regexp
        link = link.gsub(/ /, "%%20")

        if defi =~ @re_help.org_image_file_regexp
          defi = "!#{defi}(#{defi})!"
        elsif defi
          defi = "\"#{defi}\""
        end

        if defi
          "#{defi}:#{link}"
        else
          "!#{link}(#{link})!"
        end
      end
      @re_help.rewrite_footnote input do |name, definition|
        # textile only support numerical names, so we need to do some conversion
        # Try to find the footnote and use its index
        footnote = @footnotes.select {|f| f[:name] == name }.first
        if footnote
          # The latest definition overrides other ones
          footnote[:definition] = definition if definition and not footnote[:definition]
        else
          # There is no footnote with the current name so we add it
          footnote = { :name => name, :definition => definition }
          @footnotes << footnote
        end

        "[#{@footnotes.index(footnote)}]"
      end
      Orgmode.special_symbols_to_textile(input)
      input = @re_help.restore_code_snippets input
      input
    end
# Handles inline formatting for textile.
Handles inline formatting for textile.
Handles inline formatting for textile .
def inline_formatting(input)
      @re_help.rewrite_emphasis input do |marker, body|
        m = TextileMap[marker]
        "#{m}#{body}#{m}"
      end
      @re_help.rewrite_subp input do |type, text|
        if type == "_" then
          "~#{text}~"
        elsif type == "^" then
          "^#{text}^"
        end
      end
      @re_help.rewrite_links input do |link, defi|
        [link, defi].compact.each do |text|
          text.sub!(/\A(file:[^\s]+)::[^\s]*?\Z/, "\\1")
          text.sub!(/\A(file:[^\s]+)\.org\Z/i, "\\1.textile")
          text.sub!(/\Afile:(?=[^\s]+\Z)/, "")
        end
        defi ||= link unless link =~ @re_help.org_image_file_regexp
        link = link.gsub(/ /, "%%20")
        if defi =~ @re_help.org_image_file_regexp
          defi = "!#{defi}(#{defi})!"
        elsif defi
          defi = "\"#{defi}\""
        end
        if defi
          "#{defi}:#{link}"
        else
          "!#{link}(#{link})!"
        end
      end
      @re_help.rewrite_footnote input do |name, definition|
        footnote = @footnotes.select {|f| f[:name] == name }.first
        if footnote
          footnote[:definition] = definition if definition and not footnote[:definition]
        else
          footnote = { :name => name, :definition => definition }
          @footnotes << footnote
        end
        "[#{@footnotes.index(footnote)}]"
      end
      Orgmode.special_symbols_to_textile(input)
      input = @re_help.restore_code_snippets input
      input
    end
def inline_formatting ( input ) @re_help . rewrite_emphasis input do | marker , body | m = TextileMap [ marker ] "#{m}#{body}#{m}" end @re_help . rewrite_subp input do | type , text | if type == "_" then "~#{text}~" elsif type == "^" then "^#{text}^" end end @re_help . rewrite_links input do | link , defi | [ link , defi ] . compact . each do | text | text . sub! ( / \A (file:[^ \s ]+)::[^ \s ]*? \Z / , "\\1" ) text . sub! ( / \A (file:[^ \s ]+) \. org \Z /i , "\\1.textile" ) text . sub! ( / \A file:(?=[^ \s ]+ \Z ) / , "" ) end defi ||= link unless link =~ @re_help . org_image_file_regexp link = link . gsub ( / / , "%%20" ) if defi =~ @re_help . org_image_file_regexp defi = "!#{defi}(#{defi})!" elsif defi defi = "\"#{defi}\"" end if defi "#{defi}:#{link}" else "!#{link}(#{link})!" end end @re_help . rewrite_footnote input do | name , definition | footnote = @footnotes . select { | f | f [ :name ] == name } . first if footnote footnote [ :definition ] = definition if definition and not footnote [ :definition ] else footnote = { :name => name , :definition => definition } @footnotes << footnote end "[#{@footnotes.index(footnote)}]" end Orgmode . special_symbols_to_textile ( input ) input = @re_help . restore_code_snippets input input end
Handles inline formatting for textile.
Handles inline formatting for textile .
# We don't support search links right now. Get rid of it. # We don't add a description for images in links, because its # empty value forces the image to be inlined. # textile only support numerical names, so we need to do some conversion # Try to find the footnote and use its index # The latest definition overrides other ones # There is no footnote with the current name so we add it
input