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 +4 -4
- data/Gemfile +4 -0
- data/README.md +1 -1
- data/docs/api/find.md +3 -3
- data/docs/api/find_all.md +2 -2
- data/docs/api/prop.md +38 -0
- data/jekyll-joule.gemspec +3 -2
- data/lib/jekyll/extensions/{nokogiri_element.rb → oga_element.rb} +5 -1
- data/lib/jekyll/joule/site.rb +2 -2
- data/lib/jekyll/joule/version.rb +1 -1
- data/lib/jekyll/joule.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd6268f1e9100f1f43e57fef4313bda039358a52
|
4
|
+
data.tar.gz: 6c99760891af69e4ca0c0d7f3446b9127b56d78a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f525679b0c6d7f15f9476db689b5973295b7a12e573616fb80961b48850fa4320a3336be7e98a7dfc52e9163865c82de935d1625b87cda5dab445835cf033ca
|
7
|
+
data.tar.gz: 54297a5bf7af98384195ef62447e3fa805c368b98ae3f96d49585cd6d8ccf533dd8910c51507a0070875ce39bad92616c46d9c00f4e349193a28005edf3a74b0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Joule 🔸 [](https://travis-ci.org/helpscout/jekyll-joule) [](https://badge.fury.io/rb/jekyll-joule)
|
1
|
+
# Joule 🔸 [](https://travis-ci.org/helpscout/jekyll-joule) [](https://badge.fury.io/rb/jekyll-joule) [](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 [
|
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
|
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
|
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 [
|
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
|
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 "
|
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
|
data/lib/jekyll/joule/site.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "jekyll"
|
2
2
|
require "jekyll/joule/page"
|
3
|
-
require "
|
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 =
|
40
|
+
@html = Oga.parse_html(@data.content)
|
41
41
|
|
42
42
|
return self
|
43
43
|
end
|
data/lib/jekyll/joule/version.rb
CHANGED
data/lib/jekyll/joule.rb
CHANGED
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
|
+
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:
|
28
|
+
name: oga
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
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:
|
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:
|
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:
|
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:
|
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/
|
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
|