vigiles 0.1.0.pre.beta3 → 0.1.0.pre.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -1
- data/lib/vigiles/archive/extras.rb +4 -3
- data/lib/vigiles/archive/metadata.rb +3 -2
- data/lib/vigiles/archive/request.rb +18 -4
- data/lib/vigiles/archive.rb +15 -3
- data/lib/vigiles/constants.rb +7 -0
- data/lib/vigiles/middleware/record_conversation.rb +6 -22
- data/lib/vigiles/spec.rb +1 -1
- data/lib/vigiles/utilities/uri.rb +18 -0
- data/lib/vigiles/version.rb +2 -2
- data/lib/vigiles.rb +5 -1
- data/sorbet/rbi/gems/{activemodel@7.0.5.rbi → actioncable@7.1.3.3.rbi} +2 -2
- data/sorbet/rbi/gems/actionmailbox@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/{activerecord@7.0.5.rbi → actionmailer@7.1.3.3.rbi} +2 -2
- data/sorbet/rbi/gems/actionpack@7.1.3.3.rbi +20046 -0
- data/sorbet/rbi/gems/actiontext@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/actionview@7.1.3.3.rbi +15953 -0
- data/sorbet/rbi/gems/activejob@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/activemodel@7.1.3.3.rbi +6657 -0
- data/sorbet/rbi/gems/activerecord@7.1.3.3.rbi +41520 -0
- data/sorbet/rbi/gems/activestorage@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/activesupport@7.1.3.3.rbi +20570 -0
- data/sorbet/rbi/gems/base64@0.2.0.rbi +508 -0
- data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +77 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
- data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +8 -0
- data/sorbet/rbi/gems/crass@1.0.6.rbi +622 -0
- data/sorbet/rbi/gems/date@3.3.4.rbi +74 -0
- data/sorbet/rbi/gems/drb@2.2.1.rbi +1346 -0
- data/sorbet/rbi/gems/globalid@1.2.1.rbi +8 -0
- data/sorbet/rbi/gems/i18n@1.14.5.rbi +2358 -0
- data/sorbet/rbi/gems/io-console@0.7.2.rbi +8 -0
- data/sorbet/rbi/gems/loofah@2.22.0.rbi +1080 -0
- data/sorbet/rbi/gems/{i18n@1.14.1.rbi → mail@2.8.1.rbi} +2 -2
- data/sorbet/rbi/gems/marcel@1.0.4.rbi +8 -0
- data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +8 -0
- data/sorbet/rbi/gems/mutex_m@0.2.0.rbi +93 -0
- data/sorbet/rbi/gems/net-imap@0.4.11.rbi +8 -0
- data/sorbet/rbi/gems/net-pop@0.1.2.rbi +8 -0
- data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +291 -0
- data/sorbet/rbi/gems/net-smtp@0.5.0.rbi +8 -0
- data/sorbet/rbi/gems/nio4r@2.7.3.rbi +8 -0
- data/sorbet/rbi/gems/nokogiri@1.16.5.rbi +7310 -0
- data/sorbet/rbi/gems/psych@5.1.2.rbi +1768 -0
- data/sorbet/rbi/gems/rack-session@2.0.0.rbi +729 -0
- data/sorbet/rbi/gems/rack-test@2.1.0.rbi +749 -0
- data/sorbet/rbi/gems/rack@3.0.11.rbi +5195 -0
- data/sorbet/rbi/gems/rackup@2.1.0.rbi +406 -0
- data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +691 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.6.0.rbi +721 -0
- data/sorbet/rbi/gems/rails@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/railties@7.1.3.3.rbi +2167 -0
- data/sorbet/rbi/gems/rdoc@6.6.3.1.rbi +12715 -0
- data/sorbet/rbi/gems/reline@0.5.7.rbi +8 -0
- data/sorbet/rbi/gems/stringio@3.1.0.rbi +8 -0
- data/sorbet/rbi/gems/timeout@0.4.1.rbi +148 -0
- data/sorbet/rbi/gems/webrick@1.8.1.rbi +2606 -0
- data/sorbet/rbi/gems/websocket-driver@0.7.6.rbi +8 -0
- data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +8 -0
- data/sorbet/rbi/gems/zeitwerk@2.6.13.rbi +1003 -0
- data/vigiles.gemspec +1 -1
- metadata +54 -7
- data/sorbet/rbi/gems/activesupport@7.0.5.rbi +0 -14
@@ -0,0 +1,1080 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `loofah` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem loofah`.
|
6
|
+
|
7
|
+
# == Strings and IO Objects as Input
|
8
|
+
#
|
9
|
+
# The following methods accept any IO object in addition to accepting a string:
|
10
|
+
#
|
11
|
+
# - Loofah.html4_document
|
12
|
+
# - Loofah.html4_fragment
|
13
|
+
# - Loofah.scrub_html4_document
|
14
|
+
# - Loofah.scrub_html4_fragment
|
15
|
+
#
|
16
|
+
# - Loofah.html5_document
|
17
|
+
# - Loofah.html5_fragment
|
18
|
+
# - Loofah.scrub_html5_document
|
19
|
+
# - Loofah.scrub_html5_fragment
|
20
|
+
#
|
21
|
+
# - Loofah.xml_document
|
22
|
+
# - Loofah.xml_fragment
|
23
|
+
# - Loofah.scrub_xml_document
|
24
|
+
# - Loofah.scrub_xml_fragment
|
25
|
+
#
|
26
|
+
# - Loofah.document
|
27
|
+
# - Loofah.fragment
|
28
|
+
# - Loofah.scrub_document
|
29
|
+
# - Loofah.scrub_fragment
|
30
|
+
#
|
31
|
+
# That IO object could be a file, or a socket, or a StringIO, or anything that responds to +read+
|
32
|
+
# and +close+.
|
33
|
+
#
|
34
|
+
# source://loofah//lib/loofah.rb#5
|
35
|
+
module Loofah
|
36
|
+
class << self
|
37
|
+
# Shortcut for Loofah::HTML4::Document.parse(*args, &block)
|
38
|
+
#
|
39
|
+
# This method accepts the same parameters as Nokogiri::HTML4::Document.parse
|
40
|
+
#
|
41
|
+
# source://loofah//lib/loofah.rb#76
|
42
|
+
def document(*args, &block); end
|
43
|
+
|
44
|
+
# Shortcut for Loofah::HTML4::DocumentFragment.parse(*args, &block)
|
45
|
+
#
|
46
|
+
# This method accepts the same parameters as Nokogiri::HTML4::DocumentFragment.parse
|
47
|
+
#
|
48
|
+
# source://loofah//lib/loofah.rb#83
|
49
|
+
def fragment(*args, &block); end
|
50
|
+
|
51
|
+
# Shortcut for Loofah::HTML4::Document.parse(*args, &block)
|
52
|
+
#
|
53
|
+
# This method accepts the same parameters as Nokogiri::HTML4::Document.parse
|
54
|
+
#
|
55
|
+
# source://loofah//lib/loofah.rb#76
|
56
|
+
def html4_document(*args, &block); end
|
57
|
+
|
58
|
+
# Shortcut for Loofah::HTML4::DocumentFragment.parse(*args, &block)
|
59
|
+
#
|
60
|
+
# This method accepts the same parameters as Nokogiri::HTML4::DocumentFragment.parse
|
61
|
+
#
|
62
|
+
# source://loofah//lib/loofah.rb#83
|
63
|
+
def html4_fragment(*args, &block); end
|
64
|
+
|
65
|
+
# source://loofah//lib/loofah.rb#101
|
66
|
+
def html5_document(*args, &block); end
|
67
|
+
|
68
|
+
# source://loofah//lib/loofah.rb#108
|
69
|
+
def html5_fragment(*args, &block); end
|
70
|
+
|
71
|
+
# @return [Boolean]
|
72
|
+
#
|
73
|
+
# source://loofah//lib/loofah.rb#7
|
74
|
+
def html5_support?; end
|
75
|
+
|
76
|
+
# A helper to remove extraneous whitespace from text-ified HTML
|
77
|
+
#
|
78
|
+
# source://loofah//lib/loofah.rb#169
|
79
|
+
def remove_extraneous_whitespace(string); end
|
80
|
+
|
81
|
+
# Shortcut for Loofah::HTML4::Document.parse(string_or_io).scrub!(method)
|
82
|
+
#
|
83
|
+
# source://loofah//lib/loofah.rb#88
|
84
|
+
def scrub_document(string_or_io, method); end
|
85
|
+
|
86
|
+
# Shortcut for Loofah::HTML4::DocumentFragment.parse(string_or_io).scrub!(method)
|
87
|
+
#
|
88
|
+
# source://loofah//lib/loofah.rb#93
|
89
|
+
def scrub_fragment(string_or_io, method); end
|
90
|
+
|
91
|
+
# Shortcut for Loofah::HTML4::Document.parse(string_or_io).scrub!(method)
|
92
|
+
#
|
93
|
+
# source://loofah//lib/loofah.rb#88
|
94
|
+
def scrub_html4_document(string_or_io, method); end
|
95
|
+
|
96
|
+
# Shortcut for Loofah::HTML4::DocumentFragment.parse(string_or_io).scrub!(method)
|
97
|
+
#
|
98
|
+
# source://loofah//lib/loofah.rb#93
|
99
|
+
def scrub_html4_fragment(string_or_io, method); end
|
100
|
+
|
101
|
+
# source://loofah//lib/loofah.rb#113
|
102
|
+
def scrub_html5_document(string_or_io, method); end
|
103
|
+
|
104
|
+
# source://loofah//lib/loofah.rb#118
|
105
|
+
def scrub_html5_fragment(string_or_io, method); end
|
106
|
+
|
107
|
+
# Shortcut for Loofah.xml_document(string_or_io).scrub!(method)
|
108
|
+
#
|
109
|
+
# source://loofah//lib/loofah.rb#164
|
110
|
+
def scrub_xml_document(string_or_io, method); end
|
111
|
+
|
112
|
+
# Shortcut for Loofah.xml_fragment(string_or_io).scrub!(method)
|
113
|
+
#
|
114
|
+
# source://loofah//lib/loofah.rb#159
|
115
|
+
def scrub_xml_fragment(string_or_io, method); end
|
116
|
+
|
117
|
+
# Shortcut for Loofah::XML::Document.parse(*args, &block)
|
118
|
+
#
|
119
|
+
# This method accepts the same parameters as Nokogiri::XML::Document.parse
|
120
|
+
#
|
121
|
+
# source://loofah//lib/loofah.rb#147
|
122
|
+
def xml_document(*args, &block); end
|
123
|
+
|
124
|
+
# Shortcut for Loofah::XML::DocumentFragment.parse(*args, &block)
|
125
|
+
#
|
126
|
+
# This method accepts the same parameters as Nokogiri::XML::DocumentFragment.parse
|
127
|
+
#
|
128
|
+
# source://loofah//lib/loofah.rb#154
|
129
|
+
def xml_fragment(*args, &block); end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# source://loofah//lib/loofah/concerns.rb#125
|
134
|
+
module Loofah::DocumentDecorator
|
135
|
+
# source://loofah//lib/loofah/concerns.rb#126
|
136
|
+
def initialize(*args, &block); end
|
137
|
+
end
|
138
|
+
|
139
|
+
# source://loofah//lib/loofah/elements.rb#6
|
140
|
+
module Loofah::Elements; end
|
141
|
+
|
142
|
+
# source://loofah//lib/loofah/elements.rb#93
|
143
|
+
Loofah::Elements::BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
|
144
|
+
|
145
|
+
# Elements that aren't block but should generate a newline in #to_text
|
146
|
+
#
|
147
|
+
# source://loofah//lib/loofah/elements.rb#90
|
148
|
+
Loofah::Elements::INLINE_LINE_BREAK = T.let(T.unsafe(nil), Set)
|
149
|
+
|
150
|
+
# source://loofah//lib/loofah/elements.rb#94
|
151
|
+
Loofah::Elements::LINEBREAKERS = T.let(T.unsafe(nil), Set)
|
152
|
+
|
153
|
+
# The following elements may also be considered block-level
|
154
|
+
# elements since they may contain block-level elements
|
155
|
+
#
|
156
|
+
# source://loofah//lib/loofah/elements.rb#76
|
157
|
+
Loofah::Elements::LOOSE_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
|
158
|
+
|
159
|
+
# source://loofah//lib/loofah/elements.rb#92
|
160
|
+
Loofah::Elements::STRICT_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
|
161
|
+
|
162
|
+
# source://loofah//lib/loofah/elements.rb#7
|
163
|
+
Loofah::Elements::STRICT_BLOCK_LEVEL_HTML4 = T.let(T.unsafe(nil), Set)
|
164
|
+
|
165
|
+
# https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
|
166
|
+
#
|
167
|
+
# source://loofah//lib/loofah/elements.rb#35
|
168
|
+
Loofah::Elements::STRICT_BLOCK_LEVEL_HTML5 = T.let(T.unsafe(nil), Set)
|
169
|
+
|
170
|
+
# Alias for Loofah::HTML4
|
171
|
+
#
|
172
|
+
# source://loofah//lib/loofah.rb#70
|
173
|
+
Loofah::HTML = Loofah::HTML4
|
174
|
+
|
175
|
+
# source://loofah//lib/loofah/html4/document.rb#4
|
176
|
+
module Loofah::HTML4; end
|
177
|
+
|
178
|
+
# Subclass of Nokogiri::HTML4::Document.
|
179
|
+
#
|
180
|
+
# See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
|
181
|
+
#
|
182
|
+
# source://loofah//lib/loofah/html4/document.rb#10
|
183
|
+
class Loofah::HTML4::Document < ::Nokogiri::HTML4::Document
|
184
|
+
include ::Loofah::ScrubBehavior::Node
|
185
|
+
include ::Loofah::DocumentDecorator
|
186
|
+
include ::Loofah::TextBehavior
|
187
|
+
include ::Loofah::HtmlDocumentBehavior
|
188
|
+
extend ::Loofah::HtmlDocumentBehavior::ClassMethods
|
189
|
+
end
|
190
|
+
|
191
|
+
# Subclass of Nokogiri::HTML4::DocumentFragment.
|
192
|
+
#
|
193
|
+
# See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
|
194
|
+
#
|
195
|
+
# source://loofah//lib/loofah/html4/document_fragment.rb#10
|
196
|
+
class Loofah::HTML4::DocumentFragment < ::Nokogiri::HTML4::DocumentFragment
|
197
|
+
include ::Loofah::TextBehavior
|
198
|
+
include ::Loofah::HtmlFragmentBehavior
|
199
|
+
extend ::Loofah::HtmlFragmentBehavior::ClassMethods
|
200
|
+
end
|
201
|
+
|
202
|
+
# source://loofah//lib/loofah/html5/safelist.rb#6
|
203
|
+
module Loofah::HTML5; end
|
204
|
+
|
205
|
+
# Subclass of Nokogiri::HTML5::Document.
|
206
|
+
#
|
207
|
+
# See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
|
208
|
+
#
|
209
|
+
# source://loofah//lib/loofah/html5/document.rb#10
|
210
|
+
class Loofah::HTML5::Document < ::Nokogiri::HTML5::Document
|
211
|
+
include ::Loofah::ScrubBehavior::Node
|
212
|
+
include ::Loofah::DocumentDecorator
|
213
|
+
include ::Loofah::TextBehavior
|
214
|
+
include ::Loofah::HtmlDocumentBehavior
|
215
|
+
extend ::Loofah::HtmlDocumentBehavior::ClassMethods
|
216
|
+
end
|
217
|
+
|
218
|
+
# Subclass of Nokogiri::HTML5::DocumentFragment.
|
219
|
+
#
|
220
|
+
# See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
|
221
|
+
#
|
222
|
+
# source://loofah//lib/loofah/html5/document_fragment.rb#10
|
223
|
+
class Loofah::HTML5::DocumentFragment < ::Nokogiri::HTML5::DocumentFragment
|
224
|
+
include ::Loofah::TextBehavior
|
225
|
+
include ::Loofah::HtmlFragmentBehavior
|
226
|
+
extend ::Loofah::HtmlFragmentBehavior::ClassMethods
|
227
|
+
end
|
228
|
+
|
229
|
+
# source://loofah//lib/loofah/html5/safelist.rb#49
|
230
|
+
module Loofah::HTML5::SafeList; end
|
231
|
+
|
232
|
+
# source://loofah//lib/loofah/html5/safelist.rb#232
|
233
|
+
Loofah::HTML5::SafeList::ACCEPTABLE_ATTRIBUTES = T.let(T.unsafe(nil), Set)
|
234
|
+
|
235
|
+
# https://www.w3.org/TR/css-color-3/#html4
|
236
|
+
#
|
237
|
+
# source://loofah//lib/loofah/html5/safelist.rb#735
|
238
|
+
Loofah::HTML5::SafeList::ACCEPTABLE_CSS_COLORS = T.let(T.unsafe(nil), Set)
|
239
|
+
|
240
|
+
# https://www.w3.org/TR/css-color-3/#svg-color
|
241
|
+
#
|
242
|
+
# source://loofah//lib/loofah/html5/safelist.rb#755
|
243
|
+
Loofah::HTML5::SafeList::ACCEPTABLE_CSS_EXTENDED_COLORS = T.let(T.unsafe(nil), Set)
|
244
|
+
|
245
|
+
# see https://www.quackit.com/css/functions/
|
246
|
+
# omit `url` and `image` from that list
|
247
|
+
#
|
248
|
+
# source://loofah//lib/loofah/html5/safelist.rb#907
|
249
|
+
Loofah::HTML5::SafeList::ACCEPTABLE_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
|
250
|
+
|
251
|
+
# source://loofah//lib/loofah/html5/safelist.rb#696
|
252
|
+
Loofah::HTML5::SafeList::ACCEPTABLE_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
|
253
|
+
|
254
|
+
# source://loofah//lib/loofah/html5/safelist.rb#626
|
255
|
+
Loofah::HTML5::SafeList::ACCEPTABLE_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
|
256
|
+
|
257
|
+
# source://loofah//lib/loofah/html5/safelist.rb#50
|
258
|
+
Loofah::HTML5::SafeList::ACCEPTABLE_ELEMENTS = T.let(T.unsafe(nil), Set)
|
259
|
+
|
260
|
+
# source://loofah//lib/loofah/html5/safelist.rb#980
|
261
|
+
Loofah::HTML5::SafeList::ACCEPTABLE_PROTOCOLS = T.let(T.unsafe(nil), Set)
|
262
|
+
|
263
|
+
# source://loofah//lib/loofah/html5/safelist.rb#967
|
264
|
+
Loofah::HTML5::SafeList::ACCEPTABLE_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
|
265
|
+
|
266
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1011
|
267
|
+
Loofah::HTML5::SafeList::ACCEPTABLE_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
|
268
|
+
|
269
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1021
|
270
|
+
Loofah::HTML5::SafeList::ALLOWED_ATTRIBUTES = T.let(T.unsafe(nil), Set)
|
271
|
+
|
272
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1024
|
273
|
+
Loofah::HTML5::SafeList::ALLOWED_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
|
274
|
+
|
275
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1023
|
276
|
+
Loofah::HTML5::SafeList::ALLOWED_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
|
277
|
+
|
278
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1022
|
279
|
+
Loofah::HTML5::SafeList::ALLOWED_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
|
280
|
+
|
281
|
+
# subclasses may define their own versions of these constants
|
282
|
+
#
|
283
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1020
|
284
|
+
Loofah::HTML5::SafeList::ALLOWED_ELEMENTS = T.let(T.unsafe(nil), Set)
|
285
|
+
|
286
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1045
|
287
|
+
Loofah::HTML5::SafeList::ALLOWED_ELEMENTS_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
|
288
|
+
|
289
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1026
|
290
|
+
Loofah::HTML5::SafeList::ALLOWED_PROTOCOLS = T.let(T.unsafe(nil), Set)
|
291
|
+
|
292
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1025
|
293
|
+
Loofah::HTML5::SafeList::ALLOWED_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
|
294
|
+
|
295
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1027
|
296
|
+
Loofah::HTML5::SafeList::ALLOWED_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
|
297
|
+
|
298
|
+
# source://loofah//lib/loofah/html5/safelist.rb#526
|
299
|
+
Loofah::HTML5::SafeList::ARIA_ATTRIBUTES = T.let(T.unsafe(nil), Set)
|
300
|
+
|
301
|
+
# source://loofah//lib/loofah/html5/safelist.rb#582
|
302
|
+
Loofah::HTML5::SafeList::ATTR_VAL_IS_URI = T.let(T.unsafe(nil), Set)
|
303
|
+
|
304
|
+
# source://loofah//lib/loofah/html5/safelist.rb#315
|
305
|
+
Loofah::HTML5::SafeList::MATHML_ATTRIBUTES = T.let(T.unsafe(nil), Set)
|
306
|
+
|
307
|
+
# source://loofah//lib/loofah/html5/safelist.rb#147
|
308
|
+
Loofah::HTML5::SafeList::MATHML_ELEMENTS = T.let(T.unsafe(nil), Set)
|
309
|
+
|
310
|
+
# source://loofah//lib/loofah/html5/safelist.rb#978
|
311
|
+
Loofah::HTML5::SafeList::PROTOCOL_SEPARATOR = T.let(T.unsafe(nil), Regexp)
|
312
|
+
|
313
|
+
# source://loofah//lib/loofah/html5/safelist.rb#960
|
314
|
+
Loofah::HTML5::SafeList::SHORTHAND_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
|
315
|
+
|
316
|
+
# source://loofah//lib/loofah/html5/safelist.rb#608
|
317
|
+
Loofah::HTML5::SafeList::SVG_ALLOW_LOCAL_HREF = T.let(T.unsafe(nil), Set)
|
318
|
+
|
319
|
+
# source://loofah//lib/loofah/html5/safelist.rb#367
|
320
|
+
Loofah::HTML5::SafeList::SVG_ATTRIBUTES = T.let(T.unsafe(nil), Set)
|
321
|
+
|
322
|
+
# source://loofah//lib/loofah/html5/safelist.rb#594
|
323
|
+
Loofah::HTML5::SafeList::SVG_ATTR_VAL_ALLOWS_REF = T.let(T.unsafe(nil), Set)
|
324
|
+
|
325
|
+
# source://loofah//lib/loofah/html5/safelist.rb#183
|
326
|
+
Loofah::HTML5::SafeList::SVG_ELEMENTS = T.let(T.unsafe(nil), Set)
|
327
|
+
|
328
|
+
# additional tags we should consider safe since we have libxml2 fixing up our documents.
|
329
|
+
#
|
330
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1040
|
331
|
+
Loofah::HTML5::SafeList::TAGS_SAFE_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
|
332
|
+
|
333
|
+
# TODO: remove VOID_ELEMENTS in a future major release
|
334
|
+
# and put it in the tests (it is used only for testing, not for functional behavior)
|
335
|
+
#
|
336
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1031
|
337
|
+
Loofah::HTML5::SafeList::VOID_ELEMENTS = T.let(T.unsafe(nil), Set)
|
338
|
+
|
339
|
+
# source://loofah//lib/loofah/html5/scrub.rb#8
|
340
|
+
module Loofah::HTML5::Scrub
|
341
|
+
class << self
|
342
|
+
# @return [Boolean]
|
343
|
+
#
|
344
|
+
# source://loofah//lib/loofah/html5/scrub.rb#18
|
345
|
+
def allowed_element?(element_name); end
|
346
|
+
|
347
|
+
# source://loofah//lib/loofah/html5/scrub.rb#192
|
348
|
+
def cdata_escape(node); end
|
349
|
+
|
350
|
+
# @return [Boolean]
|
351
|
+
#
|
352
|
+
# source://loofah//lib/loofah/html5/scrub.rb#187
|
353
|
+
def cdata_needs_escaping?(node); end
|
354
|
+
|
355
|
+
# source://loofah//lib/loofah/html5/scrub.rb#207
|
356
|
+
def escape_tags(string); end
|
357
|
+
|
358
|
+
# libxml2 >= 2.9.2 fails to escape comments within some attributes.
|
359
|
+
#
|
360
|
+
# see comments about CVE-2018-8048 within the tests for more information
|
361
|
+
#
|
362
|
+
# source://loofah//lib/loofah/html5/scrub.rb#166
|
363
|
+
def force_correct_attribute_escaping!(node); end
|
364
|
+
|
365
|
+
# source://loofah//lib/loofah/html5/scrub.rb#123
|
366
|
+
def scrub_attribute_that_allows_local_ref(attr_node); end
|
367
|
+
|
368
|
+
# alternative implementation of the html5lib attribute scrubbing algorithm
|
369
|
+
#
|
370
|
+
# source://loofah//lib/loofah/html5/scrub.rb#23
|
371
|
+
def scrub_attributes(node); end
|
372
|
+
|
373
|
+
# source://loofah//lib/loofah/html5/scrub.rb#72
|
374
|
+
def scrub_css(style); end
|
375
|
+
|
376
|
+
# source://loofah//lib/loofah/html5/scrub.rb#67
|
377
|
+
def scrub_css_attribute(node); end
|
378
|
+
|
379
|
+
# source://loofah//lib/loofah/html5/scrub.rb#142
|
380
|
+
def scrub_uri_attribute(attr_node); end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
# source://loofah//lib/loofah/html5/scrub.rb#9
|
385
|
+
Loofah::HTML5::Scrub::CONTROL_CHARACTERS = T.let(T.unsafe(nil), Regexp)
|
386
|
+
|
387
|
+
# source://loofah//lib/loofah/html5/scrub.rb#11
|
388
|
+
Loofah::HTML5::Scrub::CRASS_SEMICOLON = T.let(T.unsafe(nil), Hash)
|
389
|
+
|
390
|
+
# source://loofah//lib/loofah/html5/scrub.rb#12
|
391
|
+
Loofah::HTML5::Scrub::CSS_IMPORTANT = T.let(T.unsafe(nil), String)
|
392
|
+
|
393
|
+
# source://loofah//lib/loofah/html5/scrub.rb#10
|
394
|
+
Loofah::HTML5::Scrub::CSS_KEYWORDISH = T.let(T.unsafe(nil), Regexp)
|
395
|
+
|
396
|
+
# source://loofah//lib/loofah/html5/scrub.rb#14
|
397
|
+
Loofah::HTML5::Scrub::CSS_PROPERTY_STRING_WITHOUT_EMBEDDED_QUOTES = T.let(T.unsafe(nil), Regexp)
|
398
|
+
|
399
|
+
# source://loofah//lib/loofah/html5/scrub.rb#13
|
400
|
+
Loofah::HTML5::Scrub::CSS_WHITESPACE = T.let(T.unsafe(nil), String)
|
401
|
+
|
402
|
+
# source://loofah//lib/loofah/html5/scrub.rb#15
|
403
|
+
Loofah::HTML5::Scrub::DATA_ATTRIBUTE_NAME = T.let(T.unsafe(nil), Regexp)
|
404
|
+
|
405
|
+
# source://loofah//lib/loofah/html5/safelist.rb#1048
|
406
|
+
Loofah::HTML5::WhiteList = Loofah::HTML5::SafeList
|
407
|
+
|
408
|
+
# source://loofah//lib/loofah/concerns.rb#133
|
409
|
+
module Loofah::HtmlDocumentBehavior
|
410
|
+
mixes_in_class_methods ::Loofah::HtmlDocumentBehavior::ClassMethods
|
411
|
+
|
412
|
+
# source://loofah//lib/loofah/concerns.rb#164
|
413
|
+
def serialize_root; end
|
414
|
+
|
415
|
+
class << self
|
416
|
+
# @private
|
417
|
+
#
|
418
|
+
# source://loofah//lib/loofah/concerns.rb#159
|
419
|
+
def included(base); end
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
# source://loofah//lib/loofah/concerns.rb#134
|
424
|
+
module Loofah::HtmlDocumentBehavior::ClassMethods
|
425
|
+
# source://loofah//lib/loofah/concerns.rb#135
|
426
|
+
def parse(*args, &block); end
|
427
|
+
|
428
|
+
private
|
429
|
+
|
430
|
+
# remove comments that exist outside of the HTML element.
|
431
|
+
#
|
432
|
+
# these comments are allowed by the HTML spec:
|
433
|
+
#
|
434
|
+
# https://www.w3.org/TR/html401/struct/global.html#h-7.1
|
435
|
+
#
|
436
|
+
# but are not scrubbed by Loofah because these nodes don't meet
|
437
|
+
# the contract that scrubbers expect of a node (e.g., it can be
|
438
|
+
# replaced, sibling and children nodes can be created).
|
439
|
+
#
|
440
|
+
# source://loofah//lib/loofah/concerns.rb#150
|
441
|
+
def remove_comments_before_html_element(doc); end
|
442
|
+
end
|
443
|
+
|
444
|
+
# source://loofah//lib/loofah/concerns.rb#169
|
445
|
+
module Loofah::HtmlFragmentBehavior
|
446
|
+
mixes_in_class_methods ::Loofah::HtmlFragmentBehavior::ClassMethods
|
447
|
+
|
448
|
+
# source://loofah//lib/loofah/concerns.rb#197
|
449
|
+
def serialize; end
|
450
|
+
|
451
|
+
# source://loofah//lib/loofah/concerns.rb#203
|
452
|
+
def serialize_root; end
|
453
|
+
|
454
|
+
# source://loofah//lib/loofah/concerns.rb#197
|
455
|
+
def to_s; end
|
456
|
+
|
457
|
+
class << self
|
458
|
+
# @private
|
459
|
+
#
|
460
|
+
# source://loofah//lib/loofah/concerns.rb#192
|
461
|
+
def included(base); end
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
# source://loofah//lib/loofah/concerns.rb#170
|
466
|
+
module Loofah::HtmlFragmentBehavior::ClassMethods
|
467
|
+
# source://loofah//lib/loofah/concerns.rb#180
|
468
|
+
def document_klass; end
|
469
|
+
|
470
|
+
# source://loofah//lib/loofah/concerns.rb#171
|
471
|
+
def parse(tags, encoding = T.unsafe(nil)); end
|
472
|
+
end
|
473
|
+
|
474
|
+
# constants related to working around unhelpful libxml2 behavior
|
475
|
+
#
|
476
|
+
# ಠ_ಠ
|
477
|
+
#
|
478
|
+
# source://loofah//lib/loofah/html5/libxml2_workarounds.rb#12
|
479
|
+
module Loofah::LibxmlWorkarounds; end
|
480
|
+
|
481
|
+
# these attributes and qualifying parent tags are determined by the code at:
|
482
|
+
#
|
483
|
+
# https://git.gnome.org/browse/libxml2/tree/HTMLtree.c?h=v2.9.2#n714
|
484
|
+
#
|
485
|
+
# see comments about CVE-2018-8048 within the tests for more information
|
486
|
+
#
|
487
|
+
# source://loofah//lib/loofah/html5/libxml2_workarounds.rb#20
|
488
|
+
Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES = T.let(T.unsafe(nil), Set)
|
489
|
+
|
490
|
+
# source://loofah//lib/loofah/html5/libxml2_workarounds.rb#26
|
491
|
+
Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES_QUALIFYING_TAG = T.let(T.unsafe(nil), Hash)
|
492
|
+
|
493
|
+
# source://loofah//lib/loofah/metahelpers.rb#4
|
494
|
+
module Loofah::MetaHelpers
|
495
|
+
class << self
|
496
|
+
# source://loofah//lib/loofah/metahelpers.rb#6
|
497
|
+
def add_downcased_set_members_to_all_set_constants(mojule); end
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
501
|
+
# Mixes +scrub!+ into Document, DocumentFragment, Node and NodeSet.
|
502
|
+
#
|
503
|
+
# Traverse the document or fragment, invoking the +scrubber+ on each node.
|
504
|
+
#
|
505
|
+
# +scrubber+ must either be one of the symbols representing the built-in scrubbers (see
|
506
|
+
# Scrubbers), or a Scrubber instance.
|
507
|
+
#
|
508
|
+
# span2div = Loofah::Scrubber.new do |node|
|
509
|
+
# node.name = "div" if node.name == "span"
|
510
|
+
# end
|
511
|
+
# Loofah.html5_fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
|
512
|
+
# # => "<div>foo</div><p>bar</p>"
|
513
|
+
#
|
514
|
+
# or
|
515
|
+
#
|
516
|
+
# unsafe_html = "ohai! <div>div is safe</div> <script>but script is not</script>"
|
517
|
+
# Loofah.html5_fragment(unsafe_html).scrub!(:strip).to_s
|
518
|
+
# # => "ohai! <div>div is safe</div> "
|
519
|
+
#
|
520
|
+
# Note that this method is called implicitly from the shortcuts Loofah.scrub_html5_fragment et
|
521
|
+
# al.
|
522
|
+
#
|
523
|
+
# Please see Scrubber for more information on implementation and traversal, and README.rdoc for
|
524
|
+
# more example usage.
|
525
|
+
#
|
526
|
+
# source://loofah//lib/loofah/concerns.rb#30
|
527
|
+
module Loofah::ScrubBehavior
|
528
|
+
class << self
|
529
|
+
# source://loofah//lib/loofah/concerns.rb#59
|
530
|
+
def resolve_scrubber(scrubber); end
|
531
|
+
end
|
532
|
+
end
|
533
|
+
|
534
|
+
# source://loofah//lib/loofah/concerns.rb#31
|
535
|
+
module Loofah::ScrubBehavior::Node
|
536
|
+
# source://loofah//lib/loofah/concerns.rb#32
|
537
|
+
def scrub!(scrubber); end
|
538
|
+
end
|
539
|
+
|
540
|
+
# source://loofah//lib/loofah/concerns.rb#51
|
541
|
+
module Loofah::ScrubBehavior::NodeSet
|
542
|
+
# source://loofah//lib/loofah/concerns.rb#52
|
543
|
+
def scrub!(scrubber); end
|
544
|
+
end
|
545
|
+
|
546
|
+
# A Scrubber wraps up a block (or method) that is run on an HTML node (element):
|
547
|
+
#
|
548
|
+
# # change all <span> tags to <div> tags
|
549
|
+
# span2div = Loofah::Scrubber.new do |node|
|
550
|
+
# node.name = "div" if node.name == "span"
|
551
|
+
# end
|
552
|
+
#
|
553
|
+
# Alternatively, this scrubber could have been implemented as:
|
554
|
+
#
|
555
|
+
# class Span2Div < Loofah::Scrubber
|
556
|
+
# def scrub(node)
|
557
|
+
# node.name = "div" if node.name == "span"
|
558
|
+
# end
|
559
|
+
# end
|
560
|
+
# span2div = Span2Div.new
|
561
|
+
#
|
562
|
+
# This can then be run on a document:
|
563
|
+
#
|
564
|
+
# Loofah.html5_fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
|
565
|
+
# # => "<div>foo</div><p>bar</p>"
|
566
|
+
#
|
567
|
+
# Scrubbers can be run on a document in either a top-down traversal (the
|
568
|
+
# default) or bottom-up. Top-down scrubbers can optionally return
|
569
|
+
# Scrubber::STOP to terminate the traversal of a subtree.
|
570
|
+
#
|
571
|
+
# source://loofah//lib/loofah/scrubber.rb#35
|
572
|
+
class Loofah::Scrubber
|
573
|
+
# Options may include
|
574
|
+
# :direction => :top_down (the default)
|
575
|
+
# or
|
576
|
+
# :direction => :bottom_up
|
577
|
+
#
|
578
|
+
# For top_down traversals, if the block returns
|
579
|
+
# Loofah::Scrubber::STOP, then the traversal will be terminated
|
580
|
+
# for the current node's subtree.
|
581
|
+
#
|
582
|
+
# Alternatively, a Scrubber may inherit from Loofah::Scrubber,
|
583
|
+
# and implement +scrub+, which is slightly faster than using a
|
584
|
+
# block.
|
585
|
+
#
|
586
|
+
# @return [Scrubber] a new instance of Scrubber
|
587
|
+
#
|
588
|
+
# source://loofah//lib/loofah/scrubber.rb#65
|
589
|
+
def initialize(options = T.unsafe(nil), &block); end
|
590
|
+
|
591
|
+
# If the attribute is not set, add it
|
592
|
+
# If the attribute is set, don't overwrite the existing value
|
593
|
+
#
|
594
|
+
# source://loofah//lib/loofah/scrubber.rb#96
|
595
|
+
def append_attribute(node, attribute, value); end
|
596
|
+
|
597
|
+
# When a scrubber is initialized, the optional block is saved as
|
598
|
+
# :block. Note that, if no block is passed, then the +scrub+
|
599
|
+
# method is assumed to have been implemented.
|
600
|
+
#
|
601
|
+
# source://loofah//lib/loofah/scrubber.rb#49
|
602
|
+
def block; end
|
603
|
+
|
604
|
+
# When a scrubber is initialized, the :direction may be specified
|
605
|
+
# as :top_down (the default) or :bottom_up.
|
606
|
+
#
|
607
|
+
# source://loofah//lib/loofah/scrubber.rb#44
|
608
|
+
def direction; end
|
609
|
+
|
610
|
+
# When +new+ is not passed a block, the class may implement
|
611
|
+
# +scrub+, which will be called for each document node.
|
612
|
+
#
|
613
|
+
# @raise [ScrubberNotFound]
|
614
|
+
#
|
615
|
+
# source://loofah//lib/loofah/scrubber.rb#88
|
616
|
+
def scrub(node); end
|
617
|
+
|
618
|
+
# Calling +traverse+ will cause the document to be traversed by
|
619
|
+
# either the lambda passed to the initializer or the +scrub+
|
620
|
+
# method, in the direction specified at +new+ time.
|
621
|
+
#
|
622
|
+
# source://loofah//lib/loofah/scrubber.rb#80
|
623
|
+
def traverse(node); end
|
624
|
+
|
625
|
+
private
|
626
|
+
|
627
|
+
# source://loofah//lib/loofah/scrubber.rb#105
|
628
|
+
def html5lib_sanitize(node); end
|
629
|
+
|
630
|
+
# source://loofah//lib/loofah/scrubber.rb#131
|
631
|
+
def traverse_conditionally_bottom_up(node); end
|
632
|
+
|
633
|
+
# source://loofah//lib/loofah/scrubber.rb#122
|
634
|
+
def traverse_conditionally_top_down(node); end
|
635
|
+
end
|
636
|
+
|
637
|
+
# Top-down Scrubbers may return CONTINUE to indicate that the subtree should be traversed.
|
638
|
+
#
|
639
|
+
# source://loofah//lib/loofah/scrubber.rb#37
|
640
|
+
Loofah::Scrubber::CONTINUE = T.let(T.unsafe(nil), Object)
|
641
|
+
|
642
|
+
# Top-down Scrubbers may return STOP to indicate that the subtree should not be traversed.
|
643
|
+
#
|
644
|
+
# source://loofah//lib/loofah/scrubber.rb#40
|
645
|
+
Loofah::Scrubber::STOP = T.let(T.unsafe(nil), Object)
|
646
|
+
|
647
|
+
# A RuntimeError raised when Loofah could not find an appropriate scrubber.
|
648
|
+
#
|
649
|
+
# source://loofah//lib/loofah/scrubber.rb#7
|
650
|
+
class Loofah::ScrubberNotFound < ::RuntimeError; end
|
651
|
+
|
652
|
+
# Loofah provides some built-in scrubbers for sanitizing with
|
653
|
+
# HTML5lib's safelist and for accomplishing some common
|
654
|
+
# transformation tasks.
|
655
|
+
#
|
656
|
+
#
|
657
|
+
# === Loofah::Scrubbers::Strip / scrub!(:strip)
|
658
|
+
#
|
659
|
+
# +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
|
660
|
+
#
|
661
|
+
# unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
|
662
|
+
# Loofah.html5_fragment(unsafe_html).scrub!(:strip)
|
663
|
+
# => "ohai! <div>div is safe</div> but foo is <b>not</b>"
|
664
|
+
#
|
665
|
+
#
|
666
|
+
# === Loofah::Scrubbers::Prune / scrub!(:prune)
|
667
|
+
#
|
668
|
+
# +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
|
669
|
+
#
|
670
|
+
# unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
|
671
|
+
# Loofah.html5_fragment(unsafe_html).scrub!(:prune)
|
672
|
+
# => "ohai! <div>div is safe</div> "
|
673
|
+
#
|
674
|
+
#
|
675
|
+
# === Loofah::Scrubbers::Escape / scrub!(:escape)
|
676
|
+
#
|
677
|
+
# +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
|
678
|
+
#
|
679
|
+
# unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
|
680
|
+
# Loofah.html5_fragment(unsafe_html).scrub!(:escape)
|
681
|
+
# => "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
|
682
|
+
#
|
683
|
+
#
|
684
|
+
# === Loofah::Scrubbers::Whitewash / scrub!(:whitewash)
|
685
|
+
#
|
686
|
+
# +:whitewash+ removes all comments, styling and attributes in
|
687
|
+
# addition to doing markup-fixer-uppery and pruning unsafe tags. I
|
688
|
+
# like to call this "whitewashing", since it's like putting a new
|
689
|
+
# layer of paint on top of the HTML input to make it look nice.
|
690
|
+
#
|
691
|
+
# messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
|
692
|
+
# Loofah.html5_fragment(messy_markup).scrub!(:whitewash)
|
693
|
+
# => "ohai! <div>div with attributes</div>"
|
694
|
+
#
|
695
|
+
# One use case for this scrubber is to clean up HTML that was
|
696
|
+
# cut-and-pasted from Microsoft Word into a WYSIWYG editor or a
|
697
|
+
# rich text editor. Microsoft's software is famous for injecting
|
698
|
+
# all kinds of cruft into its HTML output. Who needs that crap?
|
699
|
+
# Certainly not me.
|
700
|
+
#
|
701
|
+
#
|
702
|
+
# === Loofah::Scrubbers::NoFollow / scrub!(:nofollow)
|
703
|
+
#
|
704
|
+
# +:nofollow+ adds a rel="nofollow" attribute to all links
|
705
|
+
#
|
706
|
+
# link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
|
707
|
+
# Loofah.html5_fragment(link_farmers_markup).scrub!(:nofollow)
|
708
|
+
# => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
|
709
|
+
#
|
710
|
+
#
|
711
|
+
# === Loofah::Scrubbers::TargetBlank / scrub!(:targetblank)
|
712
|
+
#
|
713
|
+
# +:targetblank+ adds a target="_blank" attribute to all links
|
714
|
+
#
|
715
|
+
# link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
|
716
|
+
# Loofah.html5_fragment(link_farmers_markup).scrub!(:targetblank)
|
717
|
+
# => "ohai! <a href='http://www.myswarmysite.com/' target="_blank">I like your blog post</a>"
|
718
|
+
#
|
719
|
+
#
|
720
|
+
# === Loofah::Scrubbers::NoOpener / scrub!(:noopener)
|
721
|
+
#
|
722
|
+
# +:noopener+ adds a rel="noopener" attribute to all links
|
723
|
+
#
|
724
|
+
# link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
|
725
|
+
# Loofah.html5_fragment(link_farmers_markup).scrub!(:noopener)
|
726
|
+
# => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
|
727
|
+
#
|
728
|
+
# === Loofah::Scrubbers::NoReferrer / scrub!(:noreferrer)
|
729
|
+
#
|
730
|
+
# +:noreferrer+ adds a rel="noreferrer" attribute to all links
|
731
|
+
#
|
732
|
+
# link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
|
733
|
+
# Loofah.html5_fragment(link_farmers_markup).scrub!(:noreferrer)
|
734
|
+
# => "ohai! <a href='http://www.myswarmysite.com/' rel="noreferrer">I like your blog post</a>"
|
735
|
+
#
|
736
|
+
#
|
737
|
+
# === Loofah::Scrubbers::Unprintable / scrub!(:unprintable)
|
738
|
+
#
|
739
|
+
# +:unprintable+ removes unprintable Unicode characters.
|
740
|
+
#
|
741
|
+
# markup = "<p>Some text with an unprintable character at the end\u2028</p>"
|
742
|
+
# Loofah.html5_fragment(markup).scrub!(:unprintable)
|
743
|
+
# => "<p>Some text with an unprintable character at the end</p>"
|
744
|
+
#
|
745
|
+
# You may not be able to see the unprintable character in the above example, but there is a
|
746
|
+
# U+2028 character right before the closing </p> tag. These characters can cause issues if
|
747
|
+
# the content is ever parsed by JavaScript - more information here:
|
748
|
+
#
|
749
|
+
# http://timelessrepo.com/json-isnt-a-javascript-subset
|
750
|
+
#
|
751
|
+
# source://loofah//lib/loofah/scrubbers.rb#104
|
752
|
+
module Loofah::Scrubbers
|
753
|
+
class << self
|
754
|
+
# Returns an array of symbols representing the built-in scrubbers
|
755
|
+
#
|
756
|
+
# source://loofah//lib/loofah/scrubbers.rb#371
|
757
|
+
def scrubber_symbols; end
|
758
|
+
end
|
759
|
+
end
|
760
|
+
|
761
|
+
# === scrub!(:escape)
|
762
|
+
#
|
763
|
+
# +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
|
764
|
+
#
|
765
|
+
# unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
|
766
|
+
# Loofah.html5_fragment(unsafe_html).scrub!(:escape)
|
767
|
+
# => "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
|
768
|
+
#
|
769
|
+
# source://loofah//lib/loofah/scrubbers.rb#159
|
770
|
+
class Loofah::Scrubbers::Escape < ::Loofah::Scrubber
|
771
|
+
# @return [Escape] a new instance of Escape
|
772
|
+
#
|
773
|
+
# source://loofah//lib/loofah/scrubbers.rb#160
|
774
|
+
def initialize; end
|
775
|
+
|
776
|
+
# source://loofah//lib/loofah/scrubbers.rb#164
|
777
|
+
def scrub(node); end
|
778
|
+
end
|
779
|
+
|
780
|
+
# A hash that maps a symbol (like +:prune+) to the appropriate Scrubber (Loofah::Scrubbers::Prune).
|
781
|
+
#
|
782
|
+
# source://loofah//lib/loofah/scrubbers.rb#354
|
783
|
+
Loofah::Scrubbers::MAP = T.let(T.unsafe(nil), Hash)
|
784
|
+
|
785
|
+
# This class probably isn't useful publicly, but is used for #to_text's current implemention
|
786
|
+
#
|
787
|
+
# source://loofah//lib/loofah/scrubbers.rb#305
|
788
|
+
class Loofah::Scrubbers::NewlineBlockElements < ::Loofah::Scrubber
|
789
|
+
# @return [NewlineBlockElements] a new instance of NewlineBlockElements
|
790
|
+
#
|
791
|
+
# source://loofah//lib/loofah/scrubbers.rb#306
|
792
|
+
def initialize; end
|
793
|
+
|
794
|
+
# source://loofah//lib/loofah/scrubbers.rb#310
|
795
|
+
def scrub(node); end
|
796
|
+
end
|
797
|
+
|
798
|
+
# === scrub!(:nofollow)
|
799
|
+
#
|
800
|
+
# +:nofollow+ adds a rel="nofollow" attribute to all links
|
801
|
+
#
|
802
|
+
# link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
|
803
|
+
# Loofah.html5_fragment(link_farmers_markup).scrub!(:nofollow)
|
804
|
+
# => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
|
805
|
+
#
|
806
|
+
# source://loofah//lib/loofah/scrubbers.rb#220
|
807
|
+
class Loofah::Scrubbers::NoFollow < ::Loofah::Scrubber
|
808
|
+
# @return [NoFollow] a new instance of NoFollow
|
809
|
+
#
|
810
|
+
# source://loofah//lib/loofah/scrubbers.rb#221
|
811
|
+
def initialize; end
|
812
|
+
|
813
|
+
# source://loofah//lib/loofah/scrubbers.rb#225
|
814
|
+
def scrub(node); end
|
815
|
+
end
|
816
|
+
|
817
|
+
# === scrub!(:noopener)
|
818
|
+
#
|
819
|
+
# +:noopener+ adds a rel="noopener" attribute to all links
|
820
|
+
#
|
821
|
+
# link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
|
822
|
+
# Loofah.html5_fragment(link_farmers_markup).scrub!(:noopener)
|
823
|
+
# => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
|
824
|
+
#
|
825
|
+
# source://loofah//lib/loofah/scrubbers.rb#269
|
826
|
+
class Loofah::Scrubbers::NoOpener < ::Loofah::Scrubber
|
827
|
+
# @return [NoOpener] a new instance of NoOpener
|
828
|
+
#
|
829
|
+
# source://loofah//lib/loofah/scrubbers.rb#270
|
830
|
+
def initialize; end
|
831
|
+
|
832
|
+
# source://loofah//lib/loofah/scrubbers.rb#274
|
833
|
+
def scrub(node); end
|
834
|
+
end
|
835
|
+
|
836
|
+
# === scrub!(:noreferrer)
|
837
|
+
#
|
838
|
+
# +:noreferrer+ adds a rel="noreferrer" attribute to all links
|
839
|
+
#
|
840
|
+
# link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
|
841
|
+
# Loofah.html5_fragment(link_farmers_markup).scrub!(:noreferrer)
|
842
|
+
# => "ohai! <a href='http://www.myswarmysite.com/' rel="noreferrer">I like your blog post</a>"
|
843
|
+
#
|
844
|
+
# source://loofah//lib/loofah/scrubbers.rb#291
|
845
|
+
class Loofah::Scrubbers::NoReferrer < ::Loofah::Scrubber
|
846
|
+
# @return [NoReferrer] a new instance of NoReferrer
|
847
|
+
#
|
848
|
+
# source://loofah//lib/loofah/scrubbers.rb#292
|
849
|
+
def initialize; end
|
850
|
+
|
851
|
+
# source://loofah//lib/loofah/scrubbers.rb#296
|
852
|
+
def scrub(node); end
|
853
|
+
end
|
854
|
+
|
855
|
+
# === scrub!(:prune)
|
856
|
+
#
|
857
|
+
# +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
|
858
|
+
#
|
859
|
+
# unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
|
860
|
+
# Loofah.html5_fragment(unsafe_html).scrub!(:prune)
|
861
|
+
# => "ohai! <div>div is safe</div> "
|
862
|
+
#
|
863
|
+
# source://loofah//lib/loofah/scrubbers.rb#137
|
864
|
+
class Loofah::Scrubbers::Prune < ::Loofah::Scrubber
|
865
|
+
# @return [Prune] a new instance of Prune
|
866
|
+
#
|
867
|
+
# source://loofah//lib/loofah/scrubbers.rb#138
|
868
|
+
def initialize; end
|
869
|
+
|
870
|
+
# source://loofah//lib/loofah/scrubbers.rb#142
|
871
|
+
def scrub(node); end
|
872
|
+
end
|
873
|
+
|
874
|
+
# === scrub!(:strip)
|
875
|
+
#
|
876
|
+
# +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
|
877
|
+
#
|
878
|
+
# unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
|
879
|
+
# Loofah.html5_fragment(unsafe_html).scrub!(:strip)
|
880
|
+
# => "ohai! <div>div is safe</div> but foo is <b>not</b>"
|
881
|
+
#
|
882
|
+
# source://loofah//lib/loofah/scrubbers.rb#114
|
883
|
+
class Loofah::Scrubbers::Strip < ::Loofah::Scrubber
|
884
|
+
# @return [Strip] a new instance of Strip
|
885
|
+
#
|
886
|
+
# source://loofah//lib/loofah/scrubbers.rb#115
|
887
|
+
def initialize; end
|
888
|
+
|
889
|
+
# source://loofah//lib/loofah/scrubbers.rb#119
|
890
|
+
def scrub(node); end
|
891
|
+
end
|
892
|
+
|
893
|
+
# === scrub!(:targetblank)
|
894
|
+
#
|
895
|
+
# +:targetblank+ adds a target="_blank" attribute to all links.
|
896
|
+
# If there is a target already set, replaces it with target="_blank".
|
897
|
+
#
|
898
|
+
# link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
|
899
|
+
# Loofah.html5_fragment(link_farmers_markup).scrub!(:targetblank)
|
900
|
+
# => "ohai! <a href='http://www.myswarmysite.com/' target="_blank">I like your blog post</a>"
|
901
|
+
#
|
902
|
+
# On modern browsers, setting target="_blank" on anchor elements implicitly provides the same
|
903
|
+
# behavior as setting rel="noopener".
|
904
|
+
#
|
905
|
+
# source://loofah//lib/loofah/scrubbers.rb#246
|
906
|
+
class Loofah::Scrubbers::TargetBlank < ::Loofah::Scrubber
|
907
|
+
# @return [TargetBlank] a new instance of TargetBlank
|
908
|
+
#
|
909
|
+
# source://loofah//lib/loofah/scrubbers.rb#247
|
910
|
+
def initialize; end
|
911
|
+
|
912
|
+
# source://loofah//lib/loofah/scrubbers.rb#251
|
913
|
+
def scrub(node); end
|
914
|
+
end
|
915
|
+
|
916
|
+
# === scrub!(:unprintable)
|
917
|
+
#
|
918
|
+
# +:unprintable+ removes unprintable Unicode characters.
|
919
|
+
#
|
920
|
+
# markup = "<p>Some text with an unprintable character at the end\u2028</p>"
|
921
|
+
# Loofah.html5_fragment(markup).scrub!(:unprintable)
|
922
|
+
# => "<p>Some text with an unprintable character at the end</p>"
|
923
|
+
#
|
924
|
+
# You may not be able to see the unprintable character in the above example, but there is a
|
925
|
+
# U+2028 character right before the closing </p> tag. These characters can cause issues if
|
926
|
+
# the content is ever parsed by JavaScript - more information here:
|
927
|
+
#
|
928
|
+
# http://timelessrepo.com/json-isnt-a-javascript-subset
|
929
|
+
#
|
930
|
+
# source://loofah//lib/loofah/scrubbers.rb#338
|
931
|
+
class Loofah::Scrubbers::Unprintable < ::Loofah::Scrubber
|
932
|
+
# @return [Unprintable] a new instance of Unprintable
|
933
|
+
#
|
934
|
+
# source://loofah//lib/loofah/scrubbers.rb#339
|
935
|
+
def initialize; end
|
936
|
+
|
937
|
+
# source://loofah//lib/loofah/scrubbers.rb#343
|
938
|
+
def scrub(node); end
|
939
|
+
end
|
940
|
+
|
941
|
+
# === scrub!(:whitewash)
|
942
|
+
#
|
943
|
+
# +:whitewash+ removes all comments, styling and attributes in
|
944
|
+
# addition to doing markup-fixer-uppery and pruning unsafe tags. I
|
945
|
+
# like to call this "whitewashing", since it's like putting a new
|
946
|
+
# layer of paint on top of the HTML input to make it look nice.
|
947
|
+
#
|
948
|
+
# messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
|
949
|
+
# Loofah.html5_fragment(messy_markup).scrub!(:whitewash)
|
950
|
+
# => "ohai! <div>div with attributes</div>"
|
951
|
+
#
|
952
|
+
# One use case for this scrubber is to clean up HTML that was
|
953
|
+
# cut-and-pasted from Microsoft Word into a WYSIWYG editor or a
|
954
|
+
# rich text editor. Microsoft's software is famous for injecting
|
955
|
+
# all kinds of cruft into its HTML output. Who needs that crap?
|
956
|
+
# Certainly not me.
|
957
|
+
#
|
958
|
+
# source://loofah//lib/loofah/scrubbers.rb#191
|
959
|
+
class Loofah::Scrubbers::Whitewash < ::Loofah::Scrubber
|
960
|
+
# @return [Whitewash] a new instance of Whitewash
|
961
|
+
#
|
962
|
+
# source://loofah//lib/loofah/scrubbers.rb#192
|
963
|
+
def initialize; end
|
964
|
+
|
965
|
+
# source://loofah//lib/loofah/scrubbers.rb#196
|
966
|
+
def scrub(node); end
|
967
|
+
end
|
968
|
+
|
969
|
+
# Overrides +text+ in Document and DocumentFragment classes, and mixes in +to_text+.
|
970
|
+
#
|
971
|
+
# source://loofah//lib/loofah/concerns.rb#73
|
972
|
+
module Loofah::TextBehavior
|
973
|
+
# Returns a plain-text version of the markup contained by the document, with HTML entities
|
974
|
+
# encoded.
|
975
|
+
#
|
976
|
+
# This method is significantly faster than #to_text, but isn't clever about whitespace around
|
977
|
+
# block elements.
|
978
|
+
#
|
979
|
+
# Loofah.html5_document("<h1>Title</h1><div>Content</div>").text
|
980
|
+
# # => "TitleContent"
|
981
|
+
#
|
982
|
+
# By default, the returned text will have HTML entities escaped. If you want unescaped
|
983
|
+
# entities, and you understand that the result is unsafe to render in a browser, then you can
|
984
|
+
# pass an argument as shown:
|
985
|
+
#
|
986
|
+
# frag = Loofah.html5_fragment("<script>alert('EVIL');</script>")
|
987
|
+
# # ok for browser:
|
988
|
+
# frag.text # => "<script>alert('EVIL');</script>"
|
989
|
+
# # decidedly not ok for browser:
|
990
|
+
# frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
|
991
|
+
#
|
992
|
+
# source://loofah//lib/loofah/concerns.rb#94
|
993
|
+
def inner_text(options = T.unsafe(nil)); end
|
994
|
+
|
995
|
+
# Returns a plain-text version of the markup contained by the document, with HTML entities
|
996
|
+
# encoded.
|
997
|
+
#
|
998
|
+
# This method is significantly faster than #to_text, but isn't clever about whitespace around
|
999
|
+
# block elements.
|
1000
|
+
#
|
1001
|
+
# Loofah.html5_document("<h1>Title</h1><div>Content</div>").text
|
1002
|
+
# # => "TitleContent"
|
1003
|
+
#
|
1004
|
+
# By default, the returned text will have HTML entities escaped. If you want unescaped
|
1005
|
+
# entities, and you understand that the result is unsafe to render in a browser, then you can
|
1006
|
+
# pass an argument as shown:
|
1007
|
+
#
|
1008
|
+
# frag = Loofah.html5_fragment("<script>alert('EVIL');</script>")
|
1009
|
+
# # ok for browser:
|
1010
|
+
# frag.text # => "<script>alert('EVIL');</script>"
|
1011
|
+
# # decidedly not ok for browser:
|
1012
|
+
# frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
|
1013
|
+
#
|
1014
|
+
# source://loofah//lib/loofah/concerns.rb#94
|
1015
|
+
def text(options = T.unsafe(nil)); end
|
1016
|
+
|
1017
|
+
# Returns a plain-text version of the markup contained by the document, with HTML entities
|
1018
|
+
# encoded.
|
1019
|
+
#
|
1020
|
+
# This method is significantly faster than #to_text, but isn't clever about whitespace around
|
1021
|
+
# block elements.
|
1022
|
+
#
|
1023
|
+
# Loofah.html5_document("<h1>Title</h1><div>Content</div>").text
|
1024
|
+
# # => "TitleContent"
|
1025
|
+
#
|
1026
|
+
# By default, the returned text will have HTML entities escaped. If you want unescaped
|
1027
|
+
# entities, and you understand that the result is unsafe to render in a browser, then you can
|
1028
|
+
# pass an argument as shown:
|
1029
|
+
#
|
1030
|
+
# frag = Loofah.html5_fragment("<script>alert('EVIL');</script>")
|
1031
|
+
# # ok for browser:
|
1032
|
+
# frag.text # => "<script>alert('EVIL');</script>"
|
1033
|
+
# # decidedly not ok for browser:
|
1034
|
+
# frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
|
1035
|
+
#
|
1036
|
+
# source://loofah//lib/loofah/concerns.rb#94
|
1037
|
+
def to_str(options = T.unsafe(nil)); end
|
1038
|
+
|
1039
|
+
# Returns a plain-text version of the markup contained by the fragment, with HTML entities
|
1040
|
+
# encoded.
|
1041
|
+
#
|
1042
|
+
# This method is slower than #text, but is clever about whitespace around block elements and
|
1043
|
+
# line break elements.
|
1044
|
+
#
|
1045
|
+
# Loofah.html5_document("<h1>Title</h1><div>Content<br>Next line</div>").to_text
|
1046
|
+
# # => "\nTitle\n\nContent\nNext line\n"
|
1047
|
+
#
|
1048
|
+
# source://loofah//lib/loofah/concerns.rb#120
|
1049
|
+
def to_text(options = T.unsafe(nil)); end
|
1050
|
+
end
|
1051
|
+
|
1052
|
+
# The version of Loofah you are using
|
1053
|
+
#
|
1054
|
+
# source://loofah//lib/loofah/version.rb#5
|
1055
|
+
Loofah::VERSION = T.let(T.unsafe(nil), String)
|
1056
|
+
|
1057
|
+
# source://loofah//lib/loofah/xml/document.rb#4
|
1058
|
+
module Loofah::XML; end
|
1059
|
+
|
1060
|
+
# Subclass of Nokogiri::XML::Document.
|
1061
|
+
#
|
1062
|
+
# See Loofah::ScrubBehavior and Loofah::DocumentDecorator for additional methods.
|
1063
|
+
#
|
1064
|
+
# source://loofah//lib/loofah/xml/document.rb#10
|
1065
|
+
class Loofah::XML::Document < ::Nokogiri::XML::Document
|
1066
|
+
include ::Loofah::ScrubBehavior::Node
|
1067
|
+
include ::Loofah::DocumentDecorator
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
# Subclass of Nokogiri::XML::DocumentFragment.
|
1071
|
+
#
|
1072
|
+
# See Loofah::ScrubBehavior for additional methods.
|
1073
|
+
#
|
1074
|
+
# source://loofah//lib/loofah/xml/document_fragment.rb#10
|
1075
|
+
class Loofah::XML::DocumentFragment < ::Nokogiri::XML::DocumentFragment
|
1076
|
+
class << self
|
1077
|
+
# source://loofah//lib/loofah/xml/document_fragment.rb#12
|
1078
|
+
def parse(tags); end
|
1079
|
+
end
|
1080
|
+
end
|