jekyll-joule 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d9106e4d2029a3eff12d283263d222ac4af2ddf
4
- data.tar.gz: e71183c5bb01ae0989d99557b0780486addbe1fd
3
+ metadata.gz: bd6268f1e9100f1f43e57fef4313bda039358a52
4
+ data.tar.gz: 6c99760891af69e4ca0c0d7f3446b9127b56d78a
5
5
  SHA512:
6
- metadata.gz: 6f6d471da8656f570362d52fc0997910c7410f39dab2e27b41d2ee875028703f07657278024d911bb344fd2b32d286acb4e5e7c852d1a26a67fe8b43aac3034f
7
- data.tar.gz: 92db87cf50fb452144b5360604e29951709f6f7a663659de4701894e92dd682b33afe56081bfd592c2e648a03825160ccafc84d86c866fdb356d766bcca6bd6c
6
+ metadata.gz: 6f525679b0c6d7f15f9476db689b5973295b7a12e573616fb80961b48850fa4320a3336be7e98a7dfc52e9163865c82de935d1625b87cda5dab445835cf033ca
7
+ data.tar.gz: 54297a5bf7af98384195ef62447e3fa805c368b98ae3f96d49585cd6d8ccf533dd8910c51507a0070875ce39bad92616c46d9c00f4e349193a28005edf3a74b0
data/Gemfile CHANGED
@@ -1,2 +1,6 @@
1
1
  source 'https://rubygems.org'
