jekyll-bookshop 3.0.0.pre.beta.2 → 3.0.0.pre.beta.5

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: 10d3c10fd8d62669f5590934ad3bc7dc6d94d3d652fda6f833dbd3c9ab2b4e01
4
- data.tar.gz: 324be137b13530152aca2b61185b3d36eb66183d9db3eefe3b86437788604932
3
+ metadata.gz: 7c6f125193d622db11ffd2b5afa55db2181c7364271d38cd65a878fe52ba0b5c
4
+ data.tar.gz: 47159d0b495951a4ca170a5b86ee5721c5a34818e409ca4a43a1521029b64949
5
5
  SHA512:
6
- metadata.gz: a1c0047a975986839561a2450139abca77ec2f8a13983f23d59144579bf2cdab1aed8a3cf7fe942399b3f63ddd1e4b51c7729f2dca2857b4594a3c2cc40a847e
7
- data.tar.gz: 2ef4673878fcb593b077644cd10461ec0698b6a659eb8ebd2fa56ad95063d4b8cf812a58730abbc53b1a6c4f5526e33dad479bd64c81d0f5cb5d738a091b4d5b
6
+ metadata.gz: 7ba1aa7384cdb90427ed42b0e2b888da11d57dba4f7622e65882bf5038e4dd2434a51822ae811a592a6975e84f0345857a31ed3d0aa9a840a28fdf5d93daa10d
7
+ data.tar.gz: e56f5eae3e4fe55f2095233d4383ef29d7d4dc87bedf81a6197f47925a45d0210efb747543f8ddff17f503b164476dff5f929d85a18effcae291b26cc4678b78
@@ -39,7 +39,8 @@ module JekyllBookshop
39
39
 
40
40
  # If this component is not a subcomponent,
41
41
  # we also drop in some site metadata here so that it can be used in the render.
42
- meta_comment = context["__bookshop__nested"] ? "" : "<!--bookshop-live meta(version=\"#{JekyllBookshop::VERSION.gsub(".pre.", "-")}\" baseurl=\"#{site.baseurl}\" title=\"#{site.config["title"]&.gsub('"', '\"') || ""}\") -->\n"
42
+ version = "3.0.0-beta.5"
43
+ meta_comment = context["__bookshop__nested"] ? "" : "<!--bookshop-live meta(version=\"#{version}\" baseurl=\"#{site.baseurl}\" title=\"#{site.config["title"]&.gsub('"', '\"') || ""}\") -->\n"
43
44
 
44
45
  context.stack do
45
46
  context["include"] = parse_params(context) if @params
@@ -7,37 +7,11 @@ 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!^/|https?://!
19
- host
20
- else
21
- "//#{host}"
22
- end
23
- end
24
-
25
10
  def render(context)
26
- return unless @host
27
-
28
- host = BrowserTag.transformHostString(@host)
29
-
30
- site = context.registers[:site]
31
- page = context.registers[:page]
32
-
33
- "<div data-bookshop-browser></div>
34
- <script src=\"#{host}\"></script>
35
- <script>
36
- window.bookshopBrowser = new window.BookshopBrowser({
37
- globals: []
38
- });
39
- window.bookshopBrowser.render();
40
- </script>"
11
+ STDERR.puts "The {% bookshop_browser #{@host} %} tag has been replaced in Bookshop 3.0"
12
+ STDERR.puts "Replace this tag with {% bookshop_component_browser %}"
13
+ STDERR.puts "Note: The port argument is no longer needed, nor are any environment checks"
14
+ exit 1
41
15
  end
42
16
  end
43
17
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module JekyllBookshop
4
+ class ComponentBrowserTag < Liquid::Tag
5
+ def initialize(tag_name, markup, tokens)
6
+ super
7
+ @port = markup.strip
8
+ end
9
+
10
+ def render(context)
11
+ local_port = 30775;
12
+
13
+ if @port.length > 0
14
+ is_int = Integer(@port) rescue false
15
+ unless is_int
16
+ STDERR.puts "bookshop_component_browser expected either no argument, or an integer for the local port number used when running @bookshop/browser."
17
+ exit 1
18
+ end
19
+ local_port = @port
20
+ end
21
+
22
+ "<div data-bookshop-browser=\"\"></div>
23
+ <script src=\"http://localhost:#{ local_port }/bookshop.js\"></script>
24
+ <script>
25
+ window.bookshopBrowser = new window.BookshopBrowser({globals: []});
26
+ window.bookshopBrowser.render();
27
+ </script>"
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllBookshop
4
- VERSION = "3.0.0.pre.beta.2"
4
+ VERSION = "3.0.0.pre.beta.5"
5
5
  end
@@ -8,6 +8,7 @@ require_relative "jekyll-bookshop/tags/bookshop-common-tag"
8
8
  require_relative "jekyll-bookshop/tags/bookshop-include-tag"
9
9
  require_relative "jekyll-bookshop/tags/bookshop-tag"
10
10
  require_relative "jekyll-bookshop/tags/browser-tag"
11
+ require_relative "jekyll-bookshop/tags/component-browser-tag"
11
12
  require_relative "jekyll-bookshop/tags/style-tag"
12
13
  require_relative "jekyll-bookshop/opener"
13
14
 
@@ -15,6 +16,7 @@ Liquid::Template.register_tag("bookshop", JekyllBookshop::Tag)
15
16
  Liquid::Template.register_tag("bookshop_include", JekyllBookshop::IncludeTag)
16
17
  Liquid::Template.register_tag("bookshop_scss", JekyllBookshop::StyleTag)
17
18
  Liquid::Template.register_tag("bookshop_browser", JekyllBookshop::BrowserTag)
19
+ Liquid::Template.register_tag("bookshop_component_browser", JekyllBookshop::ComponentBrowserTag)
18
20
 
19
21
  Jekyll::Hooks.register :site, :after_init do |site|
20
22
  JekyllBookshop::Opener.open_bookshop(site)
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: 3.0.0.pre.beta.2
4
+ version: 3.0.0.pre.beta.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - CloudCannon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-28 00:00:00.000000000 Z
11
+ date: 2022-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -91,6 +91,7 @@ files:
91
91
  - lib/jekyll-bookshop/tags/bookshop-include-tag.rb
92
92
  - lib/jekyll-bookshop/tags/bookshop-tag.rb
93
93
  - lib/jekyll-bookshop/tags/browser-tag.rb
94
+ - lib/jekyll-bookshop/tags/component-browser-tag.rb
94
95
  - lib/jekyll-bookshop/tags/style-tag.rb
95
96
  - lib/jekyll-bookshop/version.rb
96
97
  homepage: https://github.com/cloudcannon/bookshop