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

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: cc712f2000dc4931c776e6fbef168ef393b1fb2ba921b1cd64e705b595cdc52e
4
- data.tar.gz: ebe71f39d3050a113cc7b2ef19d9ad609aee1a00e07dc44cfb85a0715cbbecbf
3
+ metadata.gz: 0e28c68c323e5e9597924dbe44e053e3503a8c9b2363683883506b192afb5432
4
+ data.tar.gz: cc8224160fa9a0f9f7a8caa2c04a9dd8d92a99aad4964be4bfd02f8c64452d48
5
5
  SHA512:
6
- metadata.gz: 13960804e5a7d64764cea2003ce44fcd6602bcfb83fb0e66a6e31fca89794cab59556003fed226cfff0375bc12d6584d4189a20198ba0ccc11778df1ea91743e
7
- data.tar.gz: 8b2fffd0251a89b37087d6c8b6c2614beab33bb72ae540786d400c0e38d7e4009d6c7f82a9721f902b3ddcc1d61bf1640a437fc523ddf018e28ef7b1fb98c381
6
+ metadata.gz: 2547c69b9c06e4904a1959ae7527ca928a35c7a386271cefae3be71bac8ad2518f88e58b6395aca4c6106c9d91b06501f24b0f94481514217b9f2061651047ff
7
+ data.tar.gz: 9775944ea75e4fe7300609867bd320bf015e1a2f22ed704f135b36056dcfd5f4b8e173e9851e8d007a4b18123b45c56eaa7c4e7cd31706289c03b81aae331725
@@ -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.6"
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.6"
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.6
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-05 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