jekyll-bookshop 1.4.1 → 1.7.1

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: e313ba5779530305aa65dcf712685b2b3e8584024dab3a56feeda1d7c641e4a5
4
- data.tar.gz: fd2a7c028ee738263c88bf8613606a032c77a1a41ad10b93824e2a7577216d6b
3
+ metadata.gz: 06aef8587a63ae477f2cbdca62841ca136714f1208336fc0d3b4f201eee52053
4
+ data.tar.gz: ede4a69fe2b96f8a5417490556dc95c9880251809abe5bb81c68adfb750d2363
5
5
  SHA512:
6
- metadata.gz: 41585c83a653c024ce3370362e83c2bebf82a9e3d4d6022dc51ee383de656ab185679b590af6c0bdc3fcd18e3bb4077298d36ff94d95b05f2c3a3cd9c36726e3
7
- data.tar.gz: 0d40c7a79045a87511754aec81abba7f9b53321767eba7975d5696dc2198d99923985e2d6fa061e456aaaff0a5f690ec1bed3296a0692c549fd52b22572bfbac
6
+ metadata.gz: 338ba1b82ae814a268fb7e8cb437a2df507debfa479b2efb8ae1a76e013ca5cba035c53c9246b84505f4b534cd7b7e35e10c71e478a0757310dc848b3e6a232f
7
+ data.tar.gz: 0c2b53f7d5e2127531926da39bf611f74b6a5004ee2b8200466c2f16407a191762172b2d5e880d235b96dee784b791bba18a03cf3b658c7d320e5bfa4a5696b1
@@ -3,18 +3,16 @@ require 'pathname'
3
3
 
4
4
  module JekyllBookshop
5
5
  class Tag < Jekyll::Tags::IncludeTag
6
- def initialize(tag_name, markup, tokens)
7
- cpath = markup.strip.partition(" ").first
8
- cname = cpath.strip.split("/").last
9
- tag = markup.strip.partition(" ").last
10
- markup = "#{cpath}/#{cname}.jekyll.html #{tag}"
11
- super
12
- end
13
6
 
7
+ # Look for includes in the built bookshop directory
14
8
  def tag_includes_dirs(context)
15
- Array(Pathname.new(context['site']['bookshop_path'] + '/components').cleanpath.to_s).freeze
9
+ Array([
10
+ Pathname.new(context['site']['bookshop_theme_path'] + '/components').cleanpath.to_s,
11
+ Pathname.new(context['site']['bookshop_site_path'] + '/components').cleanpath.to_s
12
+ ]).freeze
16
13
  end
17
14
 
15
+ # Support the bind syntax, spreading an object into params
18
16
  def parse_params(context)
19
17
  params = super
20
18
 
@@ -26,17 +24,53 @@ module JekyllBookshop
26
24
  end
27
25
  end
28
26
 
27
+ params.delete('bind')
28
+
29
29
  params
30
30
  end
31
+
32
+ # Map component names to the .jekyll.html files found in bookshop
33
+ def render(context)
34
+ site = context.registers[:site]
35
+
36
+ file = render_variable(context) || @file
37
+ cname = file.strip.split("/").last
38
+ file = "#{file}/#{cname}.jekyll.html"
39
+ validate_file_name(file)
40
+
41
+ path = locate_include_file(context, file, site.safe)
42
+ return unless path
43
+
44
+ add_include_to_dependency(site, path, context)
45
+
46
+ partial = load_cached_partial(path, context)
47
+
48
+ context.stack do
49
+ context["include"] = parse_params(context) if @params
50
+ begin
51
+ partial.render!(context)
52
+ rescue Liquid::Error => e
53
+ e.template_name = path
54
+ e.markup_context = "included " if e.markup_context.nil?
55
+ raise e
56
+ end
57
+ end
58
+ end
31
59
  end
32
60
 
33
61
  class Styles
62
+
63
+ # Add the paths to find bookshop's styles
34
64
  def self.open_bookshop(site)
35
- bookshop_path = site.theme.root + '/_bookshop'
36
- site.config['bookshop_path'] = Pathname.new(bookshop_path).cleanpath.to_s
65
+ bookshop_theme_path = (site.theme ? site.theme.root : site.source) + '/_bookshop'
66
+ bookshop_site_path = site.source + '/_bookshop'
67
+ site.config['bookshop_theme_path'] = Pathname.new(bookshop_theme_path).cleanpath.to_s
68
+ site.config['bookshop_site_path'] = Pathname.new(bookshop_site_path).cleanpath.to_s
69
+
37
70
  site.config['sass'] ||= {}
38
71
  site.config['sass']['load_paths'] ||= []
39
- site.config['sass']['load_paths'].push(Pathname.new(bookshop_path + '/sass').cleanpath.to_s)
72
+ site.config['sass']['load_paths'].push(Pathname.new(bookshop_theme_path + '/sass').cleanpath.to_s)
73
+ site.config['sass']['load_paths'].push(Pathname.new(bookshop_site_path + '/sass').cleanpath.to_s)
40
74
  end
41
75
  end
42
76
 
@@ -1,3 +1,3 @@
1
1
  module JekyllBookshop
2
- VERSION = "1.4.1"
2
+ VERSION = "1.7.1"
3
3
  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: 1.4.1
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liam Bigelow
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-03 00:00:00.000000000 Z
11
+ date: 2021-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -30,7 +30,7 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.0'
33
- description:
33
+ description:
34
34
  email:
35
35
  - liam@cloudcannon.com
36
36
  executables: []
@@ -43,7 +43,7 @@ homepage: https://github.com/cloudcannon/bookshop
43
43
  licenses:
44
44
  - MIT
45
45
  metadata: {}
46
- post_install_message:
46
+ post_install_message:
47
47
  rdoc_options: []
48
48
  require_paths:
49
49
  - lib
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  version: '0'
60
60
  requirements: []
61
61
  rubygems_version: 3.0.3
62
- signing_key:
62
+ signing_key:
63
63
  specification_version: 4
64
64
  summary: A Jekyll plugin to load components from bookshop
65
65
  test_files: []