text
-How do you do?
-diff --git a/browser_tests.rb b/browser_tests.rb index 84eac57b..27bbe615 100755 --- a/browser_tests.rb +++ b/browser_tests.rb @@ -109,15 +109,10 @@ def view_template s.cdata(line) s.cdata { line } end - erb_snippet(line:) end end end end - - erb :erb_snippet, <<~HTML, locals: %(line:) - <%= @line %> - HTML end class XSSWithSymbols < Phlex::HTML diff --git a/lib/phlex/sgml.rb b/lib/phlex/sgml.rb index cd54dbef..0eae06da 100644 --- a/lib/phlex/sgml.rb +++ b/lib/phlex/sgml.rb @@ -2,17 +2,6 @@ # **Standard Generalized Markup Language** for behaviour common to {HTML} and {SVG}. class Phlex::SGML - ERBCompiler = ERB::Compiler.new("<>").tap do |compiler| - compiler.pre_cmd = [""] - compiler.put_cmd = "@_state.buffer.<<" - compiler.insert_cmd = "__implicit_output__" - compiler.post_cmd = ["nil"] - - def compiler.add_insert_cmd(out, content) - out.push("#{@insert_cmd}((#{content}))") - end - end - include Phlex::Helpers class << self @@ -32,40 +21,6 @@ def new(*a, **k, &block) super end end - - def erb(method_name, erb = nil, locals: nil, &block) - loc = caller_locations(1, 1)[0] - path = loc.path.delete_suffix(".rb") - file = loc.path - line = loc.lineno - 1 - - unless erb - method_path = "#{path}/#{method_name}.html.erb" - sidecar_path = "#{path}.html.erb" - - if File.exist?(method_path) - erb = File.read(method_path) - file = method_path - line = 1 - elsif method_name == :view_template && File.exist?(sidecar_path) - erb = File.read(sidecar_path) - file = sidecar_path - line = 1 - else - raise Phlex::RuntimeError.new(<<~MESSAGE) - No ERB template found for #{method_name} - MESSAGE - end - end - - code, _enc = ERBCompiler.compile(erb) - - class_eval(<<~RUBY, file, line) - def #{method_name} #{locals} - #{code} - end - RUBY - end end def view_template diff --git a/quickdraw/erb.test.rb b/quickdraw/erb.test.rb deleted file mode 100644 index 838074a0..00000000 --- a/quickdraw/erb.test.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -class Example < Phlex::HTML - def initialize - @text = "text" - @html = safe "
How do you do?
-