Module: Haml::Filters::Documentation

Includes:
Base
Defined in:
lib/rbbt/rest/common/misc.rb

Instance Method Summary collapse

Instance Method Details

#render(text) ⇒ Object



321
322
323
324
325
326
327
328
329
330
331
# File 'lib/rbbt/rest/common/misc.rb', line 321

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