Skip to content

Commit

Permalink
Update html5.rb forwarding params syntax (#3329)
Browse files Browse the repository at this point in the history
hackday 🙂

**What problem is this PR intended to solve?**

#3323 

**Have you included adequate test coverage?**

No test changes

**Does this change affect the behavior of either the C or the Java
implementations?**
No
  • Loading branch information
flavorjones authored Dec 6, 2024
2 parents 3100afb + 6c27c55 commit e548e80
Showing 1 changed file with 26 additions and 29 deletions.
55 changes: 26 additions & 29 deletions lib/nokogiri/html5.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# coding: utf-8
# frozen_string_literal: true

# This file includes code from the Nokogumbo project, whose license follows.
#
# Copyright 2013-2021 Sam Ruby, Stephen Checkoway
# Copyright 2013-2021 Sam Ruby, Stephen Checkoway
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require_relative "html5/document"
Expand All @@ -23,30 +24,27 @@
require_relative "html5/builder"

module Nokogiri
# Since v1.12.0
#
# ⚠ HTML5 functionality is not available when running JRuby.
#
# Parse an HTML5 document. Convenience method for {Nokogiri::HTML5::Document.parse}
def self.HTML5(input, url = nil, encoding = nil, **options, &block)
Nokogiri::HTML5::Document.parse(input, url, encoding, **options, &block)
# Convenience method for Nokogiri::HTML5::Document.parse
def self.HTML5(...)
Nokogiri::HTML5::Document.parse(...)
end

# == Usage
#
# ⚠ HTML5 functionality is not available when running JRuby.
#
# Parse an HTML5 document:
#
# doc = Nokogiri.HTML5(string)
# doc = Nokogiri.HTML5(input)
#
# Parse an HTML5 fragment:
#
# fragment = Nokogiri::HTML5.fragment(string)
# fragment = Nokogiri::HTML5.fragment(input)
#
# ⚠ HTML5 functionality is not available when running JRuby.
#
# == Parsing options
#
# The document and fragment parsing methods support options that are different from Nokogiri's.
# The document and fragment parsing methods support options that are different from
# Nokogiri::HTML4::Document or Nokogiri::XML::Document.
#
# - <tt>Nokogiri.HTML5(html, url = nil, encoding = nil, **options)</tt>
# - <tt>Nokogiri::HTML5.parse(html, url = nil, encoding = nil, **options)</tt>
Expand Down Expand Up @@ -267,15 +265,14 @@ def self.HTML5(input, url = nil, encoding = nil, **options, &block)
# Since v1.12.0
module HTML5
class << self
# Parse an HTML 5 document. Convenience method for Nokogiri::HTML5::Document.parse
def parse(string, url = nil, encoding = nil, **options, &block)
Document.parse(string, url, encoding, **options, &block)
# Convenience method for Nokogiri::HTML5::Document.parse
def parse(...)
Document.parse(...)
end

# Parse a fragment from +string+. Convenience method for
# Nokogiri::HTML5::DocumentFragment.parse.
def fragment(string, encoding = nil, **options)
DocumentFragment.parse(string, encoding, **options)
# Convenience method for Nokogiri::HTML5::DocumentFragment.parse
def fragment(...)
DocumentFragment.parse(...)
end

# :nodoc:
Expand Down

0 comments on commit e548e80

Please sign in to comment.