Module: SM::Flow

Defined in:
lib/ihelp.rb

Instance Method Summary collapse

Instance Method Details

#to_htmlObject



958
959
960
961
962
963
964
965
966
# File 'lib/ihelp.rb', line 958

def to_html
  tag = self.class.to_s.split("::").last
  tag = "PRE" if tag == "VERB"
  xmlstr = %Q(<#{tag}>
    #{body if respond_to? :body}
    #{contents.map{|c|c.to_html} if respond_to? :content}
  </#{tag}>)
  REXML::Document.new(xmlstr)
end

#to_textObject



943
944
945
946
947
948
949
950
951
952
953
954
955
956
# File 'lib/ihelp.rb', line 943

def to_text
  RI::TextFormatter.allocate.conv_html(
    if respond_to? :body
      body
    else
      ""
    end +
    if respond_to? :contents
      contents.map{|c| c.to_text }.join("\n\n")
    else
      ""
    end
  ).gsub(/<\/?..>/, '')
end