Module: StaticCms::Helpers

Extended by:
RubyPatch::AutoLoad
Defined in:
lib/static_cms/helpers.rb

Constant Summary collapse

EXT_TO_LANG =
Hash.new(:general)\
    .merge({
  '.f90' => :fortran,
  '.f95' => :fortran,
  '.f03' => :fortran,
  '.f08' => :fortran,
  '.f' => :fortran,
  '.f77' => :fortran,
  '.rb' => :ruby,
})

Class Method Summary collapse

Class Method Details

.puts_system(command) ⇒ Object



29
30
31
32
# File 'lib/static_cms/helpers.rb', line 29

def puts_system(command)
  puts "\n" + command
  system command
end

.to_code(text, lang = :general) ⇒ Object



24
25
26
27
# File 'lib/static_cms/helpers.rb', line 24

def to_code(text, lang = :general)
  pre_text = to_plain(text)
  "<pre class='code'><code class='#{lang}'>#{pre_text}</code></pre>"
end

.to_plain(text) ⇒ Object



19
20
21
22
# File 'lib/static_cms/helpers.rb', line 19

def to_plain(text)
  escaped_text = ::Haml::Helpers.html_escape(text)
  ::Haml::Helpers.preserve(escaped_text)
end