better_html 1.0.16 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -0
- data/Rakefile +19 -14
- data/ext/better_html_ext/better_html.h +1 -0
- data/ext/better_html_ext/extconf.rb +16 -0
- data/ext/better_html_ext/html_tokenizer.c +12 -0
- data/ext/better_html_ext/html_tokenizer.h +7 -0
- data/ext/better_html_ext/parser.c +793 -0
- data/ext/better_html_ext/parser.h +93 -0
- data/ext/better_html_ext/tokenizer.c +717 -0
- data/ext/better_html_ext/tokenizer.h +80 -0
- data/lib/better_html/ast/iterator.rb +14 -9
- data/lib/better_html/ast/node.rb +4 -2
- data/lib/better_html/better_erb/erubi_implementation.rb +43 -39
- data/lib/better_html/better_erb/runtime_checks.rb +140 -133
- data/lib/better_html/better_erb/validated_output_buffer.rb +30 -22
- data/lib/better_html/better_erb.rb +58 -54
- data/lib/better_html/config.rb +7 -4
- data/lib/better_html/errors.rb +4 -2
- data/lib/better_html/helpers.rb +7 -3
- data/lib/better_html/html_attributes.rb +6 -2
- data/lib/better_html/parser.rb +21 -14
- data/lib/better_html/railtie.rb +8 -4
- data/lib/better_html/test_helper/ruby_node.rb +15 -10
- data/lib/better_html/test_helper/safe_erb/allowed_script_type.rb +8 -4
- data/lib/better_html/test_helper/safe_erb/base.rb +12 -9
- data/lib/better_html/test_helper/safe_erb/no_javascript_tag_helper.rb +7 -3
- data/lib/better_html/test_helper/safe_erb/no_statements.rb +7 -3
- data/lib/better_html/test_helper/safe_erb/script_interpolation.rb +9 -4
- data/lib/better_html/test_helper/safe_erb/tag_interpolation.rb +23 -20
- data/lib/better_html/test_helper/safe_erb_tester.rb +33 -31
- data/lib/better_html/test_helper/safe_lodash_tester.rb +36 -35
- data/lib/better_html/test_helper/safety_error.rb +2 -0
- data/lib/better_html/tokenizer/base_erb.rb +14 -10
- data/lib/better_html/tokenizer/html_erb.rb +3 -2
- data/lib/better_html/tokenizer/html_lodash.rb +22 -14
- data/lib/better_html/tokenizer/javascript_erb.rb +3 -1
- data/lib/better_html/tokenizer/location.rb +17 -6
- data/lib/better_html/tokenizer/token.rb +2 -0
- data/lib/better_html/tokenizer/token_array.rb +8 -8
- data/lib/better_html/tree/attribute.rb +10 -6
- data/lib/better_html/tree/attributes_list.rb +9 -5
- data/lib/better_html/tree/tag.rb +10 -6
- data/lib/better_html/version.rb +3 -1
- data/lib/better_html.rb +19 -17
- data/lib/tasks/better_html_tasks.rake +1 -0
- metadata +39 -147
- data/lib/better_html/better_erb/erubis_implementation.rb +0 -44
- data/test/better_html/better_erb/implementation_test.rb +0 -406
- data/test/better_html/errors_test.rb +0 -13
- data/test/better_html/helpers_test.rb +0 -49
- data/test/better_html/parser_test.rb +0 -314
- data/test/better_html/test_helper/ruby_node_test.rb +0 -288
- data/test/better_html/test_helper/safe_erb/allowed_script_type_test.rb +0 -46
- data/test/better_html/test_helper/safe_erb/no_javascript_tag_helper_test.rb +0 -37
- data/test/better_html/test_helper/safe_erb/no_statements_test.rb +0 -129
- data/test/better_html/test_helper/safe_erb/script_interpolation_test.rb +0 -149
- data/test/better_html/test_helper/safe_erb/tag_interpolation_test.rb +0 -303
- data/test/better_html/test_helper/safe_lodash_tester_test.rb +0 -90
- data/test/better_html/tokenizer/html_erb_test.rb +0 -180
- data/test/better_html/tokenizer/html_lodash_test.rb +0 -98
- data/test/better_html/tokenizer/location_test.rb +0 -75
- data/test/better_html/tokenizer/token_array_test.rb +0 -146
- data/test/better_html/tokenizer/token_test.rb +0 -15
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -29
- data/test/dummy/config/application.rb +0 -26
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -41
- data/test/dummy/config/environments/production.rb +0 -79
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/assets.rb +0 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -56
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/config.ru +0 -4
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/test_helper.rb +0 -29
data/lib/better_html/tree/tag.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "better_html/tree/attributes_list"
|
4
|
+
require "better_html/ast/iterator"
|
3
5
|
|
4
6
|
module BetterHtml
|
5
7
|
module Tree
|
6
8
|
class Tag
|
7
9
|
attr_reader :node, :start_solidus, :name_node, :attributes_node, :end_solidus
|
8
10
|
|
11
|
+
class << self
|
12
|
+
def from_node(node)
|
13
|
+
new(node)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
9
17
|
def initialize(node)
|
10
18
|
@node = node
|
11
19
|
@start_solidus, @name_node, @attributes_node, @end_solidus = *node
|
12
20
|
end
|
13
21
|
|
14
|
-
def self.from_node(node)
|
15
|
-
new(node)
|
16
|
-
end
|
17
|
-
|
18
22
|
def loc
|
19
23
|
@node.loc
|
20
24
|
end
|
data/lib/better_html/version.rb
CHANGED
data/lib/better_html.rb
CHANGED
@@ -1,25 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/hash/keys"
|
4
|
+
require "active_support/core_ext/module/delegation"
|
5
|
+
require "active_support/core_ext/class/attribute_accessors"
|
4
6
|
|
5
7
|
module BetterHtml
|
6
|
-
|
7
|
-
|
8
|
-
end
|
8
|
+
class << self
|
9
|
+
attr_writer :config
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def config
|
12
|
+
@config ||= Config.new
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
def configure
|
16
|
+
yield config if block_given?
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
21
|
+
require "better_html/version"
|
22
|
+
require "better_html/config"
|
23
|
+
require "better_html/helpers"
|
24
|
+
require "better_html/errors"
|
25
|
+
require "better_html/html_attributes"
|
24
26
|
|
25
|
-
require
|
27
|
+
require "better_html/railtie" if defined?(Rails)
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francois Chagnon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: actionview
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '6.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '6.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: ast
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: erubi
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '4
|
61
|
+
version: '1.4'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '4
|
68
|
+
version: '1.4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: parser
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,50 +94,44 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: html_tokenizer
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 0.0.6
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.0.6
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: rake
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
103
|
+
version: '13'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
108
|
- - "~>"
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
110
|
+
version: '13'
|
125
111
|
description: Better HTML for Rails. Provides sane html helpers that make it easier
|
126
112
|
to do the right thing.
|
127
113
|
email:
|
128
|
-
-
|
114
|
+
- ruby@shopify.com
|
129
115
|
executables: []
|
130
|
-
extensions:
|
116
|
+
extensions:
|
117
|
+
- ext/better_html_ext/extconf.rb
|
131
118
|
extra_rdoc_files: []
|
132
119
|
files:
|
133
120
|
- MIT-LICENSE
|
134
121
|
- Rakefile
|
122
|
+
- ext/better_html_ext/better_html.h
|
123
|
+
- ext/better_html_ext/extconf.rb
|
124
|
+
- ext/better_html_ext/html_tokenizer.c
|
125
|
+
- ext/better_html_ext/html_tokenizer.h
|
126
|
+
- ext/better_html_ext/parser.c
|
127
|
+
- ext/better_html_ext/parser.h
|
128
|
+
- ext/better_html_ext/tokenizer.c
|
129
|
+
- ext/better_html_ext/tokenizer.h
|
135
130
|
- lib/better_html.rb
|
136
131
|
- lib/better_html/ast/iterator.rb
|
137
132
|
- lib/better_html/ast/node.rb
|
138
133
|
- lib/better_html/better_erb.rb
|
139
134
|
- lib/better_html/better_erb/erubi_implementation.rb
|
140
|
-
- lib/better_html/better_erb/erubis_implementation.rb
|
141
135
|
- lib/better_html/better_erb/runtime_checks.rb
|
142
136
|
- lib/better_html/better_erb/validated_output_buffer.rb
|
143
137
|
- lib/better_html/config.rb
|
@@ -168,64 +162,13 @@ files:
|
|
168
162
|
- lib/better_html/tree/tag.rb
|
169
163
|
- lib/better_html/version.rb
|
170
164
|
- lib/tasks/better_html_tasks.rake
|
171
|
-
- test/better_html/better_erb/implementation_test.rb
|
172
|
-
- test/better_html/errors_test.rb
|
173
|
-
- test/better_html/helpers_test.rb
|
174
|
-
- test/better_html/parser_test.rb
|
175
|
-
- test/better_html/test_helper/ruby_node_test.rb
|
176
|
-
- test/better_html/test_helper/safe_erb/allowed_script_type_test.rb
|
177
|
-
- test/better_html/test_helper/safe_erb/no_javascript_tag_helper_test.rb
|
178
|
-
- test/better_html/test_helper/safe_erb/no_statements_test.rb
|
179
|
-
- test/better_html/test_helper/safe_erb/script_interpolation_test.rb
|
180
|
-
- test/better_html/test_helper/safe_erb/tag_interpolation_test.rb
|
181
|
-
- test/better_html/test_helper/safe_lodash_tester_test.rb
|
182
|
-
- test/better_html/tokenizer/html_erb_test.rb
|
183
|
-
- test/better_html/tokenizer/html_lodash_test.rb
|
184
|
-
- test/better_html/tokenizer/location_test.rb
|
185
|
-
- test/better_html/tokenizer/token_array_test.rb
|
186
|
-
- test/better_html/tokenizer/token_test.rb
|
187
|
-
- test/dummy/README.rdoc
|
188
|
-
- test/dummy/Rakefile
|
189
|
-
- test/dummy/app/assets/javascripts/application.js
|
190
|
-
- test/dummy/app/assets/stylesheets/application.css
|
191
|
-
- test/dummy/app/controllers/application_controller.rb
|
192
|
-
- test/dummy/app/helpers/application_helper.rb
|
193
|
-
- test/dummy/app/views/layouts/application.html.erb
|
194
|
-
- test/dummy/bin/bundle
|
195
|
-
- test/dummy/bin/rails
|
196
|
-
- test/dummy/bin/rake
|
197
|
-
- test/dummy/bin/setup
|
198
|
-
- test/dummy/config.ru
|
199
|
-
- test/dummy/config/application.rb
|
200
|
-
- test/dummy/config/boot.rb
|
201
|
-
- test/dummy/config/database.yml
|
202
|
-
- test/dummy/config/environment.rb
|
203
|
-
- test/dummy/config/environments/development.rb
|
204
|
-
- test/dummy/config/environments/production.rb
|
205
|
-
- test/dummy/config/environments/test.rb
|
206
|
-
- test/dummy/config/initializers/assets.rb
|
207
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
208
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
209
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
210
|
-
- test/dummy/config/initializers/inflections.rb
|
211
|
-
- test/dummy/config/initializers/mime_types.rb
|
212
|
-
- test/dummy/config/initializers/session_store.rb
|
213
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
214
|
-
- test/dummy/config/locales/en.yml
|
215
|
-
- test/dummy/config/routes.rb
|
216
|
-
- test/dummy/config/secrets.yml
|
217
|
-
- test/dummy/public/404.html
|
218
|
-
- test/dummy/public/422.html
|
219
|
-
- test/dummy/public/500.html
|
220
|
-
- test/dummy/public/favicon.ico
|
221
|
-
- test/test_helper.rb
|
222
165
|
homepage: https://github.com/Shopify/better-html
|
223
166
|
licenses:
|
224
167
|
- MIT
|
225
168
|
metadata:
|
226
169
|
bug_tracker_uri: https://github.com/Shopify/better-html/issues
|
227
170
|
changelog_uri: https://github.com/Shopify/better-html/releases
|
228
|
-
source_code_uri: https://github.com/Shopify/better-html/tree/
|
171
|
+
source_code_uri: https://github.com/Shopify/better-html/tree/v2.0.0
|
229
172
|
allowed_push_host: https://rubygems.org
|
230
173
|
post_install_message:
|
231
174
|
rdoc_options: []
|
@@ -235,66 +178,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
235
178
|
requirements:
|
236
179
|
- - ">="
|
237
180
|
- !ruby/object:Gem::Version
|
238
|
-
version:
|
181
|
+
version: 2.7.0
|
239
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
183
|
requirements:
|
241
184
|
- - ">="
|
242
185
|
- !ruby/object:Gem::Version
|
243
186
|
version: '0'
|
244
187
|
requirements: []
|
245
|
-
rubygems_version: 3.
|
188
|
+
rubygems_version: 3.3.3
|
246
189
|
signing_key:
|
247
190
|
specification_version: 4
|
248
191
|
summary: Better HTML for Rails.
|
249
|
-
test_files:
|
250
|
-
- test/better_html/errors_test.rb
|
251
|
-
- test/better_html/test_helper/ruby_node_test.rb
|
252
|
-
- test/better_html/test_helper/safe_erb/allowed_script_type_test.rb
|
253
|
-
- test/better_html/test_helper/safe_erb/no_javascript_tag_helper_test.rb
|
254
|
-
- test/better_html/test_helper/safe_erb/script_interpolation_test.rb
|
255
|
-
- test/better_html/test_helper/safe_erb/tag_interpolation_test.rb
|
256
|
-
- test/better_html/test_helper/safe_erb/no_statements_test.rb
|
257
|
-
- test/better_html/test_helper/safe_lodash_tester_test.rb
|
258
|
-
- test/better_html/better_erb/implementation_test.rb
|
259
|
-
- test/better_html/tokenizer/location_test.rb
|
260
|
-
- test/better_html/tokenizer/token_test.rb
|
261
|
-
- test/better_html/tokenizer/token_array_test.rb
|
262
|
-
- test/better_html/tokenizer/html_lodash_test.rb
|
263
|
-
- test/better_html/tokenizer/html_erb_test.rb
|
264
|
-
- test/better_html/parser_test.rb
|
265
|
-
- test/better_html/helpers_test.rb
|
266
|
-
- test/test_helper.rb
|
267
|
-
- test/dummy/app/assets/stylesheets/application.css
|
268
|
-
- test/dummy/app/assets/javascripts/application.js
|
269
|
-
- test/dummy/app/controllers/application_controller.rb
|
270
|
-
- test/dummy/app/helpers/application_helper.rb
|
271
|
-
- test/dummy/app/views/layouts/application.html.erb
|
272
|
-
- test/dummy/config/secrets.yml
|
273
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
274
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
275
|
-
- test/dummy/config/initializers/mime_types.rb
|
276
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
277
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
278
|
-
- test/dummy/config/initializers/inflections.rb
|
279
|
-
- test/dummy/config/initializers/session_store.rb
|
280
|
-
- test/dummy/config/initializers/assets.rb
|
281
|
-
- test/dummy/config/routes.rb
|
282
|
-
- test/dummy/config/database.yml
|
283
|
-
- test/dummy/config/environment.rb
|
284
|
-
- test/dummy/config/locales/en.yml
|
285
|
-
- test/dummy/config/environments/development.rb
|
286
|
-
- test/dummy/config/environments/test.rb
|
287
|
-
- test/dummy/config/environments/production.rb
|
288
|
-
- test/dummy/config/boot.rb
|
289
|
-
- test/dummy/config/application.rb
|
290
|
-
- test/dummy/config.ru
|
291
|
-
- test/dummy/bin/rails
|
292
|
-
- test/dummy/bin/rake
|
293
|
-
- test/dummy/bin/setup
|
294
|
-
- test/dummy/bin/bundle
|
295
|
-
- test/dummy/Rakefile
|
296
|
-
- test/dummy/public/404.html
|
297
|
-
- test/dummy/public/422.html
|
298
|
-
- test/dummy/public/favicon.ico
|
299
|
-
- test/dummy/public/500.html
|
300
|
-
- test/dummy/README.rdoc
|
192
|
+
test_files: []
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'action_view'
|
2
|
-
require_relative 'runtime_checks'
|
3
|
-
|
4
|
-
class BetterHtml::BetterErb
|
5
|
-
class ErubisImplementation < ActionView::Template::Handlers::Erubis
|
6
|
-
include RuntimeChecks
|
7
|
-
|
8
|
-
def add_text(src, text)
|
9
|
-
return if text.empty?
|
10
|
-
|
11
|
-
if text == "\n"
|
12
|
-
@parser.parse("\n")
|
13
|
-
@newline_pending += 1
|
14
|
-
else
|
15
|
-
src << "@output_buffer.safe_append='"
|
16
|
-
src << "\n" * @newline_pending if @newline_pending > 0
|
17
|
-
src << escape_text(text)
|
18
|
-
src << "'.freeze;"
|
19
|
-
|
20
|
-
@parser.parse(text) do |*args|
|
21
|
-
check_token(*args)
|
22
|
-
end
|
23
|
-
|
24
|
-
@newline_pending = 0
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def add_expr_literal(src, code)
|
29
|
-
add_expr_auto_escaped(src, code, true)
|
30
|
-
end
|
31
|
-
|
32
|
-
def add_expr_escaped(src, code)
|
33
|
-
add_expr_auto_escaped(src, code, false)
|
34
|
-
end
|
35
|
-
|
36
|
-
def add_stmt(src, code)
|
37
|
-
flush_newline_if_pending(src)
|
38
|
-
|
39
|
-
block_check(src, "<%#{code}%>")
|
40
|
-
@parser.append_placeholder(code)
|
41
|
-
super
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|