diff --git a/lib/hamlit/parsers/script.rb b/lib/hamlit/parsers/script.rb index 4d33406e..47046ff3 100644 --- a/lib/hamlit/parsers/script.rb +++ b/lib/hamlit/parsers/script.rb @@ -10,7 +10,7 @@ module Hamlit include Concerns::Error include Concerns::Indentable - INTERNAL_STATEMENTS = %w[else elsif when].freeze + INTERNAL_STATEMENTS = %w[else elsif rescue ensure when].freeze DEFAULT_SCRIPT_OPTIONS = { force_escape: false, disable_escape: false }.freeze included do diff --git a/spec/hamlit/engine/silent_script_spec.rb b/spec/hamlit/engine/silent_script_spec.rb index efc5d21f..c73b4122 100644 --- a/spec/hamlit/engine/silent_script_spec.rb +++ b/spec/hamlit/engine/silent_script_spec.rb @@ -152,6 +152,20 @@ describe Hamlit::Engine do HTML end + it 'renders begin-rescue' do + assert_render(<<-'HAML', <<-HTML) + - begin + - raise 'error' + - rescue + hello + - ensure + world + HAML + hello + world + HTML + end + it 'joins a next line if a current line ends with ","' do assert_render("- foo = [', \n ']\n= foo", <<-HTML) [", "]