jekyll-bookshop 1.2.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-bookshop.rb +59 -11
- data/lib/jekyll-bookshop/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7438b5eaba1bd9137c295b41adf21153a13240b692bc8403cf1748b58e8eb906
|
4
|
+
data.tar.gz: 7a1de85a107b7b52471423b3a52a4bfaa1a3a8bc73f243613c22a0ebe6c87e20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 777613006a9cc08d0d0ac04f6a4de05f04ebe9a923ee088b39bbef7b2e05fe1d603152140dd4b1efe5f46f651116118b2425794bd223422e83ce428b1e9a1b89
|
7
|
+
data.tar.gz: 2f55439d5dd80b57be876bb30b44e6a4d03d4f9f37d3333930f9776857e0087a736c9e18adf51787533e141b90732098a5bc02b0a50a3e536bf3a6db1f0556fe
|
data/lib/jekyll-bookshop.rb
CHANGED
@@ -3,26 +3,74 @@ 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(
|
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
|
13
|
+
end
|
14
|
+
|
15
|
+
# Support the bind syntax, spreading an object into params
|
16
|
+
def parse_params(context)
|
17
|
+
params = super
|
18
|
+
|
19
|
+
params.each do |key, value|
|
20
|
+
if key == 'bind'
|
21
|
+
valueHash = {}.merge(value)
|
22
|
+
params = valueHash.merge(params)
|
23
|
+
next
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
params.delete('bind')
|
28
|
+
|
29
|
+
params
|
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
|
16
58
|
end
|
17
59
|
end
|
18
60
|
|
19
61
|
class Styles
|
62
|
+
|
63
|
+
# Add the paths to find bookshop's styles
|
20
64
|
def self.open_bookshop(site)
|
21
|
-
|
22
|
-
site.
|
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
|
+
|
23
70
|
site.config['sass'] ||= {}
|
24
71
|
site.config['sass']['load_paths'] ||= []
|
25
|
-
site.config['sass']['load_paths'].push(Pathname.new(
|
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)
|
26
74
|
end
|
27
75
|
end
|
28
76
|
|
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
|
+
version: 1.7.0
|
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:
|
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: []
|