Suppress format deprecation warnings

This commit is contained in:
Takashi Kokubun 2015-11-13 23:19:37 +09:00
parent f5df74a37d
commit 0eeebd4e0c
3 changed files with 17 additions and 2 deletions

View File

@ -1,6 +1,7 @@
require 'temple'
require 'hamlit/parser'
require 'hamlit/compiler'
require 'hamlit/html'
require 'pretty_hamlit/engine'
module Hamlit
@ -21,7 +22,7 @@ module Hamlit
use Parser
use Compiler
html :Fast
use HTML
filter :Escapable
filter :ControlFlow
filter :MultiFlattener

13
lib/hamlit/html.rb Normal file
View File

@ -0,0 +1,13 @@
module Hamlit
class HTML < Temple::HTML::Fast
DEPRECATED_FORMATS = %i[html4 html5].freeze
def initialize(opts = {})
if DEPRECATED_FORMATS.include?(opts[:format])
opts = opts.dup
opts[:format] = :html
end
super(opts)
end
end
end

View File

@ -1,5 +1,6 @@
require 'temple'
require 'hamlit/parser'
require 'hamlit/html'
require 'pretty_hamlit/compiler'
require 'pretty_hamlit/dynamic_indentation'
@ -21,7 +22,7 @@ module PrettyHamlit
use Hamlit::Parser
use Compiler
html :Fast
use Hamlit::HTML
filter :Escapable
filter :ControlFlow
filter :MultiFlattener