jekyll-bookshop 2.0.0.pre.beta.13 → 2.0.0.pre.beta.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37713b30ec48cf491643c29b4f999deaeacc96f5ba8876500f2be837f221fafa
4
- data.tar.gz: bdfdec45378ebfee332148a5fc6b3a45521ad1b69069c38cc588317fc6555f0c
3
+ metadata.gz: 34f967a604fa914abeedd316ebb4e73836dcfe4b99797b066beca60bdbdd18ec
4
+ data.tar.gz: c32c7510908ceb67c61c5677b1262bd55430f1bb20b1cfaaefbd725ceda62d89
5
5
  SHA512:
6
- metadata.gz: 691c27313e8a12a9287d6783c8fc5b24c5b2019a1b0099031b65a39a83863269cbbcfdd501fb4f0418bfee921a0d3590a3924587986969377ab9b5cfcf17747c
7
- data.tar.gz: b59b9da8e1867a21920e1891bcffa638e69b557bb570224f3057accab10f4573f7ccd57de0d9e74f9e831af6bebf2e2d7f747f2a85fe7215e48eef0fcee70cc9
6
+ metadata.gz: 567bc589f7b0f737d56301723a36dd4d8e0d6e6794f8a44f254393f2d1bcebc0799868fc2a8ec7448aba8270ca6968967894e4ff90e2ff6455a115b1b399939c
7
+ data.tar.gz: 20910536649f1cc6eff27da753cd34f26e12bac2c98d41bdb16eecb41aa0a40e3a216caa8be0752b8fdf73ba0f86121109b60aef8b7520b47f4a211d3f995a3e
@@ -46,7 +46,7 @@ module JekyllBookshop
46
46
 
47
47
  page.output = page.output.gsub(
48
48
  %r!bookshop_browser_site_data = null!,
49
- "bookshop_browser_site_data = #{@site.data["_bookshop_site_data"].to_json}"
49
+ "bookshop_browser_site_data = #{@site.data["_bookshop_site_data"].to_json.gsub(%r!</script!i, "<\\/script")}"
50
50
  )
51
51
  end
52
52
  @site.data["_bookshop_data_pages"] = nil
@@ -7,9 +7,26 @@ module JekyllBookshop
7
7
  @host = markup.strip
8
8
  end
9
9
 
10
+ def self.transformHostString(host)
11
+ case
12
+ when host =~ %r!^:\d+$!
13
+ "http://localhost#{host}/bookshop.js"
14
+ when host =~ %r!^\d+$!
15
+ "http://localhost:#{host}/bookshop.js"
16
+ when host =~ %r!^localhost:\d+$!
17
+ "http://#{host}/bookshop.js"
18
+ when host =~ %r!^/!
19
+ host
20
+ else
21
+ "//#{host}"
22
+ end
23
+ end
24
+
10
25
  def render(context)
11
26
  return unless @host
12
27
 
28
+ host = BrowserTag.transformHostString(@host)
29
+
13
30
  site = context.registers[:site]
14
31
  page = context.registers[:page]
15
32
 
@@ -20,7 +37,7 @@ module JekyllBookshop
20
37
 
21
38
  "<div data-bookshop-browser></div>
22
39
  <script>window.bookshop_browser_site_data = null;</script>
23
- <script src=\"//#{@host}\"></script>
40
+ <script src=\"#{host}\"></script>
24
41
  <script>
25
42
  window.BookshopBrowser = new window.BookshopBrowserClass({
26
43
  globals: [window.bookshop_browser_site_data]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllBookshop
4
- VERSION = "2.0.0.pre.beta.13"
4
+ VERSION = "2.0.0.pre.beta.17"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-bookshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.beta.13
4
+ version: 2.0.0.pre.beta.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - CloudCannon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-05 00:00:00.000000000 Z
11
+ date: 2021-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll