File: erb_extension.rb

package info (click to toggle)
ruby-redcloth 4.3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 712 kB
  • sloc: ruby: 1,233; ansic: 201; makefile: 22
file content (27 lines) | stat: -rw-r--r-- 521 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class ERB
  module Util

    #
    # A utility method for transforming Textile in _s_ to HTML.
    # 
    # 	require "erb"
    # 	include ERB::Util
    # 	
    # 	puts textilize("Isn't ERB *great*?")
    # 
    # _Generates_
    # 
    # 	<p>Isn&#8217;t <span class="caps">ERB</span> <strong>great</strong>?</p>
    #
    def textilize( s )
      if s && s.respond_to?(:to_s)
        RedCloth.new( s.to_s ).to_html
      end
    end

    alias t textilize
    module_function :t
    module_function :textilize

  end
end