Sha256: eca221b5b11640e94c04fc1da047eca8f06e4be3a2636fc6a0e46e9aeaa69dd5

Contents?: true

Size: 680 Bytes

Versions: 2

Compression:

Stored size: 680 Bytes

Contents

module ::StaticCms::Helpers
  require 'haml'
  require 'ruby_patch'
  extend ::RubyPatch::AutoLoad

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

  module_function

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
static_cms-1.2.1 lib/static_cms/helpers.rb
static_cms-1.2.0 lib/static_cms/helpers.rb