mega-quick-lib 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/mega-quick-lib.gemspec +12 -0
- data/slim-5.2.1/CHANGES +496 -0
- data/slim-5.2.1/Gemfile +43 -0
- data/slim-5.2.1/LICENSE +21 -0
- data/slim-5.2.1/README.jp.md +1276 -0
- data/slim-5.2.1/README.md +1313 -0
- data/slim-5.2.1/Rakefile +80 -0
- data/slim-5.2.1/bin/slimrb +6 -0
- data/slim-5.2.1/doc/include.md +20 -0
- data/slim-5.2.1/doc/jp/include.md +20 -0
- data/slim-5.2.1/doc/jp/logic_less.md +137 -0
- data/slim-5.2.1/doc/jp/smart.md +102 -0
- data/slim-5.2.1/doc/jp/translator.md +28 -0
- data/slim-5.2.1/doc/logic_less.md +137 -0
- data/slim-5.2.1/doc/smart.md +120 -0
- data/slim-5.2.1/doc/translator.md +28 -0
- data/slim-5.2.1/lib/slim/code_attributes.rb +68 -0
- data/slim-5.2.1/lib/slim/command.rb +122 -0
- data/slim-5.2.1/lib/slim/controls.rb +61 -0
- data/slim-5.2.1/lib/slim/do_inserter.rb +34 -0
- data/slim-5.2.1/lib/slim/embedded.rb +248 -0
- data/slim-5.2.1/lib/slim/end_inserter.rb +63 -0
- data/slim-5.2.1/lib/slim/engine.rb +42 -0
- data/slim-5.2.1/lib/slim/erb_converter.rb +15 -0
- data/slim-5.2.1/lib/slim/filter.rb +31 -0
- data/slim-5.2.1/lib/slim/grammar.rb +24 -0
- data/slim-5.2.1/lib/slim/include.rb +58 -0
- data/slim-5.2.1/lib/slim/interpolation.rb +36 -0
- data/slim-5.2.1/lib/slim/logic_less/context.rb +126 -0
- data/slim-5.2.1/lib/slim/logic_less/filter.rb +81 -0
- data/slim-5.2.1/lib/slim/logic_less.rb +6 -0
- data/slim-5.2.1/lib/slim/parser.rb +535 -0
- data/slim-5.2.1/lib/slim/railtie.rb +19 -0
- data/slim-5.2.1/lib/slim/smart/escaper.rb +42 -0
- data/slim-5.2.1/lib/slim/smart/filter.rb +97 -0
- data/slim-5.2.1/lib/slim/smart/parser.rb +35 -0
- data/slim-5.2.1/lib/slim/smart.rb +9 -0
- data/slim-5.2.1/lib/slim/splat/builder.rb +115 -0
- data/slim-5.2.1/lib/slim/splat/filter.rb +93 -0
- data/slim-5.2.1/lib/slim/template.rb +6 -0
- data/slim-5.2.1/lib/slim/translator.rb +119 -0
- data/slim-5.2.1/lib/slim/version.rb +6 -0
- data/slim-5.2.1/lib/slim.rb +16 -0
- data/slim-5.2.1/slim.gemspec +33 -0
- data/slim-5.2.1/test/core/helper.rb +201 -0
- data/slim-5.2.1/test/core/test_code_blocks.rb +194 -0
- data/slim-5.2.1/test/core/test_code_escaping.rb +162 -0
- data/slim-5.2.1/test/core/test_code_evaluation.rb +181 -0
- data/slim-5.2.1/test/core/test_code_output.rb +168 -0
- data/slim-5.2.1/test/core/test_code_structure.rb +203 -0
- data/slim-5.2.1/test/core/test_commands.rb +219 -0
- data/slim-5.2.1/test/core/test_embedded_engines.rb +247 -0
- data/slim-5.2.1/test/core/test_encoding.rb +28 -0
- data/slim-5.2.1/test/core/test_erb_converter.rb +65 -0
- data/slim-5.2.1/test/core/test_html_attributes.rb +276 -0
- data/slim-5.2.1/test/core/test_html_escaping.rb +65 -0
- data/slim-5.2.1/test/core/test_html_structure.rb +599 -0
- data/slim-5.2.1/test/core/test_parser_errors.rb +148 -0
- data/slim-5.2.1/test/core/test_pretty.rb +163 -0
- data/slim-5.2.1/test/core/test_ruby_errors.rb +200 -0
- data/slim-5.2.1/test/core/test_slim_template.rb +78 -0
- data/slim-5.2.1/test/core/test_splat_prefix_option.rb +155 -0
- data/slim-5.2.1/test/core/test_tabs.rb +169 -0
- data/slim-5.2.1/test/core/test_text_interpolation.rb +79 -0
- data/slim-5.2.1/test/core/test_thread_options.rb +18 -0
- data/slim-5.2.1/test/core/test_unicode.rb +15 -0
- data/slim-5.2.1/test/include/files/recursive.slim +1 -0
- data/slim-5.2.1/test/include/files/slimfile.slim +3 -0
- data/slim-5.2.1/test/include/files/subdir/test.slim +1 -0
- data/slim-5.2.1/test/include/files/textfile +1 -0
- data/slim-5.2.1/test/include/test_include.rb +24 -0
- data/slim-5.2.1/test/literate/TESTS.md +1323 -0
- data/slim-5.2.1/test/literate/helper.rb +15 -0
- data/slim-5.2.1/test/literate/run.rb +92 -0
- data/slim-5.2.1/test/logic_less/test_logic_less.rb +330 -0
- data/slim-5.2.1/test/rails/Rakefile +7 -0
- data/slim-5.2.1/test/rails/app/assets/config/manifest.js +1 -0
- data/slim-5.2.1/test/rails/app/controllers/application_controller.rb +2 -0
- data/slim-5.2.1/test/rails/app/controllers/entries_controller.rb +5 -0
- data/slim-5.2.1/test/rails/app/controllers/slim_controller.rb +46 -0
- data/slim-5.2.1/test/rails/app/helpers/application_helper.rb +5 -0
- data/slim-5.2.1/test/rails/app/models/entry.rb +16 -0
- data/slim-5.2.1/test/rails/app/views/entries/edit.html.slim +3 -0
- data/slim-5.2.1/test/rails/app/views/layouts/application.html+testvariant.slim +10 -0
- data/slim-5.2.1/test/rails/app/views/layouts/application.html.slim +10 -0
- data/slim-5.2.1/test/rails/app/views/slim/_partial.html.slim +1 -0
- data/slim-5.2.1/test/rails/app/views/slim/attributes.html.slim +3 -0
- data/slim-5.2.1/test/rails/app/views/slim/content_for.html.slim +7 -0
- data/slim-5.2.1/test/rails/app/views/slim/erb.html.erb +1 -0
- data/slim-5.2.1/test/rails/app/views/slim/form_for.html.slim +2 -0
- data/slim-5.2.1/test/rails/app/views/slim/helper.html.slim +4 -0
- data/slim-5.2.1/test/rails/app/views/slim/integers.html.slim +1 -0
- data/slim-5.2.1/test/rails/app/views/slim/no_layout.html.slim +1 -0
- data/slim-5.2.1/test/rails/app/views/slim/normal.html.slim +1 -0
- data/slim-5.2.1/test/rails/app/views/slim/partial.html.slim +2 -0
- data/slim-5.2.1/test/rails/app/views/slim/splat.html.slim +2 -0
- data/slim-5.2.1/test/rails/app/views/slim/splat_with_delimiter.slim +1 -0
- data/slim-5.2.1/test/rails/app/views/slim/thread_options.html.slim +1 -0
- data/slim-5.2.1/test/rails/app/views/slim/variables.html.slim +1 -0
- data/slim-5.2.1/test/rails/app/views/slim/xml.slim +1 -0
- data/slim-5.2.1/test/rails/config/application.rb +44 -0
- data/slim-5.2.1/test/rails/config/boot.rb +10 -0
- data/slim-5.2.1/test/rails/config/environment.rb +5 -0
- data/slim-5.2.1/test/rails/config/environments/test.rb +34 -0
- data/slim-5.2.1/test/rails/config/initializers/backtrace_silencers.rb +7 -0
- data/slim-5.2.1/test/rails/config/initializers/inflections.rb +10 -0
- data/slim-5.2.1/test/rails/config/initializers/mime_types.rb +5 -0
- data/slim-5.2.1/test/rails/config/initializers/session_store.rb +8 -0
- data/slim-5.2.1/test/rails/config/locales/en.yml +5 -0
- data/slim-5.2.1/test/rails/config/routes.rb +60 -0
- data/slim-5.2.1/test/rails/config.ru +4 -0
- data/slim-5.2.1/test/rails/script/rails +6 -0
- data/slim-5.2.1/test/rails/test/helper.rb +34 -0
- data/slim-5.2.1/test/rails/test/test_slim.rb +102 -0
- data/slim-5.2.1/test/sinatra/contest.rb +91 -0
- data/slim-5.2.1/test/sinatra/helper.rb +143 -0
- data/slim-5.2.1/test/sinatra/test_core.rb +91 -0
- data/slim-5.2.1/test/sinatra/test_include.rb +16 -0
- data/slim-5.2.1/test/sinatra/views/embed_include_js.slim +8 -0
- data/slim-5.2.1/test/sinatra/views/embed_js.slim +11 -0
- data/slim-5.2.1/test/sinatra/views/footer.slim +1 -0
- data/slim-5.2.1/test/sinatra/views/hello.slim +1 -0
- data/slim-5.2.1/test/sinatra/views/layout2.slim +3 -0
- data/slim-5.2.1/test/smart/test_smart_text.rb +294 -0
- data/slim-5.2.1/test/translator/test_translator.rb +76 -0
- metadata +166 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Slim
|
|
3
|
+
# Slim expression grammar
|
|
4
|
+
# @api private
|
|
5
|
+
module Grammar
|
|
6
|
+
extend Temple::Grammar
|
|
7
|
+
|
|
8
|
+
TextTypes << :verbatim | :explicit | :implicit | :inline
|
|
9
|
+
|
|
10
|
+
Expression <<
|
|
11
|
+
[:slim, :control, String, Expression] |
|
|
12
|
+
[:slim, :output, Bool, String, Expression] |
|
|
13
|
+
[:slim, :interpolate, String] |
|
|
14
|
+
[:slim, :embedded, String, Expression, HTMLAttrGroup] |
|
|
15
|
+
[:slim, :text, TextTypes, Expression] |
|
|
16
|
+
[:slim, :attrvalue, Bool, String]
|
|
17
|
+
|
|
18
|
+
HTMLAttr <<
|
|
19
|
+
[:slim, :splat, String]
|
|
20
|
+
|
|
21
|
+
HTMLAttrGroup <<
|
|
22
|
+
[:html, :attrs, 'HTMLAttr*']
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'slim'
|
|
3
|
+
|
|
4
|
+
module Slim
|
|
5
|
+
# Handles inlined includes
|
|
6
|
+
#
|
|
7
|
+
# Slim files are compiled, non-Slim files are included as text with `#{interpolation}`
|
|
8
|
+
#
|
|
9
|
+
# @api private
|
|
10
|
+
class Include < Slim::Filter
|
|
11
|
+
define_options :file, include_dirs: [Dir.pwd, '.']
|
|
12
|
+
|
|
13
|
+
def on_html_tag(tag, attributes, content = nil)
|
|
14
|
+
return super if tag != 'include'
|
|
15
|
+
name = content.to_a.flatten.select {|s| String === s }.join
|
|
16
|
+
raise ArgumentError, 'Invalid include statement' unless attributes == [:html, :attrs] && !name.empty?
|
|
17
|
+
unless file = find_file(name)
|
|
18
|
+
name = "#{name}.slim" if name !~ /\.slim\Z/i
|
|
19
|
+
file = find_file(name)
|
|
20
|
+
end
|
|
21
|
+
raise Temple::FilterError, "'#{name}' not found in #{options[:include_dirs].join(':')}" unless file
|
|
22
|
+
content = File.read(file)
|
|
23
|
+
if file =~ /\.slim\Z/i
|
|
24
|
+
Thread.current[:slim_include_engine].call(content)
|
|
25
|
+
else
|
|
26
|
+
[:slim, :interpolate, content]
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
protected
|
|
31
|
+
|
|
32
|
+
def find_file(name)
|
|
33
|
+
current_dir = File.dirname(File.expand_path(options[:file]))
|
|
34
|
+
options[:include_dirs].map {|dir| File.expand_path(File.join(dir, name), current_dir) }.find {|file| File.file?(file) }
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class Engine
|
|
39
|
+
after Slim::Parser, Slim::Include
|
|
40
|
+
after Slim::Include, :stop do |exp|
|
|
41
|
+
throw :stop, exp if Thread.current[:slim_include_level] > 1
|
|
42
|
+
exp
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @api private
|
|
46
|
+
alias call_without_include call
|
|
47
|
+
|
|
48
|
+
# @api private
|
|
49
|
+
def call(input)
|
|
50
|
+
Thread.current[:slim_include_engine] = self
|
|
51
|
+
Thread.current[:slim_include_level] ||= 0
|
|
52
|
+
Thread.current[:slim_include_level] += 1
|
|
53
|
+
catch(:stop) { call_without_include(input) }
|
|
54
|
+
ensure
|
|
55
|
+
Thread.current[:slim_include_engine] = nil if (Thread.current[:slim_include_level] -= 1) == 0
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Slim
|
|
3
|
+
# Perform interpolation of #{var_name} in the
|
|
4
|
+
# expressions `[:slim, :interpolate, string]`.
|
|
5
|
+
#
|
|
6
|
+
# @api private
|
|
7
|
+
class Interpolation < Filter
|
|
8
|
+
# Handle interpolate expression `[:slim, :interpolate, string]`
|
|
9
|
+
#
|
|
10
|
+
# @param [String] string Static interpolate
|
|
11
|
+
# @return [Array] Compiled temple expression
|
|
12
|
+
def on_slim_interpolate(string)
|
|
13
|
+
# Interpolate variables in text (#{variable}).
|
|
14
|
+
# Split the text into multiple dynamic and static parts.
|
|
15
|
+
block = [:multi]
|
|
16
|
+
begin
|
|
17
|
+
case string
|
|
18
|
+
when /\A\\#\{/
|
|
19
|
+
# Escaped interpolation
|
|
20
|
+
block << [:static, '#{']
|
|
21
|
+
string = $'
|
|
22
|
+
when /\A#\{((?>[^{}]|(\{(?>[^{}]|\g<1>)*\}))*)\}/
|
|
23
|
+
# Interpolation
|
|
24
|
+
string, code = $', $1
|
|
25
|
+
escape = code !~ /\A\{.*\}\Z/
|
|
26
|
+
block << [:slim, :output, escape, escape ? code : code[1..-2], [:multi]]
|
|
27
|
+
when /\A([#\\]?[^#\\]*([#\\][^\\#\{][^#\\]*)*)/
|
|
28
|
+
# Static text
|
|
29
|
+
block << [:static, $&]
|
|
30
|
+
string = $'
|
|
31
|
+
end
|
|
32
|
+
end until string.empty?
|
|
33
|
+
block
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Slim
|
|
3
|
+
class LogicLess
|
|
4
|
+
# @api private
|
|
5
|
+
class Context
|
|
6
|
+
def initialize(dict, lookup)
|
|
7
|
+
@scope = [Scope.new(dict, lookup)]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def [](name)
|
|
11
|
+
scope[name]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def lambda(name)
|
|
15
|
+
scope.lambda(name) do |*dict|
|
|
16
|
+
if dict.empty?
|
|
17
|
+
yield
|
|
18
|
+
else
|
|
19
|
+
new_scope do
|
|
20
|
+
dict.inject(''.dup) do |result, d|
|
|
21
|
+
scope.dict = d
|
|
22
|
+
result << yield
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def section(name)
|
|
30
|
+
if dict = scope[name]
|
|
31
|
+
if !dict.respond_to?(:has_key?) && dict.respond_to?(:each)
|
|
32
|
+
new_scope do
|
|
33
|
+
dict.each do |d|
|
|
34
|
+
scope.dict = d
|
|
35
|
+
yield
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
else
|
|
39
|
+
new_scope(dict) { yield }
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def inverted_section(name)
|
|
45
|
+
value = scope[name]
|
|
46
|
+
yield if !value || (value.respond_to?(:empty?) && value.empty?)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def to_s
|
|
50
|
+
scope.to_s
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
class Scope
|
|
56
|
+
attr_reader :lookup
|
|
57
|
+
attr_writer :dict
|
|
58
|
+
|
|
59
|
+
def initialize(dict, lookup, parent = nil)
|
|
60
|
+
@dict, @lookup, @parent = dict, lookup, parent
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def lambda(name, &block)
|
|
64
|
+
@lookup.each do |lookup|
|
|
65
|
+
case lookup
|
|
66
|
+
when :method
|
|
67
|
+
return @dict.public_send(name, &block) if @dict.respond_to?(name, false)
|
|
68
|
+
when :symbol
|
|
69
|
+
return @dict[name].call(&block) if has_key?(name)
|
|
70
|
+
when :string
|
|
71
|
+
return @dict[name.to_s].call(&block) if has_key?(name.to_s)
|
|
72
|
+
when :instance_variable
|
|
73
|
+
var_name = "@#{name}"
|
|
74
|
+
return @dict.instance_variable_get(var_name).call(&block) if instance_variable?(var_name)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
@parent.lambda(name, &block) if @parent
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def [](name)
|
|
81
|
+
@lookup.each do |lookup|
|
|
82
|
+
case lookup
|
|
83
|
+
when :method
|
|
84
|
+
return @dict.public_send(name) if @dict.respond_to?(name, false)
|
|
85
|
+
when :symbol
|
|
86
|
+
return @dict[name] if has_key?(name)
|
|
87
|
+
when :string
|
|
88
|
+
return @dict[name.to_s] if has_key?(name.to_s)
|
|
89
|
+
when :instance_variable
|
|
90
|
+
var_name = "@#{name}"
|
|
91
|
+
return @dict.instance_variable_get(var_name) if instance_variable?(var_name)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
@parent[name] if @parent
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def to_s
|
|
98
|
+
@dict.to_s
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
private
|
|
102
|
+
|
|
103
|
+
def has_key?(name)
|
|
104
|
+
@dict.respond_to?(:has_key?) && @dict.has_key?(name)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def instance_variable?(name)
|
|
108
|
+
@dict.instance_variable_defined?(name)
|
|
109
|
+
rescue NameError
|
|
110
|
+
false
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def scope
|
|
115
|
+
@scope.last
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def new_scope(dict = nil)
|
|
119
|
+
@scope << Scope.new(dict, scope.lookup, scope)
|
|
120
|
+
yield
|
|
121
|
+
ensure
|
|
122
|
+
@scope.pop
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Slim
|
|
3
|
+
# Handle logic less mode
|
|
4
|
+
# This filter can be activated with the option "logic_less"
|
|
5
|
+
# @api private
|
|
6
|
+
class LogicLess < Filter
|
|
7
|
+
# Default dictionary access order, change it with the option :dictionary_access
|
|
8
|
+
DEFAULT_ACCESS_ORDER = [:symbol, :string, :method, :instance_variable].freeze
|
|
9
|
+
|
|
10
|
+
define_options logic_less: true,
|
|
11
|
+
dictionary: 'self',
|
|
12
|
+
dictionary_access: DEFAULT_ACCESS_ORDER
|
|
13
|
+
|
|
14
|
+
def initialize(opts = {})
|
|
15
|
+
super
|
|
16
|
+
access = [options[:dictionary_access]].flatten.compact
|
|
17
|
+
access.each do |type|
|
|
18
|
+
raise ArgumentError, "Invalid dictionary access #{type.inspect}" unless DEFAULT_ACCESS_ORDER.include?(type)
|
|
19
|
+
end
|
|
20
|
+
raise ArgumentError, 'Option dictionary access is missing' if access.empty?
|
|
21
|
+
@access = access.inspect
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def call(exp)
|
|
25
|
+
if options[:logic_less]
|
|
26
|
+
@context = unique_name
|
|
27
|
+
[:multi,
|
|
28
|
+
[:code, "#{@context} = ::Slim::LogicLess::Context.new(#{options[:dictionary]}, #{@access})"],
|
|
29
|
+
super]
|
|
30
|
+
else
|
|
31
|
+
exp
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Interpret control blocks as sections or inverted sections
|
|
36
|
+
def on_slim_control(name, content)
|
|
37
|
+
method =
|
|
38
|
+
if name =~ /\A!\s*(.*)/
|
|
39
|
+
name = $1
|
|
40
|
+
'inverted_section'
|
|
41
|
+
else
|
|
42
|
+
'section'
|
|
43
|
+
end
|
|
44
|
+
[:block, "#{@context}.#{method}(#{name.to_sym.inspect}) do", compile(content)]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def on_slim_output(escape, name, content)
|
|
48
|
+
[:slim, :output, escape, empty_exp?(content) ? access(name) :
|
|
49
|
+
"#{@context}.lambda(#{name.to_sym.inspect}) do", compile(content)]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def on_slim_attrvalue(escape, value)
|
|
53
|
+
[:slim, :attrvalue, escape, access(value)]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def on_slim_splat(code)
|
|
57
|
+
[:slim, :splat, access(code)]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def on_dynamic(code)
|
|
61
|
+
raise Temple::FilterError, 'Embedded code is forbidden in logic less mode'
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def on_code(code)
|
|
65
|
+
raise Temple::FilterError, 'Embedded code is forbidden in logic less mode'
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
private
|
|
69
|
+
|
|
70
|
+
def access(name)
|
|
71
|
+
case name
|
|
72
|
+
when 'yield'
|
|
73
|
+
'yield'
|
|
74
|
+
when 'self'
|
|
75
|
+
"#{@context}.to_s"
|
|
76
|
+
else
|
|
77
|
+
"#{@context}[#{name.to_sym.inspect}]"
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|