Sha256: c246f95a91c81c875d8644bb1bb858880d3d2375818bc76f633d448b5bb33748

Contents?: true

Size: 600 Bytes

Versions: 6

Compression:

Stored size: 600 Bytes

Contents

require 'gettext_i18n_rails/base_parser'

module GettextI18nRails
  class HamlParser < BaseParser
    def self.extension
      "haml"
    end

    def self.convert_to_code(text)
      case @library_loaded
      when "haml"
        if Haml::VERSION.split('.').first.to_i <= 5
          Haml::Engine.new(text).precompiled()
        else
          Haml::Engine.new.call(text)
        end
      when "hamlit"
        Hamlit::Engine.new.call(text)
      end
    end

    def self.libraries
      ["haml", "hamlit"]
    end
  end
end

GettextI18nRails::GettextHooks.add_parser GettextI18nRails::HamlParser

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gettext_i18n_rails-1.13.0 lib/gettext_i18n_rails/haml_parser.rb
gettext_i18n_rails-1.12.0 lib/gettext_i18n_rails/haml_parser.rb
gettext_i18n_rails-1.11.0 lib/gettext_i18n_rails/haml_parser.rb
gettext_i18n_rails-1.10.1 lib/gettext_i18n_rails/haml_parser.rb
gettext_i18n_rails-1.10.0 lib/gettext_i18n_rails/haml_parser.rb
gettext_i18n_rails-1.9.0 lib/gettext_i18n_rails/haml_parser.rb