wovnrb 3.0.3 → 3.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/docker/rails/TestSite/yarn.lock +3 -3
- data/lib/wovnrb/services/html_converter.rb +1 -1
- data/lib/wovnrb/store.rb +3 -6
- data/lib/wovnrb/version.rb +1 -1
- data/test/lib/services/html_converter_test.rb +13 -13
- data/test/lib/store_test.rb +8 -6
- data/test/lib/wovnrb_test.rb +4 -4
- data/wovnrb.gemspec +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4d23f8ac05cb8fbefe04b2c8ae96f9932b280762e2491c80552bd20314d17e6d
|
|
4
|
+
data.tar.gz: 44118f0db0276085f492b631eeba2af8fe349f6b9d7ef96627590dda63793d80
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a71cbbd14782608c0c445d146bc262d5dfcf6bd7fca9cbfb467aad6f62caf9f979a98ae29a3e0fee38d77202217960b39e5ac9755975ba1fbd5e3899d5d7e69b
|
|
7
|
+
data.tar.gz: 9576ec7bd9d7053be56a116286ee9fe45df7a1f0c9e826dc114b0c77963d5e7c4ae53245655269fa8287cb45aa2ea0e56fdeecdf4cb81e4ce397d7f5595c31ef
|
|
@@ -7269,9 +7269,9 @@ urix@^0.1.0:
|
|
|
7269
7269
|
integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=
|
|
7270
7270
|
|
|
7271
7271
|
url-parse@^1.4.3, url-parse@^1.5.1:
|
|
7272
|
-
version "1.5.
|
|
7273
|
-
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.
|
|
7274
|
-
integrity sha512-
|
|
7272
|
+
version "1.5.3"
|
|
7273
|
+
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.3.tgz#71c1303d38fb6639ade183c2992c8cc0686df862"
|
|
7274
|
+
integrity sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==
|
|
7275
7275
|
dependencies:
|
|
7276
7276
|
querystringify "^2.1.1"
|
|
7277
7277
|
requires-port "^1.0.0"
|
|
@@ -155,7 +155,7 @@ module Wovnrb
|
|
|
155
155
|
return unless parent_node
|
|
156
156
|
|
|
157
157
|
insert_node = Nokogiri::XML::Node.new('script', @dom)
|
|
158
|
-
insert_node['src'] =
|
|
158
|
+
insert_node['src'] = @store.widget_url
|
|
159
159
|
insert_node['async'] = true
|
|
160
160
|
insert_node['data-wovnio'] = data_wovnio
|
|
161
161
|
insert_node['data-wovnio-type'] = 'fallback_snippet' if adds_backend_error_mark
|
data/lib/wovnrb/store.rb
CHANGED
|
@@ -34,6 +34,7 @@ module Wovnrb
|
|
|
34
34
|
'use_proxy' => false, # use env['HTTP_X_FORWARDED_HOST'] instead of env['HTTP_HOST'] and env['SERVER_NAME'] when this setting is true.
|
|
35
35
|
'custom_lang_aliases' => {},
|
|
36
36
|
'translate_fragment' => true,
|
|
37
|
+
'widget_url' => 'https://j.wovn.io/1',
|
|
37
38
|
'wovn_dev_mode' => false
|
|
38
39
|
)
|
|
39
40
|
end
|
|
@@ -180,12 +181,8 @@ module Wovnrb
|
|
|
180
181
|
@settings['supported_langs'] || []
|
|
181
182
|
end
|
|
182
183
|
|
|
183
|
-
def
|
|
184
|
-
|
|
185
|
-
'dev-wovn.io'
|
|
186
|
-
else
|
|
187
|
-
'wovn.io'
|
|
188
|
-
end
|
|
184
|
+
def widget_url
|
|
185
|
+
@settings['widget_url'] || 'https://j.wovn.io/1'
|
|
189
186
|
end
|
|
190
187
|
|
|
191
188
|
def dev_mode?
|
data/lib/wovnrb/version.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Wovnrb
|
|
|
6
6
|
converter = prepare_html_converter('<html><body><a class="test">hello</a></body></html>', supported_langs: %w[en vi])
|
|
7
7
|
converted_html, = converter.build_api_compatible_html
|
|
8
8
|
|
|
9
|
-
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
9
|
+
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><link rel=\"alternate\" hreflang=\"en\" href=\"http://my-site.com/\"><link rel=\"alternate\" hreflang=\"vi\" href=\"http://my-site.com/?wovn=vi\"></head><body><a class=\"test\">hello</a></body></html>"
|
|
10
10
|
assert_equal(expected_html, converted_html)
|
|
11
11
|
end
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@ module Wovnrb
|
|
|
19
19
|
converter = prepare_html_converter('<html><body><a class="test">hello</a></body></html>', settings)
|
|
20
20
|
converted_html, = converter.build_api_compatible_html
|
|
21
21
|
|
|
22
|
-
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
22
|
+
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=lang&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><link rel=\"alternate\" hreflang=\"en\" href=\"http://my-site.com/\"><link rel=\"alternate\" hreflang=\"vi\" href=\"http://my-site.com/?lang=vi\"></head><body><a class=\"test\">hello</a></body></html>"
|
|
23
23
|
assert_equal(expected_html, converted_html)
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@ module Wovnrb
|
|
|
28
28
|
converter = prepare_html_converter("<html><body><p>#{long_string}</p></body></html>", supported_langs: %w[en vi])
|
|
29
29
|
converted_html, = converter.build_api_compatible_html
|
|
30
30
|
|
|
31
|
-
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
31
|
+
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><link rel=\"alternate\" hreflang=\"en\" href=\"http://my-site.com/\"><link rel=\"alternate\" hreflang=\"vi\" href=\"http://my-site.com/?wovn=vi\"></head><body><p>#{long_string}</p></body></html>"
|
|
32
32
|
assert_equal(expected_html, converted_html)
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -45,7 +45,7 @@ module Wovnrb
|
|
|
45
45
|
converter = prepare_html_converter(html, ignore_class: ['ignore-me'])
|
|
46
46
|
converted_html, = converter.build_api_compatible_html
|
|
47
47
|
|
|
48
|
-
expected_convert_html = "<html lang=\"en\"><head><script src=\"
|
|
48
|
+
expected_convert_html = "<html lang=\"en\"><head><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://my-site.com/\"><link rel=\"alternate\" hreflang=\"fr\" href=\"http://my-site.com/?wovn=fr\"><link rel=\"alternate\" hreflang=\"ja\" href=\"http://my-site.com/?wovn=ja\"><link rel=\"alternate\" hreflang=\"vi\" href=\"http://my-site.com/?wovn=vi\"></head><body><p>Hello <span wovn-ignore=\"\"><!-- __wovn-backend-ignored-key-0 --></span></p><p></p><p>Hello <span data-wovn-ignore=\"\"><!-- __wovn-backend-ignored-key-1 --></span></p><p></p><div><span class=\"ignore-me\"><!-- __wovn-backend-ignored-key-2 --></span></div><span>Have a nice day!</span></body></html>"
|
|
49
49
|
assert_equal(expected_convert_html, converted_html)
|
|
50
50
|
end
|
|
51
51
|
|
|
@@ -62,7 +62,7 @@ module Wovnrb
|
|
|
62
62
|
converter = prepare_html_converter(html, ignore_class: [])
|
|
63
63
|
converted_html, = converter.build_api_compatible_html
|
|
64
64
|
|
|
65
|
-
expected_convert_html = "<html lang=\"en\"><head><script src=\"
|
|
65
|
+
expected_convert_html = "<html lang=\"en\"><head><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://my-site.com/\"><link rel=\"alternate\" hreflang=\"fr\" href=\"http://my-site.com/?wovn=fr\"><link rel=\"alternate\" hreflang=\"ja\" href=\"http://my-site.com/?wovn=ja\"><link rel=\"alternate\" hreflang=\"vi\" href=\"http://my-site.com/?wovn=vi\"></head><body><form action=\"/test\" method=\"POST\"><!-- __wovn-backend-ignored-key-0 --></form></body></html>"
|
|
66
66
|
assert_equal(expected_convert_html, converted_html)
|
|
67
67
|
end
|
|
68
68
|
|
|
@@ -81,7 +81,7 @@ module Wovnrb
|
|
|
81
81
|
|
|
82
82
|
expected_convert_html = [
|
|
83
83
|
'<html lang="en"><head>',
|
|
84
|
-
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
84
|
+
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><link rel=\"alternate\" hreflang=\"en\" href=\"http://my-site.com/\"><link rel=\"alternate\" hreflang=\"fr\" href=\"http://my-site.com/?wovn=fr\"><link rel=\"alternate\" hreflang=\"ja\" href=\"http://my-site.com/?wovn=ja\"><link rel=\"alternate\" hreflang=\"vi\" href=\"http://my-site.com/?wovn=vi\"></head><body>",
|
|
85
85
|
'<input id="user-id" type="hidden" value="__wovn-backend-ignored-key-0">',
|
|
86
86
|
'<input id="password" type="hidden" value="__wovn-backend-ignored-key-1">',
|
|
87
87
|
'<input id="something" type="hidden" value="__wovn-backend-ignored-key-2">',
|
|
@@ -95,7 +95,7 @@ module Wovnrb
|
|
|
95
95
|
converter = prepare_html_converter('<html><body><a>hello</a></body></html>', supported_langs: %w[en vi])
|
|
96
96
|
translated_html = converter.build
|
|
97
97
|
|
|
98
|
-
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
98
|
+
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><link rel=\"alternate\" hreflang=\"en\" href=\"http://my-site.com/\"><link rel=\"alternate\" hreflang=\"vi\" href=\"http://my-site.com/?wovn=vi\"></head><body><a>hello</a></body></html>"
|
|
99
99
|
assert_equal(expected_html, translated_html)
|
|
100
100
|
end
|
|
101
101
|
|
|
@@ -103,7 +103,7 @@ module Wovnrb
|
|
|
103
103
|
converter = prepare_html_converter('<html><body><a>hello</a></body></html>', supported_langs: [])
|
|
104
104
|
translated_html = converter.build
|
|
105
105
|
|
|
106
|
-
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
106
|
+
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script></head><body><a>hello</a></body></html>"
|
|
107
107
|
assert_equal(expected_html, translated_html)
|
|
108
108
|
end
|
|
109
109
|
|
|
@@ -111,7 +111,7 @@ module Wovnrb
|
|
|
111
111
|
converter = prepare_html_converter('<html><head><title>TITLE</title></head><body><a>hello</a></body></html>', supported_langs: %w[en vi])
|
|
112
112
|
translated_html = converter.build
|
|
113
113
|
|
|
114
|
-
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
114
|
+
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><title>TITLE</title><link rel=\"alternate\" hreflang=\"en\" href=\"http://my-site.com/\"><link rel=\"alternate\" hreflang=\"vi\" href=\"http://my-site.com/?wovn=vi\"></head><body><a>hello</a></body></html>"
|
|
115
115
|
assert_equal(expected_html, translated_html)
|
|
116
116
|
end
|
|
117
117
|
|
|
@@ -119,7 +119,7 @@ module Wovnrb
|
|
|
119
119
|
converter = prepare_html_converter('<html>hello<a>world</a></html>', supported_langs: [])
|
|
120
120
|
translated_html = converter.build
|
|
121
121
|
|
|
122
|
-
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
122
|
+
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script></head><body>hello<a>world</a></body></html>"
|
|
123
123
|
assert_equal(expected_html, translated_html)
|
|
124
124
|
end
|
|
125
125
|
|
|
@@ -134,7 +134,7 @@ module Wovnrb
|
|
|
134
134
|
converter = HtmlConverter.new(dom, store, headers)
|
|
135
135
|
translated_html = converter.build
|
|
136
136
|
|
|
137
|
-
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
137
|
+
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><link rel=\"alternate\" hreflang=\"en\" href=\"http://my-site.com/\"><link rel=\"alternate\" hreflang=\"ja\" href=\"http://my-site.com/?wovn=ja\"><link rel=\"alternate\" hreflang=\"vi\" href=\"http://my-site.com/?wovn=vi\"></head><body>hello<a>world</a></body></html>"
|
|
138
138
|
assert_equal(expected_html, translated_html)
|
|
139
139
|
end
|
|
140
140
|
|
|
@@ -149,7 +149,7 @@ module Wovnrb
|
|
|
149
149
|
converter = HtmlConverter.new(dom, store, headers)
|
|
150
150
|
translated_html = converter.build
|
|
151
151
|
|
|
152
|
-
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
152
|
+
expected_html = "<html lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=path&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><link rel=\"alternate\" hreflang=\"en\" href=\"http://my-site.com/\"><link rel=\"alternate\" hreflang=\"ja\" href=\"http://my-site.com/ja/\"><link rel=\"alternate\" hreflang=\"vi\" href=\"http://my-site.com/vi/\"></head><body>hello<a>world</a></body></html>"
|
|
153
153
|
assert_equal(expected_html, translated_html)
|
|
154
154
|
end
|
|
155
155
|
|
|
@@ -163,7 +163,7 @@ module Wovnrb
|
|
|
163
163
|
</head></html>')
|
|
164
164
|
converter.send(:replace_snippet)
|
|
165
165
|
|
|
166
|
-
expected_html = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
166
|
+
expected_html = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><script src=\"/a\"></script></head><body></body></html>"
|
|
167
167
|
assert_equal(expected_html.gsub(/\s+/, ''), converter.send(:html).gsub(/\s+/, ''))
|
|
168
168
|
end
|
|
169
169
|
|
data/test/lib/store_test.rb
CHANGED
|
@@ -126,15 +126,17 @@ module Wovnrb
|
|
|
126
126
|
assert_equal([], s.settings['ignore_globs'])
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
-
def
|
|
129
|
+
def test_widget_url_settings
|
|
130
130
|
store = Wovnrb::Store.instance
|
|
131
131
|
|
|
132
|
-
store.update_settings('
|
|
132
|
+
store.update_settings('widget_url' => nil)
|
|
133
|
+
assert_equal('https://j.wovn.io/1', store.widget_url)
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
assert_equal('
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
store.update_settings('widget_url' => 'https://j.wovn.io/1')
|
|
136
|
+
assert_equal('https://j.wovn.io/1', store.widget_url)
|
|
137
|
+
|
|
138
|
+
store.update_settings('widget_url' => 'http://j.dev-wovn.io:3000/1')
|
|
139
|
+
assert_equal('http://j.dev-wovn.io:3000/1', store.widget_url)
|
|
138
140
|
end
|
|
139
141
|
|
|
140
142
|
def test_dev_mode_not_overriding_settings
|
data/test/lib/wovnrb_test.rb
CHANGED
|
@@ -16,7 +16,7 @@ class WovnrbTest < Minitest::Test
|
|
|
16
16
|
|
|
17
17
|
expected_body = [
|
|
18
18
|
'<html lang="ja"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">',
|
|
19
|
-
"<script src=\"
|
|
19
|
+
"<script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script>",
|
|
20
20
|
'<link rel="alternate" hreflang="ja" href="http://ja.page.com/">',
|
|
21
21
|
'<link rel="alternate" hreflang="en" href="http://page.com/"></head>',
|
|
22
22
|
'<body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>',
|
|
@@ -40,7 +40,7 @@ class WovnrbTest < Minitest::Test
|
|
|
40
40
|
|
|
41
41
|
expected_body = [
|
|
42
42
|
'<html lang="ja"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">',
|
|
43
|
-
"<script src=\"
|
|
43
|
+
"<script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true¤tLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script>",
|
|
44
44
|
'<link rel="alternate" hreflang="ja" href="http://ja.page.com/">',
|
|
45
45
|
'<link rel="alternate" hreflang="en" href="http://page.com/"></head>',
|
|
46
46
|
'<body>',
|
|
@@ -66,7 +66,7 @@ class WovnrbTest < Minitest::Test
|
|
|
66
66
|
bodies = ['<html><body><h1>Mr. Belvedere Fan Club</h1>',
|
|
67
67
|
'<div><p>Hello</p></div>',
|
|
68
68
|
'</body></html>'].join
|
|
69
|
-
expected_bodies = ["<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
69
|
+
expected_bodies = ["<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=ja&defaultLang=en&urlPattern=subdomain&langCodeAliases={}&version=WOVN.rb_#{Wovnrb::VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head><body><h1>Mr. Belvedere Fan Club</h1><div><p>Hello</p></div></body></html>"].join
|
|
70
70
|
|
|
71
71
|
assert_switch_lang('en', 'ja', bodies, expected_bodies, api_expected: true)
|
|
72
72
|
end
|
|
@@ -83,7 +83,7 @@ class WovnrbTest < Minitest::Test
|
|
|
83
83
|
body = "<html><body><h1>Mr. Belvedere Fan Club</h1>
|
|
84
84
|
<div><p>Hello</p></div>
|
|
85
85
|
</body></html>"
|
|
86
|
-
expected_body = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"
|
|
86
|
+
expected_body = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script></head><body><h1>Mr. Belvedere Fan Club</h1>
|
|
87
87
|
<div><p>Hello</p></div>
|
|
88
88
|
</body></html>
|
|
89
89
|
"
|
data/wovnrb.gemspec
CHANGED
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.add_dependency 'activesupport'
|
|
24
24
|
spec.add_dependency 'addressable'
|
|
25
25
|
spec.add_dependency 'lz4-ruby'
|
|
26
|
-
spec.add_dependency 'nokogiri', '>= 1.8.1'
|
|
26
|
+
spec.add_dependency 'nokogiri', '>= 1.8.1', '<= 1.11'
|
|
27
27
|
spec.add_dependency 'nokogumbo', '>= 1.4.0', '< 2.0.0'
|
|
28
28
|
spec.add_dependency 'rack'
|
|
29
29
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wovnrb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wovn Technologies, Inc.
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -59,6 +59,9 @@ dependencies:
|
|
|
59
59
|
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: 1.8.1
|
|
62
|
+
- - "<="
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
version: '1.11'
|
|
62
65
|
type: :runtime
|
|
63
66
|
prerelease: false
|
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -66,6 +69,9 @@ dependencies:
|
|
|
66
69
|
- - ">="
|
|
67
70
|
- !ruby/object:Gem::Version
|
|
68
71
|
version: 1.8.1
|
|
72
|
+
- - "<="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '1.11'
|
|
69
75
|
- !ruby/object:Gem::Dependency
|
|
70
76
|
name: nokogumbo
|
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -546,7 +552,7 @@ homepage: https://wovn.io
|
|
|
546
552
|
licenses:
|
|
547
553
|
- MIT
|
|
548
554
|
metadata: {}
|
|
549
|
-
post_install_message:
|
|
555
|
+
post_install_message:
|
|
550
556
|
rdoc_options: []
|
|
551
557
|
require_paths:
|
|
552
558
|
- lib
|
|
@@ -562,7 +568,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
562
568
|
version: '0'
|
|
563
569
|
requirements: []
|
|
564
570
|
rubygems_version: 3.1.4
|
|
565
|
-
signing_key:
|
|
571
|
+
signing_key:
|
|
566
572
|
specification_version: 4
|
|
567
573
|
summary: Gem for WOVN.io
|
|
568
574
|
test_files:
|