diff --git a/Gemfile b/Gemfile index 092ea9d69b0b300052dd11c5e07555968f710c1b..ae6b917b6202438ff4e838f5590dd76942abb63d 100644 --- a/Gemfile +++ b/Gemfile @@ -76,7 +76,7 @@ gem 'rack-cors', '~> 0.4.0', require: 'rack/cors' gem "kaminari", "~> 0.17.0" # HAML -gem "haml-rails", '~> 0.9.0' +gem "hamlit" # Files attachments gem "carrierwave", '~> 0.10.0' @@ -344,5 +344,6 @@ gem 'oauth2', '~> 1.0.0' # Soft deletion gem "paranoia", "~> 2.0" + # Health check gem 'health_check', '~> 1.5.1' diff --git a/Gemfile.lock b/Gemfile.lock index ba16e4bf3378be01879b9136f96739abe5b71b58..02c7b75aba39d8bdf789bb40ba84b6e0244ff138 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -320,14 +320,10 @@ GEM grape-entity (0.4.8) activesupport multi_json (>= 1.3.2) - haml (4.0.7) + hamlit (2.5.0) + temple (~> 0.7.6) + thor tilt - haml-rails (0.9.0) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) - haml (>= 4.0.6, < 5.0) - html2haml (>= 1.0.1) - railties (>= 4.0.1) hashie (3.4.3) health_check (1.5.1) rails (>= 2.3.0) @@ -337,11 +333,6 @@ GEM html-pipeline (1.11.0) activesupport (>= 2) nokogiri (~> 1.4) - html2haml (2.0.0) - erubis (~> 2.7.0) - haml (~> 4.0.0) - nokogiri (~> 1.6.0) - ruby_parser (~> 3.5) htmlentities (4.3.4) http_parser.rb (0.5.3) httparty (0.13.7) @@ -733,6 +724,7 @@ GEM railties (>= 3.2.5, < 6) teaspoon-jasmine (2.2.0) teaspoon (>= 1.0.0) + temple (0.7.7) term-ansicolor (1.3.2) tins (~> 1.0) test_after_commit (0.4.2) @@ -882,7 +874,7 @@ DEPENDENCIES gon (~> 6.0.1) grape (~> 0.13.0) grape-entity (~> 0.4.2) - haml-rails (~> 0.9.0) + hamlit health_check (~> 1.5.1) hipchat (~> 1.5.0) html-pipeline (~> 1.11.0) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 418598418348c3ed5220b9107d704d4fc1435f5b..62d13a4b4f326f11125888aa9eacae55cb495838 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -197,7 +197,7 @@ module ApplicationHelper def render_markup(file_name, file_content) if gitlab_markdown?(file_name) - Haml::Helpers.preserve(markdown(file_content)) + Hamlit::RailsHelpers.preserve(markdown(file_content)) elsif asciidoc?(file_name) asciidoc(file_content) elsif plain?(file_name) diff --git a/config/initializers/haml.rb b/config/initializers/haml.rb deleted file mode 100644 index 1516476815a56e96907396b699a59de3b2f931c4..0000000000000000000000000000000000000000 --- a/config/initializers/haml.rb +++ /dev/null @@ -1,7 +0,0 @@ -Haml::Template.options[:ugly] = true - -# Remove the `:coffee` and `:coffeescript` filters -# -# See https://git.io/vztMu and http://stackoverflow.com/a/17571242/223897 -Haml::Filters.remove_filter('coffee') -Haml::Filters.remove_filter('coffeescript') diff --git a/config/initializers/hamlit.rb b/config/initializers/hamlit.rb new file mode 100644 index 0000000000000000000000000000000000000000..259d562e58663d5b59310e852cfaa490b571a4d6 --- /dev/null +++ b/config/initializers/hamlit.rb @@ -0,0 +1,15 @@ +module Hamlit + class TemplateHandler + def call(template) + Engine.new( + generator: Temple::Generators::RailsOutputBuffer, + attr_quote: '"', + ).call(template.source) + end + end +end + +ActionView::Template.register_template_handler( + :haml, + Hamlit::TemplateHandler.new, +)