class Filters::Documentation

Public Instance Methods

compile(node) click to toggle source
# File lib/rbbt/rest/common/misc.rb, line 349
    def compile(node)
      text = node.value[:text]
      text = "<br/>" if text.strip.empty?

      doc_text =<<-EOF
%section.documentation#{ text.gsub(/\s/,'').length < 80 * 10 ? '.short' : ''}
  :markdown
#{text.gsub(/^/,"    ")}
      EOF

      node.value[:text] = doc_text
      compile_with_tilt(node, 'haml')
    end
render(text) click to toggle source
# File lib/rbbt/rest/common/misc.rb, line 389
                def render(text)
                        text = "<br/>" if text.strip.empty?

                        doc_text =<<-EOF
%section.documentation#{ text.gsub(/\s/,'').length < 80 * 10 ? '.short' : ''}
  :markdown
#{text.gsub(/^/,"    ")}
      EOF

                        Haml::Engine.new(doc_text).to_html  
                end