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