class RDocText
This allows a us to create a wrapper object similar to those provided by the Markdown and Textile libraries. It stores the original and formated HTML text in instance variables. It also stores the SimpleMarkup parser objects in instance variables.
Attributes
html[R]
html_formater[R]
markup[R]
text[R]
Public Class Methods
new(str)
click to toggle source
Calls superclass method
# File lib/acts_as_markup/exts/rdoc.rb, line 71 def initialize(str) super(str) @text = str.to_s @markup = RDoc::Markup.new # external hyperlinks @markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK) # and links of the form <text>[<url>] @markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\.\S+?\])/, :TIDYLINK) # Convert leading comment markers to spaces, but only # if all non-blank lines have them if str =~ /^(?>\s*)[^\#]/ content = str else content = str.gsub(/^\s*(#+)/) { $1.tr('#',' ') } end @html_formatter = RDocWithHyperlinkToHtml.new(RDoc::Options.new, @markup) @html = @html_formatter.convert(@text) end
Public Instance Methods
to_html()
click to toggle source
# File lib/acts_as_markup/exts/rdoc.rb, line 96 def to_html @html end