def text_to_html(text, options)
      html = text
      if options[:escaped]
        html = CGI.escape_html(html)
      end
      if options[:br]
        html = html.gsub("\n", "<br/>")
      end
      if options[:nbsp]
        tags_and_text = Helpers.split_tags_and_text(html)
        html = tags_and_text.map do |tag_or_text| 
          if tag_or_text[0] then tag_or_text[0] else tag_or_text[1].gsub(" ", "&nbsp;") end
        end.join("")
      end
      html
    end
def text_to_html(text, options)
      html = text
      if options[:escaped]
        html = CGI.escape_html(html)
      end
      if options[:br]
        html = html.gsub("\n", "<br/>")
      end
      if options[:nbsp]
        tags_and_text = Helpers.split_tags_and_text(html)
        html = tags_and_text.map do |tag_or_text| 
          if tag_or_text[0] then tag_or_text[0] else tag_or_text[1].gsub(" ", "&nbsp;") end
        end.join("")
      end
      html
    end
Convert text content into HTML according to various true/false options.
 Note: the text may contain HTML tags
 * :escaped - if true, HTML-escape the text
 * :br - if true, convert end-of-line characters to <br/> tags
 * :nbsp - if true, convert all spaces in the text that is not in tags into &nbsp;
 Of these options, *:escaped* only makes sense if you _don't_ want to include additional HTML
 markup in the content; *:br* and *:nbsp* make sense for programming languages but not for
 natural languages.