nokogiri-html-ext 0.3.1 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +24 -36
- data/lib/nokogiri/html-ext.rb +2 -2
- data/lib/nokogiri/html_ext/document.rb +38 -28
- data/lib/nokogiri/html_ext/version.rb +1 -1
- data/nokogiri-html-ext.gemspec +15 -15
- metadata +6 -7
- data/CONTRIBUTING.md +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7967d8d98d8778c9a5690637757071c8357b3c55e14d100d508f6ce12469887
|
4
|
+
data.tar.gz: b8f5601a2c40f4edaf77c60afda07a6adf848052d2bf0810cef1c497691c22f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d396e7c18ecce3e9d19f97e90c3ea6753861ce8f5b330e7db1f7d5e9e0ae888b65e388cd6b745fc250b559ab6ed519b79151e2d802f94086c278cb6b756968
|
7
|
+
data.tar.gz: 56dcade1b0b103b7174fa567082007f9d9bd24bc01af8f8bb1a3babaf56844eedd839be9a213861c0c655f204704145fd1c758c9943285e2489a1259b420157a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.4.1 / 2023-12-07
|
4
|
+
|
5
|
+
- Add publish workflow (039abd0)
|
6
|
+
- Use `filter_map` instead of `compact` and `map` (ab574c9)
|
7
|
+
- Add ignored revs file (3e24d9f)
|
8
|
+
- RuboCop: address Style/StringLiterals warnings (a04b4d3)
|
9
|
+
- Update to newest rubocop-configs format (0ed51ce)
|
10
|
+
- Update RSpec configuration (#8) (4968bee)
|
11
|
+
- Update development Ruby version (#7) (0e4613a)
|
12
|
+
- Refactor CI workflow (#6) (5259b68)
|
13
|
+
- Remove CodeClimate (#5) (284fce7)
|
14
|
+
|
15
|
+
## 0.4.0 / 2023-01-20
|
16
|
+
|
17
|
+
- Improve (hopefully) handling of non-ASCII input (6d1fc4d)
|
18
|
+
- Update Nokogiri version constraint to >= 1.14 (4b7ed74)
|
19
|
+
|
3
20
|
## 0.3.1 / 2023-01-19
|
4
21
|
|
5
22
|
- Revert removal of escaping/unescaping code in relative URL resolution (a78e83a)
|
data/README.md
CHANGED
@@ -5,8 +5,6 @@
|
|
5
5
|
[![Gem](https://img.shields.io/gem/v/nokogiri-html-ext.svg?logo=rubygems&style=for-the-badge)](https://rubygems.org/gems/nokogiri-html-ext)
|
6
6
|
[![Downloads](https://img.shields.io/gem/dt/nokogiri-html-ext.svg?logo=rubygems&style=for-the-badge)](https://rubygems.org/gems/nokogiri-html-ext)
|
7
7
|
[![Build](https://img.shields.io/github/actions/workflow/status/jgarber623/nokogiri-html-ext/ci.yml?branch=main&logo=github&style=for-the-badge)](https://github.com/jgarber623/nokogiri-html-ext/actions/workflows/ci.yml)
|
8
|
-
[![Maintainability](https://img.shields.io/codeclimate/maintainability/jgarber623/nokogiri-html-ext.svg?logo=code-climate&style=for-the-badge)](https://codeclimate.com/github/jgarber623/nokogiri-html-ext)
|
9
|
-
[![Coverage](https://img.shields.io/codeclimate/c/jgarber623/nokogiri-html-ext.svg?logo=code-climate&style=for-the-badge)](https://codeclimate.com/github/jgarber623/nokogiri-html-ext/code)
|
10
8
|
|
11
9
|
## Key features
|
12
10
|
|
@@ -16,24 +14,18 @@
|
|
16
14
|
|
17
15
|
## Getting Started
|
18
16
|
|
19
|
-
Before installing and using nokogiri-html-ext, you'll want to have [Ruby](https://www.ruby-lang.org) 2.7 (or newer) installed.
|
17
|
+
Before installing and using nokogiri-html-ext, you'll want to have [Ruby](https://www.ruby-lang.org) 2.7 (or newer) installed. Using a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm) is recommended.
|
20
18
|
|
21
|
-
nokogiri-html-ext is developed using Ruby 2.7.
|
19
|
+
nokogiri-html-ext is developed using Ruby 2.7.8 and is tested against additional Ruby versions using [GitHub Actions](https://github.com/indieweb/nokogiri-html-ext/actions).
|
22
20
|
|
23
21
|
## Installation
|
24
22
|
|
25
|
-
|
23
|
+
Add nokogiri-html-ext to your project's `Gemfile` and run `bundle install`:
|
26
24
|
|
27
25
|
```ruby
|
28
|
-
|
29
|
-
```
|
30
|
-
|
31
|
-
…and run `bundle install` in your shell.
|
32
|
-
|
33
|
-
To install the gem manually, run the following in your shell:
|
26
|
+
source "https://rubygems.org"
|
34
27
|
|
35
|
-
|
36
|
-
gem install nokogiri-html-ext
|
28
|
+
gem "nokogiri-html-ext"
|
37
29
|
```
|
38
30
|
|
39
31
|
## Usage
|
@@ -43,19 +35,19 @@ gem install nokogiri-html-ext
|
|
43
35
|
nokogiri-html-ext provides two helper methods for getting and setting a document's `<base>` element's `href` attribute. The first, `base_href`, retrieves the element's `href` attribute value if it exists.
|
44
36
|
|
45
37
|
```ruby
|
46
|
-
require
|
38
|
+
require "nokogiri/html-ext"
|
47
39
|
|
48
|
-
doc = Nokogiri::HTML(
|
40
|
+
doc = Nokogiri::HTML(%(<html><body>Hello, world!</body></html>))
|
49
41
|
|
50
42
|
doc.base_href
|
51
43
|
#=> nil
|
52
44
|
|
53
|
-
doc = Nokogiri::HTML(
|
45
|
+
doc = Nokogiri::HTML(%(<html><head><base target="_top"><body>Hello, world!</body></html>))
|
54
46
|
|
55
47
|
doc.base_href
|
56
48
|
#=> nil
|
57
49
|
|
58
|
-
doc = Nokogiri::HTML(
|
50
|
+
doc = Nokogiri::HTML(%(<html><head><base href="/foo"><body>Hello, world!</body></html>))
|
59
51
|
|
60
52
|
doc.base_href
|
61
53
|
#=> "/foo"
|
@@ -64,22 +56,22 @@ doc.base_href
|
|
64
56
|
The `base_href=` method allows you to manipulate the document's `<base>` element.
|
65
57
|
|
66
58
|
```ruby
|
67
|
-
require
|
59
|
+
require "nokogiri/html-ext"
|
68
60
|
|
69
|
-
doc = Nokogiri::HTML(
|
61
|
+
doc = Nokogiri::HTML(%(<html><body>Hello, world!</body></html>))
|
70
62
|
|
71
|
-
doc.base_href =
|
63
|
+
doc.base_href = "/foo"
|
72
64
|
#=> "/foo"
|
73
65
|
|
74
|
-
doc.at_css(
|
66
|
+
doc.at_css("base").to_s
|
75
67
|
#=> "<base href=\"/foo\">"
|
76
68
|
|
77
|
-
doc = Nokogiri::HTML(
|
69
|
+
doc = Nokogiri::HTML(%(<html><head><base href="/foo"><body>Hello, world!</body></html>))
|
78
70
|
|
79
|
-
doc.base_href =
|
71
|
+
doc.base_href = "/bar"
|
80
72
|
#=> "/bar"
|
81
73
|
|
82
|
-
doc.at_css(
|
74
|
+
doc.at_css("base").to_s
|
83
75
|
#=> "<base href=\"/bar\">"
|
84
76
|
```
|
85
77
|
|
@@ -96,7 +88,7 @@ URL resolution uses Ruby's built-in URL parsing and normalizing capabilities. Ab
|
|
96
88
|
An abbreviated example:
|
97
89
|
|
98
90
|
```ruby
|
99
|
-
require
|
91
|
+
require "nokogiri/html-ext"
|
100
92
|
|
101
93
|
markup = <<-HTML
|
102
94
|
<html>
|
@@ -107,7 +99,7 @@ markup = <<-HTML
|
|
107
99
|
</html>
|
108
100
|
HTML
|
109
101
|
|
110
|
-
doc = Nokogiri::HTML(markup,
|
102
|
+
doc = Nokogiri::HTML(markup, "https://jgarber.example")
|
111
103
|
|
112
104
|
doc.url
|
113
105
|
#=> "https://jgarber.example"
|
@@ -115,18 +107,18 @@ doc.url
|
|
115
107
|
doc.base_href
|
116
108
|
#=> nil
|
117
109
|
|
118
|
-
doc.base_href =
|
110
|
+
doc.base_href = "/foo/bar/biz"
|
119
111
|
#=> "/foo/bar/biz"
|
120
112
|
|
121
113
|
doc.resolve_relative_urls!
|
122
114
|
|
123
|
-
doc.at_css(
|
115
|
+
doc.at_css("base")["href"]
|
124
116
|
#=> "https://jgarber.example/foo/bar/biz"
|
125
117
|
|
126
|
-
doc.at_css(
|
118
|
+
doc.at_css("a")["href"]
|
127
119
|
#=> "https://jgarber.example/home"
|
128
120
|
|
129
|
-
doc.at_css(
|
121
|
+
doc.at_css("img").to_s
|
130
122
|
#=> "<img src=\"https://jgarber.example/foo.png\" srcset=\"https://jgarber.example/foo/bar.png 720w\">"
|
131
123
|
```
|
132
124
|
|
@@ -135,16 +127,12 @@ doc.at_css('img').to_s
|
|
135
127
|
You may also resolve an arbitrary `String` representing a relative URL against the document's URL (or `<base>` element's `href` attribute value):
|
136
128
|
|
137
129
|
```ruby
|
138
|
-
doc = Nokogiri::HTML(
|
130
|
+
doc = Nokogiri::HTML(%(<html><base href="/foo/bar"></html>), "https://jgarber.example")
|
139
131
|
|
140
|
-
doc.resolve_relative_url(
|
132
|
+
doc.resolve_relative_url("biz/baz")
|
141
133
|
#=> "https://jgarber.example/foo/biz/baz"
|
142
134
|
```
|
143
135
|
|
144
|
-
## Contributing
|
145
|
-
|
146
|
-
Interested in helping improve nokogiri-html-ext? Awesome! Your help is greatly appreciated. See [CONTRIBUTING.md](https://github.com/jgarber623/nokogiri-html-ext/blob/main/CONTRIBUTING.md) for details.
|
147
|
-
|
148
136
|
## Acknowledgments
|
149
137
|
|
150
138
|
nokogiri-html-ext wouldn't exist without the [Nokogiri](https://nokogiri.org) project and its [community](https://github.com/sparklemotion/nokogiri).
|
data/lib/nokogiri/html-ext.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "nokogiri"
|
4
4
|
|
5
5
|
module Nokogiri
|
6
6
|
module HTML4
|
7
7
|
class Document < Nokogiri::XML::Document
|
8
|
-
# A map of HTML
|
8
|
+
# A map of HTML +srcset+ attributes and their associated element names.
|
9
9
|
#
|
10
10
|
# @see https://html.spec.whatwg.org/#srcset-attributes
|
11
11
|
# @see https://html.spec.whatwg.org/#attributes-3
|
12
12
|
IMAGE_CANDIDATE_STRINGS_ATTRIBUTES_MAP = {
|
13
|
-
|
14
|
-
|
13
|
+
"imagesrcset" => %w[link],
|
14
|
+
"srcset" => %w[img source]
|
15
15
|
}.freeze
|
16
16
|
|
17
17
|
private_constant :IMAGE_CANDIDATE_STRINGS_ATTRIBUTES_MAP
|
@@ -20,30 +20,30 @@ module Nokogiri
|
|
20
20
|
#
|
21
21
|
# @see https://html.spec.whatwg.org/#attributes-3
|
22
22
|
URL_ATTRIBUTES_MAP = {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
"action" => %w[form],
|
24
|
+
"cite" => %w[blockquote del ins q],
|
25
|
+
"data" => %w[object],
|
26
|
+
"formaction" => %w[button input],
|
27
|
+
"href" => %w[a area base link],
|
28
|
+
"ping" => %w[a area],
|
29
|
+
"poster" => %w[video],
|
30
|
+
"src" => %w[audio embed iframe img input script source track video]
|
31
31
|
}.freeze
|
32
32
|
|
33
33
|
private_constant :URL_ATTRIBUTES_MAP
|
34
34
|
|
35
|
-
# Get the
|
35
|
+
# Get the +<base>+ element's HREF attribute value.
|
36
36
|
#
|
37
37
|
# @return [String, nil]
|
38
38
|
def base_href
|
39
|
-
(base = at_xpath(
|
39
|
+
(base = at_xpath("//base[@href]")) && base["href"].strip
|
40
40
|
end
|
41
41
|
|
42
|
-
# Set the
|
42
|
+
# Set the +<base>+ element's HREF attribute value.
|
43
43
|
#
|
44
|
-
# If a
|
45
|
-
# the given value. If no
|
46
|
-
# one and append it to the document's
|
44
|
+
# If a +<base>+ element exists, its HREF attribute value is replaced with
|
45
|
+
# the given value. If no +<base>+ element exists, this method will create
|
46
|
+
# one and append it to the document's +<head>+ (creating that element if
|
47
47
|
# necessary).
|
48
48
|
#
|
49
49
|
# @param url [String, #to_s]
|
@@ -52,12 +52,12 @@ module Nokogiri
|
|
52
52
|
def base_href=(url)
|
53
53
|
url_str = url.to_s
|
54
54
|
|
55
|
-
if (base = at_xpath(
|
56
|
-
base[
|
55
|
+
if (base = at_xpath("//base"))
|
56
|
+
base["href"] = url_str
|
57
57
|
url_str
|
58
58
|
else
|
59
|
-
base = XML::Node.new(
|
60
|
-
base[
|
59
|
+
base = XML::Node.new("base", self)
|
60
|
+
base["href"] = url_str
|
61
61
|
|
62
62
|
set_metadata_element(base)
|
63
63
|
end
|
@@ -71,13 +71,16 @@ module Nokogiri
|
|
71
71
|
def resolve_relative_url(url)
|
72
72
|
url_str = url.to_s
|
73
73
|
|
74
|
+
# Escape each component before joining (Ruby's +URI.parse+ only likes
|
75
|
+
# ASCII) and subsequently unescaping.
|
74
76
|
uri_parser.unescape(
|
75
|
-
uri_parser
|
76
|
-
|
77
|
-
|
77
|
+
uri_parser
|
78
|
+
.join(*[doc_url_str, base_href, url_str].filter_map { |u| uri_parser.escape(u) unless u.nil? })
|
79
|
+
.normalize
|
80
|
+
.to_s
|
78
81
|
)
|
79
82
|
rescue URI::InvalidComponentError, URI::InvalidURIError
|
80
|
-
|
83
|
+
url_str
|
81
84
|
end
|
82
85
|
|
83
86
|
# Convert the document's relative URLs to absolute URLs.
|
@@ -90,9 +93,9 @@ module Nokogiri
|
|
90
93
|
|
91
94
|
resolve_relative_urls_for(IMAGE_CANDIDATE_STRINGS_ATTRIBUTES_MAP) do |value|
|
92
95
|
value
|
93
|
-
.split(
|
96
|
+
.split(",")
|
94
97
|
.map { |candidate| candidate.strip.sub(/^(.+?)(\s+.+)?$/) { "#{resolve_relative_url($1)}#{$2}" } }
|
95
|
-
.join(
|
98
|
+
.join(", ")
|
96
99
|
end
|
97
100
|
|
98
101
|
self
|
@@ -101,6 +104,13 @@ module Nokogiri
|
|
101
104
|
|
102
105
|
private
|
103
106
|
|
107
|
+
# +Nokogiri::HTML4::Document#url+ may be double-escaped if the parser
|
108
|
+
# detects non-ASCII characters. For example, +https://[skull emoji].example+
|
109
|
+
# is returned as +"https%3A//%25E2%2598%25A0%25EF%25B8%258F.example+.
|
110
|
+
def doc_url_str
|
111
|
+
@doc_url_str ||= uri_parser.unescape(uri_parser.unescape(document.url)).strip
|
112
|
+
end
|
113
|
+
|
104
114
|
def resolve_relative_urls_for(attributes_map)
|
105
115
|
attributes_map.each do |attribute, names|
|
106
116
|
xpaths = names.map { |name| "//#{name}[@#{attribute}]" }
|
data/nokogiri-html-ext.gemspec
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "lib/nokogiri/html_ext/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.required_ruby_version =
|
6
|
+
spec.required_ruby_version = ">= 2.7"
|
7
7
|
|
8
|
-
spec.name =
|
8
|
+
spec.name = "nokogiri-html-ext"
|
9
9
|
spec.version = Nokogiri::HTMLExt::VERSION
|
10
|
-
spec.authors = [
|
11
|
-
spec.email = [
|
10
|
+
spec.authors = ["Jason Garber"]
|
11
|
+
spec.email = ["jason@sixtwothree.org"]
|
12
12
|
|
13
|
-
spec.summary =
|
13
|
+
spec.summary = "Extend Nokogiri with several useful HTML-centric features."
|
14
14
|
spec.description = spec.summary
|
15
|
-
spec.homepage =
|
16
|
-
spec.license =
|
15
|
+
spec.homepage = "https://github.com/jgarber623/nokogiri-html-ext"
|
16
|
+
spec.license = "MIT"
|
17
17
|
|
18
|
-
spec.files = Dir[
|
19
|
-
spec.files += %w[LICENSE CHANGELOG.md
|
18
|
+
spec.files = Dir["lib/**/*"].reject { |f| File.directory?(f) }
|
19
|
+
spec.files += %w[LICENSE CHANGELOG.md README.md]
|
20
20
|
spec.files += %w[nokogiri-html-ext.gemspec]
|
21
21
|
|
22
|
-
spec.require_paths = [
|
22
|
+
spec.require_paths = ["lib"]
|
23
23
|
|
24
24
|
spec.metadata = {
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
"bug_tracker_uri" => "#{spec.homepage}/issues",
|
26
|
+
"changelog_uri" => "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md",
|
27
|
+
"rubygems_mfa_required" => "true"
|
28
28
|
}
|
29
29
|
|
30
|
-
spec.add_runtime_dependency
|
30
|
+
spec.add_runtime_dependency "nokogiri", ">= 1.14"
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri-html-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Garber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.14'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.14'
|
27
27
|
description: Extend Nokogiri with several useful HTML-centric features.
|
28
28
|
email:
|
29
29
|
- jason@sixtwothree.org
|
@@ -32,7 +32,6 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- CHANGELOG.md
|
35
|
-
- CONTRIBUTING.md
|
36
35
|
- LICENSE
|
37
36
|
- README.md
|
38
37
|
- lib/nokogiri/html-ext.rb
|
@@ -44,7 +43,7 @@ licenses:
|
|
44
43
|
- MIT
|
45
44
|
metadata:
|
46
45
|
bug_tracker_uri: https://github.com/jgarber623/nokogiri-html-ext/issues
|
47
|
-
changelog_uri: https://github.com/jgarber623/nokogiri-html-ext/blob/v0.
|
46
|
+
changelog_uri: https://github.com/jgarber623/nokogiri-html-ext/blob/v0.4.1/CHANGELOG.md
|
48
47
|
rubygems_mfa_required: 'true'
|
49
48
|
post_install_message:
|
50
49
|
rdoc_options: []
|
@@ -61,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
60
|
- !ruby/object:Gem::Version
|
62
61
|
version: '0'
|
63
62
|
requirements: []
|
64
|
-
rubygems_version: 3.
|
63
|
+
rubygems_version: 3.1.6
|
65
64
|
signing_key:
|
66
65
|
specification_version: 4
|
67
66
|
summary: Extend Nokogiri with several useful HTML-centric features.
|
data/CONTRIBUTING.md
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# Contributing to nokogiri-html-ext
|
2
|
-
|
3
|
-
There are a couple ways you can help improve nokogiri-html-ext:
|
4
|
-
|
5
|
-
1. Fix an existing [issue][issues] and submit a [pull request][pulls].
|
6
|
-
1. Review open [pull requests][pulls].
|
7
|
-
1. Report a new [issue][issues]. _Only do this after you've made sure the behavior or problem you're observing isn't already documented in an open issue._
|
8
|
-
|
9
|
-
## Getting Started
|
10
|
-
|
11
|
-
nokogiri-html-ext is developed using Ruby 2.7.7 and is additionally tested against Ruby 3.0, 3.1, and 3.2 using [GitHub Actions](https://github.com/jgarber623/nokogiri-html-ext/actions).
|
12
|
-
|
13
|
-
Before making changes to nokogiri-html-ext, you'll want to install Ruby 2.7.7. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm). Once you've installed Ruby 2.7.7 using your method of choice, install the project's gems by running:
|
14
|
-
|
15
|
-
```sh
|
16
|
-
bundle install
|
17
|
-
```
|
18
|
-
|
19
|
-
## Making Changes
|
20
|
-
|
21
|
-
1. Fork and clone the project's repo.
|
22
|
-
1. Install development dependencies as outlined above.
|
23
|
-
1. Create a feature branch for the code changes you're looking to make: `git checkout -b my-new-feature`.
|
24
|
-
1. _Write some code!_
|
25
|
-
1. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `bundle exec rspec`.
|
26
|
-
1. Commit your changes: `git commit -am 'Add some new feature or fix some issue'`. _(See [this excellent article](https://chris.beams.io/posts/git-commit/) for tips on writing useful Git commit messages.)_
|
27
|
-
1. Push the branch to your fork: `git push -u origin my-new-feature`.
|
28
|
-
1. Create a new [pull request][pulls] and we'll review your changes.
|
29
|
-
|
30
|
-
## Code Style
|
31
|
-
|
32
|
-
Code formatting conventions are defined in the `.editorconfig` file which uses the [EditorConfig](http://editorconfig.org) syntax. There are [plugins for a variety of editors](http://editorconfig.org/#download) that utilize the settings in the `.editorconfig` file. We recommended you install the EditorConfig plugin for your editor of choice.
|
33
|
-
|
34
|
-
Your bug fix or feature addition won't be rejected if it runs afoul of any (or all) of these guidelines, but following the guidelines will definitely make everyone's lives a little easier.
|
35
|
-
|
36
|
-
[issues]: https://github.com/jgarber623/nokogiri-html-ext/issues
|
37
|
-
[pulls]: https://github.com/jgarber623/nokogiri-html-ext/pulls
|