2
+
3
+ gem 'coveralls', require: false
4
+ gem 'simplecov', require: false
5
+
2
6
  gemspec
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Joule 🔸 [![Build Status](https://travis-ci.org/helpscout/jekyll-joule.svg?branch=master)](https://travis-ci.org/helpscout/jekyll-joule) [![Gem Version](https://badge.fury.io/rb/jekyll-joule.svg)](https://badge.fury.io/rb/jekyll-joule)
1
+ # Joule 🔸 [![Build Status](https://travis-ci.org/helpscout/jekyll-joule.svg?branch=master)](https://travis-ci.org/helpscout/jekyll-joule) [![Gem Version](https://badge.fury.io/rb/jekyll-joule.svg)](https://badge.fury.io/rb/jekyll-joule) [![Coverage Status](https://coveralls.io/repos/github/helpscout/jekyll-joule/badge.svg?branch=master)](https://coveralls.io/github/helpscout/jekyll-joule?branch=master)
2
2
 
3
3
  Joule is a Jekyll utility helper designed to make it (way) easier to write unit tests.
4
4
 
data/docs/api/find.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  | Type | Description |
13
13
  | --- | --- |
14
- | instance | A [Nokogiri](https://github.com/sparklemotion/nokogiri) element instance. |
14
+ | instance | A [Oga](https://github.com/YorickPeterse/oga) element instance. |
15
15
 
16
16
 
17
17
  ## Usage
@@ -30,7 +30,7 @@ html = %Q[
30
30
  el = @joule.find("blockquote")
31
31
  ```
32
32
 
33
- In the above example, the variable `el` would be a Nokogiri element for:
33
+ In the above example, the variable `el` would be an element for:
34
34
 
35
35
  ```html
36
36
  <blockquote class="quote">Pika-pi</blockquote>
@@ -45,7 +45,7 @@ el["class"] # quote
45
45
 
46
46
  ### Chaining
47
47
 
48
- Joule has enhanced Nokogiri's Element class by allowing you to find elements within elements.
48
+ Joule has enhanced Oga's `XML::Element` class by allowing you to find elements within elements.
49
49
 
50
50
  In the example below, we're able to find the inner `.pika` selector within the outer `.pikachu` selector.
51
51
  ```rb
data/docs/api/find_all.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  | Type | Description |
13
13
  | --- | --- |
14
- | array | An array of [Nokogiri](https://github.com/sparklemotion/nokogiri) element instances. |
14
+ | array | An array of [Oga](https://github.com/YorickPeterse/oga) element instances. |
15
15
 
16
16
 
17
17
  ## Usage
@@ -31,7 +31,7 @@ html = %Q[
31
31
  els = @joule.find_all(".spark")
32
32
  ```
33
33
 
34
- In the above example, the variable `els` would be an Array of 4 Nokogiri elements for:
34
+ In the above example, the variable `els` would be an Array of 4 elements for:
35
35
 
36
36
  ```html
37
37
  <div class="spark">...</div>
data/docs/api/prop.md ADDED
@@ -0,0 +1,38 @@
1
+ # .prop()
2
+
3
+ #### .prop(property)
4
+
5
+ | Argument | Type | Description |
6
+ | --- | --- | --- |
7
+ | property | string | Property of the HTML selector to retrieve |
8
+
9
+ #### Aliases
10
+
11
+ **[.get()](http://code.yorickpeterse.com/oga/latest/Oga/XML/Element.html#get-instance_method)**
12
+
13
+
14
+ #### Returns
15
+
16
+ | Type | Description |
17
+ | --- | --- |
18
+ | string | Value of the property retrieved |
19
+
20
+
21
+ ## Usage
22
+
23
+ In the following example, we're using `.prop()` to check the `class` property of the `<div>`:
24
+
25
+ ```rb
26
+ should "contain class of pika" do
27
+ html = %Q[
28
+ <div class="pikachu pika">
29
+ ...
30
+ </div>
31
+ ]
32
+ @joule.render(html)
33
+
34
+ el = @joule.find(".pikachu")
35
+
36
+ assert(el.prop("class").include?("pika"))
37
+ end
38
+ ```
data/jekyll-joule.gemspec CHANGED
@@ -21,16 +21,17 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_runtime_dependency "jekyll", ">= 3.1.2"
24
- spec.add_runtime_dependency "nokogiri", "~> 1.7.1"
24
+ spec.add_runtime_dependency "oga", "~> 2.10"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.13"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "minitest-reporters"
29
29
  spec.add_development_dependency "minitest-profile"
30
30
  spec.add_development_dependency "minitest", "~> 5.8"
31
+ spec.add_development_dependency "kramdown"
31
32
  spec.add_development_dependency "rspec-mocks"
32
33
  spec.add_development_dependency "shoulda"
33
- spec.add_development_dependency "kramdown"
34
34
  spec.add_development_dependency "jekyll-jolt"
35
35
  spec.add_development_dependency "jekyll-spark"
36
+
36
37
  end
@@ -1,4 +1,4 @@
1
- module Nokogiri
1
+ module Oga
2
2
  module XML
3
3
  class Element
4
4
  def find_all *args
@@ -8,6 +8,10 @@ module Nokogiri
8
8
  def find *args
9
9
  self.css(*args).first
10
10
  end
11
+
12
+ def prop *args
13
+ self.get *args
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -1,6 +1,6 @@
1
1
  require "jekyll"
2
2
  require "jekyll/joule/page"
3
- require "nokogiri"
3
+ require "oga"
4
4
 
5
5
  module Jekyll
6
6
  module Joule
@@ -37,7 +37,7 @@ module Jekyll
37
37
  page = Jekyll::Joule::Page.new(@site, @site.source, "/", @test_page_name)
38
38
  page.reparse(content)
39
39
  @data = generate(page)
40
- @html = Nokogiri::HTML(@data.content)
40
+ @html = Oga.parse_html(@data.content)
41
41
 
42
42
  return self
43
43
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Joule
3
- VERSION = "0.0.4"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
data/lib/jekyll/joule.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  require "jekyll/joule/version"
2
2
  require "jekyll/joule/site"
3
- require "jekyll/extensions/nokogiri_element"
3
+ require "jekyll/extensions/oga_element"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-joule
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ItsJonQ
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.1.2
27
27
  - !ruby/object:Gem::Dependency
28
- name: nokogiri
28
+ name: oga
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.7.1
33
+ version: '2.10'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.7.1
40
+ version: '2.10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '5.8'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec-mocks
112
+ name: kramdown
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: shoulda
126
+ name: rspec-mocks
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: kramdown
140
+ name: shoulda
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
@@ -193,6 +193,7 @@ files:
193
193
  - Rakefile
194
194
  - docs/api/find.md
195
195
  - docs/api/find_all.md
196
+ - docs/api/prop.md
196
197
  - docs/api/render.md
197
198
  - docs/introduction.md
198
199
  - docs/rendering.md
@@ -205,7 +206,7 @@ files:
205
206
  - examples/test/test_example.rb
206
207
  - jekyll-joule.gemspec
207
208
  - lib/jekyll-joule.rb
208
- - lib/jekyll/extensions/nokogiri_element.rb
209
+ - lib/jekyll/extensions/oga_element.rb
209
210
  - lib/jekyll/joule.rb
210
211
  - lib/jekyll/joule/page.rb
211
212
  - lib/jekyll/joule/site.rb