Module: Haml::Filters::Documentation

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

Instance Method Summary collapse

Instance Method Details

#render(text) ⇒ Object



419
420
421
422
423
424
425
426
427
428
429
# File 'lib/rbbt/rest/common/misc.rb', line 419

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