wovnrb 0.2.15 → 0.2.16
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/circle.yml +4 -0
- data/lib/wovnrb/html_replacers/replacer_base.rb +2 -2
- data/lib/wovnrb/version.rb +1 -1
- data/test/lib/html_replacers/replacer_base_test.rb +15 -0
- metadata +2 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b7f43ed6f36e66150ace95ea7cb5d43877af2da
|
|
4
|
+
data.tar.gz: 50cf1be127a79c8a5e0e14dc333639eb03cc160c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1370c369c99bc5267af4293e3a87089f4272583924e7168b95e7c30aaa57953061094f99023d680ba6fd306e9df90f886ffac71e69c4e169fd3cbf03686479d
|
|
7
|
+
data.tar.gz: af6a461b70f53880625a21d067688ce89209bdafa919b9d63ed0a0b32dace23097385a6d178f9bef47d8ba39fed7d296173067bbd285b4e07da491efb41ac48f
|
data/circle.yml
CHANGED
|
@@ -18,7 +18,7 @@ module Wovnrb
|
|
|
18
18
|
# <title> may not contain other markup, so add comment-node to node's previous
|
|
19
19
|
# @see https://www.w3.org/TR/html401/struct/global.html#h-7.4.2
|
|
20
20
|
def add_comment_node(node, text)
|
|
21
|
-
comment_node = Nokogiri::XML::Comment.new(node, "wovn-src:#{text}")
|
|
21
|
+
comment_node = Nokogiri::XML::Comment.new(node.document, "wovn-src:#{text}")
|
|
22
22
|
if node.parent.name == 'title'
|
|
23
23
|
node.parent.add_previous_sibling(comment_node)
|
|
24
24
|
else
|
|
@@ -30,4 +30,4 @@ module Wovnrb
|
|
|
30
30
|
from.gsub(/\A(\s*)[\S\s]*?(\s*)\Z/, '\1' + to + '\2')
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
|
-
end
|
|
33
|
+
end
|
data/lib/wovnrb/version.rb
CHANGED
|
@@ -45,6 +45,21 @@ module Wovnrb
|
|
|
45
45
|
actual = replacer.send(:replace_text, " Hello \n Hello ", 'こんにちは')
|
|
46
46
|
assert_equal(' こんにちは ', actual)
|
|
47
47
|
end
|
|
48
|
+
|
|
49
|
+
def test_add_comment_node
|
|
50
|
+
replacer = ReplacerBase.new
|
|
51
|
+
html = Nokogiri::HTML5('<html><body><h1 id="test-node">Test Content</h1></body></html>')
|
|
52
|
+
h1 = html.xpath("//h1[@id='test-node']")[0]
|
|
53
|
+
|
|
54
|
+
assert_equal('Test Content', h1.inner_html)
|
|
55
|
+
h1.xpath('//text()').each do |node|
|
|
56
|
+
text_content = node.content
|
|
57
|
+
if text_content == 'Test Content'
|
|
58
|
+
replacer.send(:add_comment_node, node, 'test content')
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
assert_equal("<!--wovn-src:test content-->Test Content", h1.inner_html)
|
|
62
|
+
end
|
|
48
63
|
end
|
|
49
64
|
end
|
|
50
65
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wovnrb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeff Sandford
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-04-
|
|
12
|
+
date: 2017-04-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: nokogumbo
|
|
@@ -423,4 +423,3 @@ test_files:
|
|
|
423
423
|
- test/lib/wovnrb_test.rb
|
|
424
424
|
- test/services/url_test.rb
|
|
425
425
|
- test/test_helper.rb
|
|
426
|
-
has_rdoc:
|