From f10111baa0f0328fca79c5d33a713288c19ee707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20P=C3=A9rez?= Date: Mon, 16 May 2022 11:33:22 +0200 Subject: [PATCH] Remove wlang support --- Gemfile | 1 - lib/sinatra/base.rb | 4 -- sinatra-contrib/lib/sinatra/namespace.rb | 2 +- test/views/hello.wlang | 1 - test/views/layout2.wlang | 2 - test/wlang_test.rb | 87 ------------------------ 6 files changed, 1 insertion(+), 96 deletions(-) delete mode 100644 test/views/hello.wlang delete mode 100644 test/views/layout2.wlang delete mode 100644 test/wlang_test.rb diff --git a/Gemfile b/Gemfile index 142d0422..80050411 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,6 @@ gem "twitter-text", "1.14.7" gem "activesupport", "~> 6.1" gem 'redcarpet', platforms: [ :ruby ] -gem 'wlang', '>= 3.0.1' gem 'rdiscount', platforms: [ :ruby ] gem 'puma' gem 'yajl-ruby', platforms: [ :ruby ] diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 8777a06f..fd209ac5 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -763,10 +763,6 @@ module Sinatra render :mediawiki, template, options, locals end - def wlang(template, options = {}, locals = {}, &block) - render(:wlang, template, options, locals, &block) - end - def yajl(template, options = {}, locals = {}) options[:default_content_type] = :json render :yajl, template, options, locals diff --git a/sinatra-contrib/lib/sinatra/namespace.rb b/sinatra-contrib/lib/sinatra/namespace.rb index efa209ee..0a49e6ed 100644 --- a/sinatra-contrib/lib/sinatra/namespace.rb +++ b/sinatra-contrib/lib/sinatra/namespace.rb @@ -227,7 +227,7 @@ module Sinatra ALLOWED_ENGINES = [ :erb, :erubi, :haml, :hamlit, :builder, :nokogiri, :liquid, :markdown, :rdoc, :asciidoc, :radius, :markaby, - :rabl, :slim, :creole, :mediawiki, :coffee, :yajl, :wlang + :rabl, :slim, :creole, :mediawiki, :coffee, :yajl ] def self.prefixed(*names) diff --git a/test/views/hello.wlang b/test/views/hello.wlang deleted file mode 100644 index 43a86509..00000000 --- a/test/views/hello.wlang +++ /dev/null @@ -1 +0,0 @@ -Hello from wlang! diff --git a/test/views/layout2.wlang b/test/views/layout2.wlang deleted file mode 100644 index 6055260e..00000000 --- a/test/views/layout2.wlang +++ /dev/null @@ -1,2 +0,0 @@ -WLang Layout! -+{yield} diff --git a/test/wlang_test.rb b/test/wlang_test.rb deleted file mode 100644 index 8cadf55e..00000000 --- a/test/wlang_test.rb +++ /dev/null @@ -1,87 +0,0 @@ -require File.expand_path('helper', __dir__) - -begin -require 'wlang' - -class WLangTest < Minitest::Test - def engine - Tilt::WLangTemplate - end - - def wlang_app(&block) - mock_app { - set :views, __dir__ + '/views' - get '/', &block - } - get '/' - end - - it 'uses the correct engine' do - assert_equal engine, Tilt[:wlang] - end - - it 'renders .wlang files in views path' do - wlang_app { wlang :hello } - assert ok? - assert_equal "Hello from wlang!\n", body - end - - it 'renders in the app instance scope' do - mock_app do - helpers do - def who; "world"; end - end - get('/') { wlang 'Hello +{who}!' } - end - get '/' - assert ok? - assert_equal 'Hello world!', body - end - - it 'takes a :locals option' do - wlang_app do - locals = {:foo => 'Bar'} - wlang 'Hello ${foo}!', :locals => locals - end - assert ok? - assert_equal 'Hello Bar!', body - end - - it "renders with inline layouts" do - mock_app do - layout { 'THIS. IS. +{yield.upcase}!' } - get('/') { wlang 'Sparta' } - end - get '/' - assert ok? - assert_equal 'THIS. IS. SPARTA!', body - end - - it "renders with file layouts" do - wlang_app { wlang 'Hello World', :layout => :layout2 } - assert ok? - assert_body "WLang Layout!\nHello World" - end - - it "can rendered truly nested layouts by accepting a layout and a block with the contents" do - mock_app do - template(:main_outer_layout) { "

Title

\n>{ yield }" } - template(:an_inner_layout) { "

Subtitle

\n>{ yield }" } - template(:a_page) { "

Contents.

\n" } - get('/') do - wlang :main_outer_layout, :layout => false do - wlang :an_inner_layout do - wlang :a_page - end - end - end - end - get '/' - assert ok? - assert_body "

Title

\n

Subtitle

\n

Contents.

\n" - end -end - -rescue LoadError - warn "#{$!}: skipping wlang tests" -end