jekyll-generator-single-source 0.0.3 → 0.0.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48cda7ea8aab0b172ac8a43d6e1f994d9dbf00cbba8489ad4d886d11c752675a
|
4
|
+
data.tar.gz: 1725101cef6faad0f034db3bb0c4f4feb427905f8bf1aac58510a279031ee997
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd24705318c18e46b31f632dff3577f94ec8e74a10c02895304df31d030ae67b70dd85d114101d24c908cbbe217c527bde70abf5d3f4706dc700f17f4eff68a6
|
7
|
+
data.tar.gz: 2a8aab8f8ca538c99287fcd936ef98f885a136da3a920f0f70bb608b6c06fd06fc5c6c70bd49be44125029f6248676176e5139c4a5db23e320ef0e84477905e0
|
@@ -4,7 +4,7 @@ module Jekyll
|
|
4
4
|
module GeneratorSingleSource
|
5
5
|
module Liquid
|
6
6
|
module Tags
|
7
|
-
class
|
7
|
+
class VersionIs < ::Liquid::Block
|
8
8
|
def initialize(tag_name, markup, tokens)
|
9
9
|
@tag = markup
|
10
10
|
|
@@ -25,19 +25,29 @@ module Jekyll
|
|
25
25
|
# If there's an exact match, check only that
|
26
26
|
if @params.key?(:eq)
|
27
27
|
version = to_version(@params[:eq])
|
28
|
-
|
28
|
+
if Gem::Version.correct?(current_version)
|
29
|
+
return '' unless current_version == version
|
30
|
+
else
|
31
|
+
return '' unless version > to_version(page['latest_released_version'])
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
# If there's a greater than or equal to check, fail if it's lower
|
32
36
|
if @params.key?(:gte)
|
33
37
|
version = to_version(@params[:gte])
|
34
|
-
|
38
|
+
if Gem::Version.correct?(current_version)
|
39
|
+
return '' unless current_version >= version
|
40
|
+
end
|
35
41
|
end
|
36
42
|
|
37
43
|
# If there's a less than or equal to heck, fail if it's higher
|
38
44
|
if @params.key?(:lte)
|
39
45
|
version = to_version(@params[:lte])
|
40
|
-
|
46
|
+
if Gem::Version.correct?(current_version)
|
47
|
+
return '' unless current_version <= version
|
48
|
+
else
|
49
|
+
return '' unless version > to_version(page['latest_released_version'])
|
50
|
+
end
|
41
51
|
end
|
42
52
|
|
43
53
|
# Table rows (starts newline then |, ends with | then newline) need
|
@@ -60,7 +70,11 @@ module Jekyll
|
|
60
70
|
end
|
61
71
|
|
62
72
|
def to_version(input)
|
63
|
-
Gem::Version.
|
73
|
+
if Gem::Version.correct?(input)
|
74
|
+
Gem::Version.new(input.gsub(/\.x$/, '.0'))
|
75
|
+
else
|
76
|
+
input
|
77
|
+
end
|
64
78
|
end
|
65
79
|
end
|
66
80
|
end
|
@@ -26,7 +26,6 @@ module Jekyll
|
|
26
26
|
@data['edit_link'] = nav_item.source.file_path
|
27
27
|
|
28
28
|
# Make it clear that this content comes from a generated file
|
29
|
-
@data['path'] = "GENERATED:nav=#{nav_item.nav}:src=#{nav_item.source.file_path}:#{@dir}"
|
30
29
|
@data['is_dir_index'] = nav_item.source.dir?
|
31
30
|
|
32
31
|
# Set the current release and concrete version
|
@@ -37,30 +36,38 @@ module Jekyll
|
|
37
36
|
# Set the layout if it's not already provided
|
38
37
|
@data['layout'] ||= GeneratorConfig.new(@site).layout
|
39
38
|
|
39
|
+
# Apply any overrides
|
40
|
+
current = to_version(@data['release'])
|
41
|
+
@data['overrides']&.each do |key, entries|
|
42
|
+
entries.each do |value, conditions|
|
43
|
+
gte = conditions['gte'] ? to_version(conditions['gte']) : nil
|
44
|
+
lte = conditions['lte'] ? to_version(conditions['lte']) : nil
|
45
|
+
eq = conditions['eq'] ? to_version(conditions['eq']) : nil
|
40
46
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
47
|
+
if gte && lte
|
48
|
+
@data[key] = value if current >= gte && current <= lte
|
49
|
+
elsif gte
|
50
|
+
@data[key] = value if current >= gte
|
51
|
+
elsif lte
|
52
|
+
@data[key] = value if current <= lte
|
53
|
+
elsif eq
|
54
|
+
@data[key] = value if current == eq
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
48
58
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
@data[key] = value if current <= lte
|
55
|
-
elsif eq
|
56
|
-
@data[key] = value if current == eq
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
59
|
+
# Needed so that regeneration works for single sourced pages
|
60
|
+
# It must be set to the source file
|
61
|
+
# Also, @path MUST NOT be set, it falls back to @relative_path
|
62
|
+
@relative_path = nav_item.source.file_path
|
63
|
+
end
|
61
64
|
|
62
65
|
def to_version(input)
|
63
|
-
Gem::Version.
|
66
|
+
if Gem::Version.correct?(input)
|
67
|
+
Gem::Version.new(input.gsub(/\.x$/, '.0'))
|
68
|
+
else
|
69
|
+
input
|
70
|
+
end
|
64
71
|
end
|
65
72
|
end
|
66
73
|
end
|
@@ -4,7 +4,7 @@ module Jekyll
|
|
4
4
|
module GeneratorSingleSource
|
5
5
|
module Source
|
6
6
|
class Base
|
7
|
-
PATH = '
|
7
|
+
PATH = '_src'
|
8
8
|
|
9
9
|
def self.make_for(path:, site:)
|
10
10
|
# Normalize path
|
@@ -13,7 +13,7 @@ module Jekyll
|
|
13
13
|
path.delete_prefix('/').delete_suffix('/')
|
14
14
|
)
|
15
15
|
|
16
|
-
src_dir = File.expand_path(
|
16
|
+
src_dir = File.expand_path(site.source)
|
17
17
|
|
18
18
|
# Read the source file, either `<src>.md or <src>/index.md`
|
19
19
|
if File.exist?(File.join(src_dir, "#{file_path}.md"))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-generator-single-source
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabian Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '13.0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '13.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|