Class: Haml::Filters::Documentation

Inherits:
Base
  • Object
show all
Defined in:
lib/rbbt/rest/common/misc.rb

Instance Method Summary collapse

Instance Method Details

#render(text) ⇒ Object



344
345
346
347
348
349
350
351
352
353
354
# File 'lib/rbbt/rest/common/misc.rb', line 344

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