wovnrb 1.0.10 → 1.0.11
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/lib/wovnrb/lang.rb +1 -1
- data/lib/wovnrb/version.rb +1 -1
- data/test/lib/lang_test.rb +14 -50
- data/test/lib/wovnrb_test.rb +14 -85
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 274e9d1ea5626374cca8b50cca8f5d30af8a620d
|
|
4
|
+
data.tar.gz: 15b157e5a422abdb7d57c12f01c353669119177a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c26c9d1fbebf7e377bdb1a5b120746e7bcd2ff14375f19b60254fb7a369d222949e86f36573b291c804c209803c1d03b745ffbb93886fedf9244138afe121ab
|
|
7
|
+
data.tar.gz: 721a90f4191ea051d0b5c31263db0802f1640dadeaf9ac284f7bc4b6c35ece7047d13c52babcea5e5ffa60e204d237f82834360639b662f6fead5f3bdc551ca5
|
data/lib/wovnrb/lang.rb
CHANGED
|
@@ -180,7 +180,7 @@ module Wovnrb
|
|
|
180
180
|
# NOTE: when we use `#to_html` with nokogiri, nokogiri encode all href.
|
|
181
181
|
# but we want to keep original href as much as possible.
|
|
182
182
|
# That's why we replace href with original href which added lang info by wovnrb like this after we used `to_html`
|
|
183
|
-
dom.to_html.gsub(/href="([^"]*)"/) { |m| "href=\"#{index_href[$1] || $1}\"" }
|
|
183
|
+
dom.to_html(save_with: 0).gsub(/href="([^"]*)"/) { |m| "href=\"#{index_href[$1] || $1}\"" }
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
private
|
data/lib/wovnrb/version.rb
CHANGED
data/test/lib/lang_test.rb
CHANGED
|
@@ -342,45 +342,19 @@ module Wovnrb
|
|
|
342
342
|
<div><p>Hello</p></div>
|
|
343
343
|
</body></html>"
|
|
344
344
|
when "ignore_parent_translated_in_japanese"
|
|
345
|
-
body = "<html lang=\"ja\">
|
|
346
|
-
<head>
|
|
347
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
348
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.ignore-page.com/\">
|
|
349
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://ignore-page.com/\">
|
|
350
|
-
</head>
|
|
351
|
-
<body>
|
|
352
|
-
<h1>
|
|
353
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
345
|
+
body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.ignore-page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://ignore-page.com/\"></head><body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
354
346
|
<div wovn-ignore=\"\"><p>Hello</p></div>
|
|
355
|
-
</body>
|
|
356
|
-
</html>
|
|
347
|
+
</body></html>
|
|
357
348
|
"
|
|
358
349
|
when "translated_in_japanese"
|
|
359
|
-
body = "<html lang=\"ja\">
|
|
360
|
-
<head>
|
|
361
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
362
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\">
|
|
363
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\">
|
|
364
|
-
</head>
|
|
365
|
-
<body>
|
|
366
|
-
<h1>
|
|
367
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
350
|
+
body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head><body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
368
351
|
<div><p><!--wovn-src:Hello-->こんにちは</p></div>
|
|
369
|
-
</body>
|
|
370
|
-
</html>
|
|
352
|
+
</body></html>
|
|
371
353
|
"
|
|
372
354
|
when "ignore_everything_translated"
|
|
373
|
-
body = "<html lang=\"ja\">
|
|
374
|
-
<head>
|
|
375
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
376
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.ignore-page.com/\">
|
|
377
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://ignore-page.com/\">
|
|
378
|
-
</head>
|
|
379
|
-
<body wovn-ignore=\"\">
|
|
380
|
-
<h1>Mr. Belvedere Fan Club</h1>
|
|
355
|
+
body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.ignore-page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://ignore-page.com/\"></head><body wovn-ignore=\"\"><h1>Mr. Belvedere Fan Club</h1>
|
|
381
356
|
<div><p>Hello</p></div>
|
|
382
|
-
</body>
|
|
383
|
-
</html>
|
|
357
|
+
</body></html>
|
|
384
358
|
"
|
|
385
359
|
when "empty"
|
|
386
360
|
body = "<html><body><h1>Mr.BelvedereFanClub</h1><div wovn-ignore><p>Hello</p></div></body></html>"
|
|
@@ -393,18 +367,17 @@ module Wovnrb
|
|
|
393
367
|
when "value_double_quote"
|
|
394
368
|
body = "<html><body><h1>Mr.BelvedereFanClub</h1><div wovn-ignore=\"value\"><p>Hello</p></div></body></html>"
|
|
395
369
|
when "empty_translated"
|
|
396
|
-
body = "<html lang=\"ja\"
|
|
370
|
+
body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.ignore-page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://ignore-page.com/\"></head><body><h1>Mr.BelvedereFanClub</h1><div wovn-ignore=\"\"><p>Hello</p></div></body></html>\n"
|
|
397
371
|
when "empty_single_quote_translated"
|
|
398
|
-
body = "<html lang=\"ja\"
|
|
372
|
+
body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.ignore-page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://ignore-page.com/\"></head><body><h1>Mr.BelvedereFanClub</h1><div wovn-ignore=\"\"><p>Hello</p></div></body></html>\n"
|
|
399
373
|
when "empty_double_quote_translated"
|
|
400
|
-
body = "<html lang=\"ja\"
|
|
374
|
+
body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.ignore-page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://ignore-page.com/\"></head><body><h1>Mr.BelvedereFanClub</h1><div wovn-ignore=\"\"><p>Hello</p></div></body></html>\n"
|
|
401
375
|
when "value_single_quote_translated"
|
|
402
|
-
body = "<html lang=\"ja\"
|
|
376
|
+
body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.ignore-page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://ignore-page.com/\"></head><body><h1>Mr.BelvedereFanClub</h1><div wovn-ignore=\"value\"><p>Hello</p></div></body></html>\n"
|
|
403
377
|
when "value_double_quote_translated"
|
|
404
|
-
body = "<html lang=\"ja\"
|
|
378
|
+
body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.ignore-page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://ignore-page.com/\"></head><body><h1>Mr.BelvedereFanClub</h1><div wovn-ignore=\"value\"><p>Hello</p></div></body></html>\n"
|
|
405
379
|
when "meta_img_alt_tags_translated"
|
|
406
|
-
body = "<html lang=\"ja\"
|
|
407
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>\n<div><p><!--wovn-src:Hello-->こんにちは</p></div>\n<!--wovn-src:Hello--><img src=\"http://example.com/photo.png\" alt=\"こんにちは\">\n</body>\n</html>\n"
|
|
380
|
+
body = "<html lang=\"ja\"><head><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><meta name=\"description\" content=\"こんにちは\">\n<meta name=\"title\" content=\"こんにちは\">\n<meta property=\"og:title\" content=\"こんにちは\">\n<meta property=\"og:description\" content=\"こんにちは\">\n<meta property=\"twitter:title\" content=\"こんにちは\">\n<meta property=\"twitter:description\" content=\"こんにちは\"><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head>\n<body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>\n<div><p><!--wovn-src:Hello-->こんにちは</p></div>\n<!--wovn-src:Hello--><img src=\"http://example.com/photo.png\" alt=\"こんにちは\">\n</body></html>\n"
|
|
408
381
|
when "meta_img_alt_tags"
|
|
409
382
|
body = "<html><head><meta name =\"description\" content=\"Hello\">\n<meta name=\"title\" content=\"Hello\">\n<meta property=\"og:title\" content=\"Hello\">\n<meta property=\"og:description\" content=\"Hello\">\n<meta property=\"twitter:title\" content=\"Hello\">\n<meta property=\"twitter:description\" content=\"Hello\"></head>
|
|
410
383
|
<body><h1>Mr. Belvedere Fan Club</h1>
|
|
@@ -416,18 +389,9 @@ module Wovnrb
|
|
|
416
389
|
<div><p><a href=\"javascript:void(0)\">Hello</a></p></div>
|
|
417
390
|
</body></html>"
|
|
418
391
|
when "a_href_javascript_translated"
|
|
419
|
-
body = "<html lang=\"ja\">
|
|
420
|
-
<head>
|
|
421
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
422
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\">
|
|
423
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\">
|
|
424
|
-
</head>
|
|
425
|
-
<body>
|
|
426
|
-
<h1>
|
|
427
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
392
|
+
body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head><body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
428
393
|
<div><p><a href=\"javascript:void(0)\"><!--wovn-src:Hello-->こんにちは</a></p></div>
|
|
429
|
-
</body>
|
|
430
|
-
</html>
|
|
394
|
+
</body></html>
|
|
431
395
|
"
|
|
432
396
|
else # "" case
|
|
433
397
|
body = "<html><body><h1>Mr. Belvedere Fan Club</h1>
|
data/test/lib/wovnrb_test.rb
CHANGED
|
@@ -130,18 +130,9 @@ class WovnrbTest < Minitest::Test
|
|
|
130
130
|
url = h.url
|
|
131
131
|
swapped_body = i.switch_lang([body], values, url, 'ja', h)
|
|
132
132
|
|
|
133
|
-
expected_body = "<html lang=\"ja\">
|
|
134
|
-
<head>
|
|
135
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
136
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\">
|
|
137
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\">
|
|
138
|
-
</head>
|
|
139
|
-
<body>
|
|
140
|
-
<h1>
|
|
141
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
133
|
+
expected_body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head><body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
142
134
|
<div><p><!--wovn-src:Hello-->こんにちは</p></div>
|
|
143
|
-
</body>
|
|
144
|
-
</html>
|
|
135
|
+
</body></html>
|
|
145
136
|
"
|
|
146
137
|
assert_equal([expected_body], swapped_body)
|
|
147
138
|
end
|
|
@@ -156,18 +147,7 @@ class WovnrbTest < Minitest::Test
|
|
|
156
147
|
url = h.url
|
|
157
148
|
swapped_body = i.switch_lang(bodies, values, url, 'ja', h)
|
|
158
149
|
|
|
159
|
-
expected_body = "<html lang=\"ja\">
|
|
160
|
-
<head>
|
|
161
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
162
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\">
|
|
163
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\">
|
|
164
|
-
</head>
|
|
165
|
-
<body>
|
|
166
|
-
<h1>
|
|
167
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
168
|
-
<div><p><!--wovn-src:Hello-->こんにちは</p></div>
|
|
169
|
-
</body>
|
|
170
|
-
</html>
|
|
150
|
+
expected_body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head><body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1><div><p><!--wovn-src:Hello-->こんにちは</p></div></body></html>
|
|
171
151
|
"
|
|
172
152
|
assert_equal([expected_body], swapped_body)
|
|
173
153
|
end
|
|
@@ -253,19 +233,9 @@ HTML
|
|
|
253
233
|
url = h.url
|
|
254
234
|
swapped_body = i.switch_lang([body], values, url, 'ja', h)
|
|
255
235
|
|
|
256
|
-
expected_body = "<html lang=\"ja\">
|
|
257
|
-
<head>
|
|
258
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
259
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><noscript><div>test</div></noscript>
|
|
260
|
-
<link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\">
|
|
261
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\">
|
|
262
|
-
</head>
|
|
263
|
-
<body>
|
|
264
|
-
<h1>
|
|
265
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
236
|
+
expected_body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><noscript><div>test</div></noscript><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head><body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
266
237
|
<div><p><!--wovn-src:Hello-->こんにちは</p></div>
|
|
267
|
-
</body>
|
|
268
|
-
</html>
|
|
238
|
+
</body></html>
|
|
269
239
|
"
|
|
270
240
|
assert_equal([expected_body], swapped_body)
|
|
271
241
|
end
|
|
@@ -282,21 +252,11 @@ HTML
|
|
|
282
252
|
url = h.url
|
|
283
253
|
swapped_body = i.switch_lang([body], values, url, 'ja', h)
|
|
284
254
|
|
|
285
|
-
expected_body = "<html lang=\"ja\">
|
|
286
|
-
<head>
|
|
287
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
288
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><noscript>
|
|
255
|
+
expected_body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><noscript>
|
|
289
256
|
<div>test</div>
|
|
290
|
-
</noscript>
|
|
291
|
-
<link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\">
|
|
292
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\">
|
|
293
|
-
</head>
|
|
294
|
-
<body>
|
|
295
|
-
<h1>
|
|
296
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
257
|
+
</noscript><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head><body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
297
258
|
<div><p><!--wovn-src:Hello-->こんにちは</p></div>
|
|
298
|
-
</body>
|
|
299
|
-
</html>
|
|
259
|
+
</body></html>
|
|
300
260
|
"
|
|
301
261
|
assert_equal([expected_body], swapped_body)
|
|
302
262
|
end
|
|
@@ -311,21 +271,9 @@ HTML
|
|
|
311
271
|
url = h.url
|
|
312
272
|
swapped_body = i.switch_lang([body], values, url, 'ja', h)
|
|
313
273
|
|
|
314
|
-
expected_body = "<html lang=\"ja\">
|
|
315
|
-
<head>
|
|
316
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
317
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><noscript><div>test</div></noscript>
|
|
318
|
-
<title>plop</title>
|
|
319
|
-
<noscript><div>test2</div></noscript>
|
|
320
|
-
<link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\">
|
|
321
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\">
|
|
322
|
-
</head>
|
|
323
|
-
<body>
|
|
324
|
-
<h1>
|
|
325
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
274
|
+
expected_body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><noscript><div>test</div></noscript><title>plop</title><noscript><div>test2</div></noscript><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head><body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
326
275
|
<div><p><!--wovn-src:Hello-->こんにちは</p></div>
|
|
327
|
-
</body>
|
|
328
|
-
</html>
|
|
276
|
+
</body></html>
|
|
329
277
|
"
|
|
330
278
|
assert_equal([expected_body], swapped_body)
|
|
331
279
|
end
|
|
@@ -340,19 +288,9 @@ HTML
|
|
|
340
288
|
url = h.url
|
|
341
289
|
swapped_body = i.switch_lang([body], values, url, 'ja', h)
|
|
342
290
|
|
|
343
|
-
expected_body = "<html lang=\"ja\">
|
|
344
|
-
<head>
|
|
345
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
346
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><noscript><!-- --><div>test</div></noscript>
|
|
347
|
-
<link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\">
|
|
348
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\">
|
|
349
|
-
</head>
|
|
350
|
-
<body>
|
|
351
|
-
<h1>
|
|
352
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
291
|
+
expected_body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><noscript><!-- --><div>test</div></noscript><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head><body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
353
292
|
<div><p><!--wovn-src:Hello-->こんにちは</p></div>
|
|
354
|
-
</body>
|
|
355
|
-
</html>
|
|
293
|
+
</body></html>
|
|
356
294
|
"
|
|
357
295
|
assert_equal([expected_body], swapped_body)
|
|
358
296
|
end
|
|
@@ -367,18 +305,9 @@ HTML
|
|
|
367
305
|
url = h.url
|
|
368
306
|
swapped_body = i.switch_lang([body], values, url, 'ja', h)
|
|
369
307
|
|
|
370
|
-
expected_body = "<html lang=\"ja\">
|
|
371
|
-
<head>
|
|
372
|
-
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
|
|
373
|
-
<script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><!--<noscript><div>test</div></noscript>--><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\">
|
|
374
|
-
<link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\">
|
|
375
|
-
</head>
|
|
376
|
-
<body>
|
|
377
|
-
<h1>
|
|
378
|
-
<!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
308
|
+
expected_body = "<html lang=\"ja\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=&backend=true&currentLang=ja&defaultLang=en&urlPattern=path&langCodeAliases={}&version=#{Wovnrb::VERSION}\"> </script><!--<noscript><div>test</div></noscript>--><link rel=\"alternate\" hreflang=\"ja\" href=\"http://ja.page.com/\"><link rel=\"alternate\" hreflang=\"en\" href=\"http://page.com/\"></head><body><h1><!--wovn-src:Mr. Belvedere Fan Club-->ベルベデアさんファンクラブ</h1>
|
|
379
309
|
<div><p><!--wovn-src:Hello-->こんにちは</p></div>
|
|
380
|
-
</body>
|
|
381
|
-
</html>
|
|
310
|
+
</body></html>
|
|
382
311
|
"
|
|
383
312
|
assert_equal([expected_body], swapped_body)
|
|
384
313
|
end
|
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: 1.0.
|
|
4
|
+
version: 1.0.11
|
|
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: 2018-09-
|
|
12
|
+
date: 2018-09-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: nokogumbo
|