jekyll-bookshop 3.0.0.pre.beta.3 → 3.0.0.pre.beta.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc712f2000dc4931c776e6fbef168ef393b1fb2ba921b1cd64e705b595cdc52e
4
- data.tar.gz: ebe71f39d3050a113cc7b2ef19d9ad609aee1a00e07dc44cfb85a0715cbbecbf
3
+ metadata.gz: f5f0dd99fdd2b70261dab2b6c48817cfe82220682142ae74f469a12bc2e7e25e
4
+ data.tar.gz: af1c898fbff0a3c4e338f870afeabaf2ab0da16ded31711dc2d2fa3fbda3f7a8
5
5
  SHA512:
6
- metadata.gz: 13960804e5a7d64764cea2003ce44fcd6602bcfb83fb0e66a6e31fca89794cab59556003fed226cfff0375bc12d6584d4189a20198ba0ccc11778df1ea91743e
7
- data.tar.gz: 8b2fffd0251a89b37087d6c8b6c2614beab33bb72ae540786d400c0e38d7e4009d6c7f82a9721f902b3ddcc1d61bf1640a437fc523ddf018e28ef7b1fb98c381
6
+ metadata.gz: efb9ca10b9053e242c290053b67e859fbbb627eb837a7bf0d86df5493b99c2fdac3c8fd8cdf54cc28e05c88e220bd33897a20d7fab33f99b7609ca9f88dcee79
7
+ data.tar.gz: 596d11e3931a95a68c9f618f813d76fa79becd346ed89255820d9bf8ee0a3b02d78b726442515188c71ffe029102fbb99956436bd9a5649ac5eec90f1d2481cf
@@ -39,7 +39,7 @@ 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
- version = "3.0.0-beta.3"
42
+ version = "3.0.0-beta.4"
43
43
  meta_comment = context["__bookshop__nested"] ? "" : "<!--bookshop-live meta(version=\"#{version}\" baseurl=\"#{site.baseurl}\" title=\"#{site.config["title"]&.gsub('"', '\"') || ""}\") -->\n"
44
44
 
45
45
  context.stack do
@@ -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.3"
4
+ VERSION = "3.0.0.pre.beta.4"
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.3
4
+ version: 3.0.0.pre.beta.4
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-01 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