phlex 1.3.3 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of phlex might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -24
- data/.ruby-version +1 -1
- data/Gemfile +1 -0
- data/README.md +1 -0
- data/fixtures/view_helper.rb +6 -0
- data/lib/phlex/black_hole.rb +7 -9
- data/lib/phlex/callable.rb +3 -5
- data/lib/phlex/deferred_render.rb +2 -4
- data/lib/phlex/elements.rb +56 -54
- data/lib/phlex/helpers.rb +5 -2
- data/lib/phlex/html/standard_elements.rb +2 -14
- data/lib/phlex/html/void_elements.rb +2 -0
- data/lib/phlex/html.rb +13 -286
- data/lib/{overrides → phlex/overrides}/symbol/name.rb +1 -1
- data/lib/phlex/sgml.rb +315 -0
- data/lib/phlex/svg/standard_elements.rb +391 -0
- data/lib/phlex/svg.rb +11 -0
- data/lib/phlex/testing/view_helper.rb +10 -12
- data/lib/phlex/unbuffered.rb +34 -36
- data/lib/phlex/version.rb +1 -1
- data/lib/phlex.rb +5 -1
- metadata +7 -5
- data/lib/phlex/buffered.rb +0 -19
data/lib/phlex/sgml.rb
ADDED
@@ -0,0 +1,315 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0")
|
4
|
+
using Phlex::Overrides::Symbol::Name
|
5
|
+
end
|
6
|
+
|
7
|
+
module Phlex
|
8
|
+
class SGML
|
9
|
+
class << self
|
10
|
+
# Render the view to a String. Arguments are delegated to <code>new</code>.
|
11
|
+
def call(...)
|
12
|
+
new(...).call
|
13
|
+
end
|
14
|
+
|
15
|
+
alias_method :render, :call
|
16
|
+
|
17
|
+
def new(*args, **kwargs, &block)
|
18
|
+
if block
|
19
|
+
object = super(*args, **kwargs, &nil)
|
20
|
+
object.instance_variable_set(:@_content_block, block)
|
21
|
+
object
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# @api private
|
28
|
+
def rendered_at_least_once!
|
29
|
+
alias_method :__attributes__, :__final_attributes__
|
30
|
+
alias_method :call, :__final_call__
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Renders the view and returns the buffer. The default buffer is a mutable String.
|
35
|
+
def call(buffer = +"", view_context: nil, parent: nil, &block)
|
36
|
+
__final_call__(buffer, view_context: view_context, parent: parent, &block).tap do
|
37
|
+
self.class.rendered_at_least_once!
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# @api private
|
42
|
+
def __final_call__(buffer = +"", view_context: nil, parent: nil, &block)
|
43
|
+
@_target = buffer
|
44
|
+
@_view_context = view_context
|
45
|
+
@_parent = parent
|
46
|
+
|
47
|
+
block ||= @_content_block
|
48
|
+
|
49
|
+
return buffer unless render?
|
50
|
+
|
51
|
+
around_template do
|
52
|
+
if block
|
53
|
+
if DeferredRender === self
|
54
|
+
__vanish__(self, &block)
|
55
|
+
template
|
56
|
+
else
|
57
|
+
template do |*args|
|
58
|
+
if args.length > 0
|
59
|
+
yield_content_with_args(*args, &block)
|
60
|
+
else
|
61
|
+
yield_content(&block)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
else
|
66
|
+
template
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
buffer
|
71
|
+
end
|
72
|
+
|
73
|
+
# Render another view
|
74
|
+
# @param renderable [Phlex::HTML] the other view to render
|
75
|
+
# @return [void]
|
76
|
+
def render(renderable, &block)
|
77
|
+
case renderable
|
78
|
+
when Phlex::SGML
|
79
|
+
renderable.call(@_target, view_context: @_view_context, parent: self, &block)
|
80
|
+
when Class
|
81
|
+
if renderable < Phlex::SGML
|
82
|
+
renderable.new.call(@_target, view_context: @_view_context, parent: self, &block)
|
83
|
+
end
|
84
|
+
else
|
85
|
+
raise ArgumentError, "You can't render a #{renderable}."
|
86
|
+
end
|
87
|
+
|
88
|
+
nil
|
89
|
+
end
|
90
|
+
|
91
|
+
# Output text content. The text will be HTML-escaped.
|
92
|
+
def text(content)
|
93
|
+
@_target << ERB::Util.html_escape(
|
94
|
+
case content
|
95
|
+
when String then content
|
96
|
+
when Symbol then content.name
|
97
|
+
when Integer then content.to_s
|
98
|
+
else format_object(content) || content.to_s
|
99
|
+
end
|
100
|
+
)
|
101
|
+
|
102
|
+
nil
|
103
|
+
end
|
104
|
+
|
105
|
+
# Output a whitespace character. This is useful for getting inline elements to wrap. If you pass a block, a whitespace will be output before and after yielding the block.
|
106
|
+
def whitespace
|
107
|
+
@_target << " "
|
108
|
+
|
109
|
+
if block_given?
|
110
|
+
yield
|
111
|
+
@_target << " "
|
112
|
+
end
|
113
|
+
|
114
|
+
nil
|
115
|
+
end
|
116
|
+
|
117
|
+
# Output an HTML comment.
|
118
|
+
def comment(&block)
|
119
|
+
@_target << "<!-- "
|
120
|
+
yield_content(&block)
|
121
|
+
@_target << " -->"
|
122
|
+
|
123
|
+
nil
|
124
|
+
end
|
125
|
+
|
126
|
+
# This method is very dangerous and should usually be avoided. It will output the given String without any HTML safety. You should never use this method to output unsafe user input.
|
127
|
+
# @param content [String|nil]
|
128
|
+
# @return [nil]
|
129
|
+
def unsafe_raw(content = nil)
|
130
|
+
return nil unless content
|
131
|
+
|
132
|
+
@_target << content
|
133
|
+
nil
|
134
|
+
end
|
135
|
+
|
136
|
+
# Capture a block of output as a String.
|
137
|
+
# @return [String]
|
138
|
+
def capture(&block)
|
139
|
+
return unless block_given?
|
140
|
+
|
141
|
+
original_buffer = @_target
|
142
|
+
new_buffer = +""
|
143
|
+
|
144
|
+
begin
|
145
|
+
@_target = new_buffer
|
146
|
+
yield_content(&block)
|
147
|
+
ensure
|
148
|
+
@_target = original_buffer
|
149
|
+
end
|
150
|
+
|
151
|
+
new_buffer
|
152
|
+
end
|
153
|
+
|
154
|
+
# Like `capture` but the output is vanished into a BlackHole buffer.
|
155
|
+
# Because the BlackHole does nothing with the output, this should be faster.
|
156
|
+
private def __vanish__(*args)
|
157
|
+
return unless block_given?
|
158
|
+
|
159
|
+
original_buffer = @_target
|
160
|
+
|
161
|
+
begin
|
162
|
+
@_target = BlackHole
|
163
|
+
yield(*args)
|
164
|
+
ensure
|
165
|
+
@_target = original_buffer
|
166
|
+
end
|
167
|
+
|
168
|
+
nil
|
169
|
+
end
|
170
|
+
|
171
|
+
# Default render predicate can be overridden to prevent rendering
|
172
|
+
private def render?
|
173
|
+
true
|
174
|
+
end
|
175
|
+
|
176
|
+
private def format_object(object)
|
177
|
+
case object
|
178
|
+
when Float
|
179
|
+
object.to_s
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Override this method to hook in around a template render. You can do things before and after calling <code>super</code> to render the template. You should always call <code>super</code> so that callbacks can be added at different layers of the inheritance tree.
|
184
|
+
private def around_template
|
185
|
+
before_template
|
186
|
+
yield
|
187
|
+
after_template
|
188
|
+
end
|
189
|
+
|
190
|
+
# Override this method to hook in right before a template is rendered. Please remember to call <code>super</code> so that callbacks can be added at different layers of the inheritance tree.
|
191
|
+
private def before_template
|
192
|
+
nil
|
193
|
+
end
|
194
|
+
|
195
|
+
# Override this method to hook in right after a template is rendered. Please remember to call <code>super</code> so that callbacks can be added at different layers of the inheritance tree.
|
196
|
+
private def after_template
|
197
|
+
nil
|
198
|
+
end
|
199
|
+
|
200
|
+
# Yields the block and checks if it buffered anything. If nothing was buffered, the return value is treated as text.
|
201
|
+
private def yield_content
|
202
|
+
return unless block_given?
|
203
|
+
|
204
|
+
original_length = @_target.length
|
205
|
+
content = yield(self)
|
206
|
+
unchanged = (original_length == @_target.length)
|
207
|
+
|
208
|
+
if unchanged
|
209
|
+
case content
|
210
|
+
when String
|
211
|
+
@_target << ERB::Util.html_escape(content)
|
212
|
+
when Symbol
|
213
|
+
@_target << ERB::Util.html_escape(content.name)
|
214
|
+
when Integer
|
215
|
+
@_target << ERB::Util.html_escape(content.to_s)
|
216
|
+
else
|
217
|
+
if (formatted_object = format_object(content))
|
218
|
+
@_target << ERB::Util.html_escape(formatted_object)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
nil
|
224
|
+
end
|
225
|
+
|
226
|
+
# Same as <code>yield_content</code> but accepts a splat of arguments to yield. This is slightly slower than <code>yield_content</code>, which is why it's defined as a different method because we don't always need arguments so we can usually use <code>yield_content</code> instead.
|
227
|
+
private def yield_content_with_args(*args)
|
228
|
+
return unless block_given?
|
229
|
+
|
230
|
+
original_length = @_target.length
|
231
|
+
content = yield(*args)
|
232
|
+
unchanged = (original_length == @_target.length)
|
233
|
+
|
234
|
+
if unchanged
|
235
|
+
case content
|
236
|
+
when String
|
237
|
+
@_target << ERB::Util.html_escape(content)
|
238
|
+
when Symbol
|
239
|
+
@_target << ERB::Util.html_escape(content.name)
|
240
|
+
when Integer, Float
|
241
|
+
@_target << ERB::Util.html_escape(content.to_s)
|
242
|
+
else
|
243
|
+
if (formatted_object = format_object(content))
|
244
|
+
@_target << ERB::Util.html_escape(formatted_object)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
nil
|
250
|
+
end
|
251
|
+
|
252
|
+
# @api private
|
253
|
+
private def __attributes__(**attributes)
|
254
|
+
__final_attributes__(**attributes).tap do |buffer|
|
255
|
+
Phlex::ATTRIBUTE_CACHE[attributes.hash] = buffer.freeze
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
# @api private
|
260
|
+
private def __final_attributes__(**attributes)
|
261
|
+
if attributes[:href]&.start_with?(/\s*javascript:/)
|
262
|
+
attributes.delete(:href)
|
263
|
+
end
|
264
|
+
|
265
|
+
if attributes["href"]&.start_with?(/\s*javascript:/)
|
266
|
+
attributes.delete("href")
|
267
|
+
end
|
268
|
+
|
269
|
+
buffer = +""
|
270
|
+
__build_attributes__(attributes, buffer: buffer)
|
271
|
+
|
272
|
+
buffer
|
273
|
+
end
|
274
|
+
|
275
|
+
# @api private
|
276
|
+
private def __build_attributes__(attributes, buffer:)
|
277
|
+
attributes.each do |k, v|
|
278
|
+
next unless v
|
279
|
+
|
280
|
+
name = case k
|
281
|
+
when String then k
|
282
|
+
when Symbol then k.name.tr("_", "-")
|
283
|
+
else k.to_s
|
284
|
+
end
|
285
|
+
|
286
|
+
# Detect unsafe attribute names. Attribute names are considered unsafe if they match an event attribute or include unsafe characters.
|
287
|
+
if HTML::EVENT_ATTRIBUTES[name] || name.match?(/[<>&"']/)
|
288
|
+
raise ArgumentError, "Unsafe attribute name detected: #{k}."
|
289
|
+
end
|
290
|
+
|
291
|
+
case v
|
292
|
+
when true
|
293
|
+
buffer << " " << name
|
294
|
+
when String
|
295
|
+
buffer << " " << name << '="' << ERB::Util.html_escape(v) << '"'
|
296
|
+
when Symbol
|
297
|
+
buffer << " " << name << '="' << ERB::Util.html_escape(v.name) << '"'
|
298
|
+
when Hash
|
299
|
+
__build_attributes__(
|
300
|
+
v.transform_keys { |subkey|
|
301
|
+
case subkey
|
302
|
+
when Symbol then"#{k}-#{subkey.name.tr('_', '-')}"
|
303
|
+
else "#{k}-#{subkey}"
|
304
|
+
end
|
305
|
+
}, buffer: buffer
|
306
|
+
)
|
307
|
+
else
|
308
|
+
buffer << " " << name << '="' << ERB::Util.html_escape(v.to_s) << '"'
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
buffer
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
@@ -0,0 +1,391 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Phlex::SVG::StandardElements
|
4
|
+
extend Phlex::Elements
|
5
|
+
|
6
|
+
REGISTERED_ELEMENTS = Concurrent::Map.new
|
7
|
+
|
8
|
+
# @!method a(**attributes, &content)
|
9
|
+
# Outputs an <code>a</code> tag
|
10
|
+
# @return [nil]
|
11
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/a
|
12
|
+
register_element :a, tag: "a"
|
13
|
+
|
14
|
+
# @!method animate(**attributes, &content)
|
15
|
+
# Outputs an <code>animate</code> tag
|
16
|
+
# @return [nil]
|
17
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/animate
|
18
|
+
register_element :animate, tag: "animate"
|
19
|
+
|
20
|
+
# @!method animateMotion(**attributes, &content)
|
21
|
+
# Outputs an <code>animateMotion</code> tag
|
22
|
+
# @return [nil]
|
23
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/animateMotion
|
24
|
+
register_element :animateMotion, tag: "animateMotion"
|
25
|
+
|
26
|
+
# @!method animateTransform(**attributes, &content)
|
27
|
+
# Outputs an <code>animateTransform</code> tag
|
28
|
+
# @return [nil]
|
29
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/animateTransform
|
30
|
+
register_element :animateTransform, tag: "animateTransform"
|
31
|
+
|
32
|
+
# @!method circle(**attributes, &content)
|
33
|
+
# Outputs an <code>circle</code> tag
|
34
|
+
# @return [nil]
|
35
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/circle
|
36
|
+
register_element :circle, tag: "circle"
|
37
|
+
|
38
|
+
# @!method clipPath(**attributes, &content)
|
39
|
+
# Outputs an <code>clipPath</code> tag
|
40
|
+
# @return [nil]
|
41
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/clipPath
|
42
|
+
register_element :clipPath, tag: "clipPath"
|
43
|
+
|
44
|
+
# @!method defs(**attributes, &content)
|
45
|
+
# Outputs an <code>defs</code> tag
|
46
|
+
# @return [nil]
|
47
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/defs
|
48
|
+
register_element :defs, tag: "defs"
|
49
|
+
|
50
|
+
# @!method desc(**attributes, &content)
|
51
|
+
# Outputs an <code>desc</code> tag
|
52
|
+
# @return [nil]
|
53
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/desc
|
54
|
+
register_element :desc, tag: "desc"
|
55
|
+
|
56
|
+
# @!method discard(**attributes, &content)
|
57
|
+
# Outputs an <code>discard</code> tag
|
58
|
+
# @return [nil]
|
59
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/discard
|
60
|
+
register_element :discard, tag: "discard"
|
61
|
+
|
62
|
+
# @!method ellipse(**attributes, &content)
|
63
|
+
# Outputs an <code>ellipse</code> tag
|
64
|
+
# @return [nil]
|
65
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/ellipse
|
66
|
+
register_element :ellipse, tag: "ellipse"
|
67
|
+
|
68
|
+
# @!method feBlend(**attributes, &content)
|
69
|
+
# Outputs an <code>feBlend</code> tag
|
70
|
+
# @return [nil]
|
71
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feBlend
|
72
|
+
register_element :feBlend, tag: "feBlend"
|
73
|
+
|
74
|
+
# @!method feColorMatrix(**attributes, &content)
|
75
|
+
# Outputs an <code>feColorMatrix</code> tag
|
76
|
+
# @return [nil]
|
77
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feColorMatrix
|
78
|
+
register_element :feColorMatrix, tag: "feColorMatrix"
|
79
|
+
|
80
|
+
# @!method feComponentTransfer(**attributes, &content)
|
81
|
+
# Outputs an <code>feComponentTransfer</code> tag
|
82
|
+
# @return [nil]
|
83
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feComponentTransfer
|
84
|
+
register_element :feComponentTransfer, tag: "feComponentTransfer"
|
85
|
+
|
86
|
+
# @!method feComposite(**attributes, &content)
|
87
|
+
# Outputs an <code>feComposite</code> tag
|
88
|
+
# @return [nil]
|
89
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feComposite
|
90
|
+
register_element :feComposite, tag: "feComposite"
|
91
|
+
|
92
|
+
# @!method feConvolveMatrix(**attributes, &content)
|
93
|
+
# Outputs an <code>feConvolveMatrix</code> tag
|
94
|
+
# @return [nil]
|
95
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feConvolveMatrix
|
96
|
+
register_element :feConvolveMatrix, tag: "feConvolveMatrix"
|
97
|
+
|
98
|
+
# @!method feDiffuseLighting(**attributes, &content)
|
99
|
+
# Outputs an <code>feDiffuseLighting</code> tag
|
100
|
+
# @return [nil]
|
101
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feDiffuseLighting
|
102
|
+
register_element :feDiffuseLighting, tag: "feDiffuseLighting"
|
103
|
+
|
104
|
+
# @!method feDisplacementMap(**attributes, &content)
|
105
|
+
# Outputs an <code>feDisplacementMap</code> tag
|
106
|
+
# @return [nil]
|
107
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feDisplacementMap
|
108
|
+
register_element :feDisplacementMap, tag: "feDisplacementMap"
|
109
|
+
|
110
|
+
# @!method feDistantLight(**attributes, &content)
|
111
|
+
# Outputs an <code>feDistantLight</code> tag
|
112
|
+
# @return [nil]
|
113
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feDistantLight
|
114
|
+
register_element :feDistantLight, tag: "feDistantLight"
|
115
|
+
|
116
|
+
# @!method feDropShadow(**attributes, &content)
|
117
|
+
# Outputs an <code>feDropShadow</code> tag
|
118
|
+
# @return [nil]
|
119
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feDropShadow
|
120
|
+
register_element :feDropShadow, tag: "feDropShadow"
|
121
|
+
|
122
|
+
# @!method feFlood(**attributes, &content)
|
123
|
+
# Outputs an <code>feFlood</code> tag
|
124
|
+
# @return [nil]
|
125
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feFlood
|
126
|
+
register_element :feFlood, tag: "feFlood"
|
127
|
+
|
128
|
+
# @!method feFuncA(**attributes, &content)
|
129
|
+
# Outputs an <code>feFuncA</code> tag
|
130
|
+
# @return [nil]
|
131
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feFuncA
|
132
|
+
register_element :feFuncA, tag: "feFuncA"
|
133
|
+
|
134
|
+
# @!method feFuncB(**attributes, &content)
|
135
|
+
# Outputs an <code>feFuncB</code> tag
|
136
|
+
# @return [nil]
|
137
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feFuncB
|
138
|
+
register_element :feFuncB, tag: "feFuncB"
|
139
|
+
|
140
|
+
# @!method feFuncG(**attributes, &content)
|
141
|
+
# Outputs an <code>feFuncG</code> tag
|
142
|
+
# @return [nil]
|
143
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feFuncG
|
144
|
+
register_element :feFuncG, tag: "feFuncG"
|
145
|
+
|
146
|
+
# @!method feFuncR(**attributes, &content)
|
147
|
+
# Outputs an <code>feFuncR</code> tag
|
148
|
+
# @return [nil]
|
149
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feFuncR
|
150
|
+
register_element :feFuncR, tag: "feFuncR"
|
151
|
+
|
152
|
+
# @!method feGaussianBlur(**attributes, &content)
|
153
|
+
# Outputs an <code>feGaussianBlur</code> tag
|
154
|
+
# @return [nil]
|
155
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feGaussianBlur
|
156
|
+
register_element :feGaussianBlur, tag: "feGaussianBlur"
|
157
|
+
|
158
|
+
# @!method feImage(**attributes, &content)
|
159
|
+
# Outputs an <code>feImage</code> tag
|
160
|
+
# @return [nil]
|
161
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feImage
|
162
|
+
register_element :feImage, tag: "feImage"
|
163
|
+
|
164
|
+
# @!method feMerge(**attributes, &content)
|
165
|
+
# Outputs an <code>feMerge</code> tag
|
166
|
+
# @return [nil]
|
167
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feMerge
|
168
|
+
register_element :feMerge, tag: "feMerge"
|
169
|
+
|
170
|
+
# @!method feMergeNode(**attributes, &content)
|
171
|
+
# Outputs an <code>feMergeNode</code> tag
|
172
|
+
# @return [nil]
|
173
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feMergeNode
|
174
|
+
register_element :feMergeNode, tag: "feMergeNode"
|
175
|
+
|
176
|
+
# @!method feMorphology(**attributes, &content)
|
177
|
+
# Outputs an <code>feMorphology</code> tag
|
178
|
+
# @return [nil]
|
179
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feMorphology
|
180
|
+
register_element :feMorphology, tag: "feMorphology"
|
181
|
+
|
182
|
+
# @!method feOffset(**attributes, &content)
|
183
|
+
# Outputs an <code>feOffset</code> tag
|
184
|
+
# @return [nil]
|
185
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feOffset
|
186
|
+
register_element :feOffset, tag: "feOffset"
|
187
|
+
|
188
|
+
# @!method fePointLight(**attributes, &content)
|
189
|
+
# Outputs an <code>fePointLight</code> tag
|
190
|
+
# @return [nil]
|
191
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/fePointLight
|
192
|
+
register_element :fePointLight, tag: "fePointLight"
|
193
|
+
|
194
|
+
# @!method feSpecularLighting(**attributes, &content)
|
195
|
+
# Outputs an <code>feSpecularLighting</code> tag
|
196
|
+
# @return [nil]
|
197
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feSpecularLighting
|
198
|
+
register_element :feSpecularLighting, tag: "feSpecularLighting"
|
199
|
+
|
200
|
+
# @!method feSpotLight(**attributes, &content)
|
201
|
+
# Outputs an <code>feSpotLight</code> tag
|
202
|
+
# @return [nil]
|
203
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feSpotLight
|
204
|
+
register_element :feSpotLight, tag: "feSpotLight"
|
205
|
+
|
206
|
+
# @!method feTile(**attributes, &content)
|
207
|
+
# Outputs an <code>feTile</code> tag
|
208
|
+
# @return [nil]
|
209
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feTile
|
210
|
+
register_element :feTile, tag: "feTile"
|
211
|
+
|
212
|
+
# @!method feTurbulence(**attributes, &content)
|
213
|
+
# Outputs an <code>feTurbulence</code> tag
|
214
|
+
# @return [nil]
|
215
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/feTurbulence
|
216
|
+
register_element :feTurbulence, tag: "feTurbulence"
|
217
|
+
|
218
|
+
# @!method filter(**attributes, &content)
|
219
|
+
# Outputs an <code>filter</code> tag
|
220
|
+
# @return [nil]
|
221
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/filter
|
222
|
+
register_element :filter, tag: "filter"
|
223
|
+
|
224
|
+
# @!method foreignObject(**attributes, &content)
|
225
|
+
# Outputs an <code>foreignObject</code> tag
|
226
|
+
# @return [nil]
|
227
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/foreignObject
|
228
|
+
register_element :foreignObject, tag: "foreignObject"
|
229
|
+
|
230
|
+
# @!method g(**attributes, &content)
|
231
|
+
# Outputs an <code>g</code> tag
|
232
|
+
# @return [nil]
|
233
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/g
|
234
|
+
register_element :g, tag: "g"
|
235
|
+
|
236
|
+
# @!method image(**attributes, &content)
|
237
|
+
# Outputs an <code>image</code> tag
|
238
|
+
# @return [nil]
|
239
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/image
|
240
|
+
register_element :image, tag: "image"
|
241
|
+
|
242
|
+
# @!method line(**attributes, &content)
|
243
|
+
# Outputs an <code>line</code> tag
|
244
|
+
# @return [nil]
|
245
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/line
|
246
|
+
register_element :line, tag: "line"
|
247
|
+
|
248
|
+
# @!method linearGradient(**attributes, &content)
|
249
|
+
# Outputs an <code>linearGradient</code> tag
|
250
|
+
# @return [nil]
|
251
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/linearGradient
|
252
|
+
register_element :linearGradient, tag: "linearGradient"
|
253
|
+
|
254
|
+
# @!method marker(**attributes, &content)
|
255
|
+
# Outputs an <code>marker</code> tag
|
256
|
+
# @return [nil]
|
257
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/marker
|
258
|
+
register_element :marker, tag: "marker"
|
259
|
+
|
260
|
+
# @!method mask(**attributes, &content)
|
261
|
+
# Outputs an <code>mask</code> tag
|
262
|
+
# @return [nil]
|
263
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/mask
|
264
|
+
register_element :mask, tag: "mask"
|
265
|
+
|
266
|
+
# @!method metadata(**attributes, &content)
|
267
|
+
# Outputs an <code>metadata</code> tag
|
268
|
+
# @return [nil]
|
269
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/metadata
|
270
|
+
register_element :metadata, tag: "metadata"
|
271
|
+
|
272
|
+
# @!method mpath(**attributes, &content)
|
273
|
+
# Outputs an <code>mpath</code> tag
|
274
|
+
# @return [nil]
|
275
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/mpath
|
276
|
+
register_element :mpath, tag: "mpath"
|
277
|
+
|
278
|
+
# @!method path(**attributes, &content)
|
279
|
+
# Outputs an <code>path</code> tag
|
280
|
+
# @return [nil]
|
281
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/path
|
282
|
+
register_element :path, tag: "path"
|
283
|
+
|
284
|
+
# @!method pattern(**attributes, &content)
|
285
|
+
# Outputs an <code>pattern</code> tag
|
286
|
+
# @return [nil]
|
287
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/pattern
|
288
|
+
register_element :pattern, tag: "pattern"
|
289
|
+
|
290
|
+
# @!method polygon(**attributes, &content)
|
291
|
+
# Outputs an <code>polygon</code> tag
|
292
|
+
# @return [nil]
|
293
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/polygon
|
294
|
+
register_element :polygon, tag: "polygon"
|
295
|
+
|
296
|
+
# @!method polyline(**attributes, &content)
|
297
|
+
# Outputs an <code>polyline</code> tag
|
298
|
+
# @return [nil]
|
299
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/polyline
|
300
|
+
register_element :polyline, tag: "polyline"
|
301
|
+
|
302
|
+
# @!method radialGradient(**attributes, &content)
|
303
|
+
# Outputs an <code>radialGradient</code> tag
|
304
|
+
# @return [nil]
|
305
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/radialGradient
|
306
|
+
register_element :radialGradient, tag: "radialGradient"
|
307
|
+
|
308
|
+
# @!method rect(**attributes, &content)
|
309
|
+
# Outputs an <code>rect</code> tag
|
310
|
+
# @return [nil]
|
311
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/rect
|
312
|
+
register_element :rect, tag: "rect"
|
313
|
+
|
314
|
+
# @!method script(**attributes, &content)
|
315
|
+
# Outputs an <code>script</code> tag
|
316
|
+
# @return [nil]
|
317
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/script
|
318
|
+
register_element :script, tag: "script"
|
319
|
+
|
320
|
+
# @!method set(**attributes, &content)
|
321
|
+
# Outputs an <code>set</code> tag
|
322
|
+
# @return [nil]
|
323
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/set
|
324
|
+
register_element :set, tag: "set"
|
325
|
+
|
326
|
+
# @!method stop(**attributes, &content)
|
327
|
+
# Outputs an <code>stop</code> tag
|
328
|
+
# @return [nil]
|
329
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/stop
|
330
|
+
register_element :stop, tag: "stop"
|
331
|
+
|
332
|
+
# @!method style(**attributes, &content)
|
333
|
+
# Outputs an <code>style</code> tag
|
334
|
+
# @return [nil]
|
335
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/style
|
336
|
+
register_element :style, tag: "style"
|
337
|
+
|
338
|
+
# @!method svg(**attributes, &content)
|
339
|
+
# Outputs an <code>svg</code> tag
|
340
|
+
# @return [nil]
|
341
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/svg
|
342
|
+
register_element :svg, tag: "svg"
|
343
|
+
|
344
|
+
# @!method switch(**attributes, &content)
|
345
|
+
# Outputs an <code>switch</code> tag
|
346
|
+
# @return [nil]
|
347
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/switch
|
348
|
+
register_element :switch, tag: "switch"
|
349
|
+
|
350
|
+
# @!method symbol(**attributes, &content)
|
351
|
+
# Outputs an <code>symbol</code> tag
|
352
|
+
# @return [nil]
|
353
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/symbol
|
354
|
+
register_element :symbol, tag: "symbol"
|
355
|
+
|
356
|
+
# @!method text(**attributes, &content)
|
357
|
+
# Outputs an <code>text</code> tag
|
358
|
+
# @return [nil]
|
359
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/text
|
360
|
+
register_element :text, tag: "text"
|
361
|
+
|
362
|
+
# @!method textPath(**attributes, &content)
|
363
|
+
# Outputs an <code>textPath</code> tag
|
364
|
+
# @return [nil]
|
365
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/textPath
|
366
|
+
register_element :textPath, tag: "textPath"
|
367
|
+
|
368
|
+
# @!method title(**attributes, &content)
|
369
|
+
# Outputs an <code>title</code> tag
|
370
|
+
# @return [nil]
|
371
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/title
|
372
|
+
register_element :title, tag: "title"
|
373
|
+
|
374
|
+
# @!method tspan(**attributes, &content)
|
375
|
+
# Outputs an <code>tspan</code> tag
|
376
|
+
# @return [nil]
|
377
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/tspan
|
378
|
+
register_element :tspan, tag: "tspan"
|
379
|
+
|
380
|
+
# @!method use(**attributes, &content)
|
381
|
+
# Outputs an <code>use</code> tag
|
382
|
+
# @return [nil]
|
383
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/use
|
384
|
+
register_element :use, tag: "use"
|
385
|
+
|
386
|
+
# @!method view(**attributes, &content)
|
387
|
+
# Outputs an <code>view</code> tag
|
388
|
+
# @return [nil]
|
389
|
+
# @see https://developer.mozilla.org/docs/Web/SVG/Element/view
|
390
|
+
register_element :view, tag: "view"
|
391
|
+
end
|