class RedCloth::TextileDoc
def apply_rules(rules)
def apply_rules(rules) rules.each do |r| method(r).call(self) if self.respond_to?(r) end end
def initialize( string, restrictions = [] )
#=>"
A bold man
"r.to_html
#=> "h1. A *bold* man"
r = RedCloth.new( "h1. A *bold* man" )
any _restrictions_ specified.
Returns a new RedCloth object, based on _string_, observing
def initialize( string, restrictions = [] ) restrictions.each { |r| method("#{r}=").call( true ) } super( string ) end
def to_html( *rules )
#=>"
And then? She fell!
"RedCloth.new( "And then? She *fell*!" ).to_html
Generates HTML from the Textile contents.
def to_html( *rules ) apply_rules(rules) to(RedCloth::Formatters::HTML) end
def to_latex( *rules )
#=> "And then? She \\textbf{fell}!\n\n"
RedCloth.new( "And then? She *fell*!" ).to_latex
Generates LaTeX from the Textile contents.
def to_latex( *rules ) apply_rules(rules) to(RedCloth::Formatters::LATEX) end