dimples 10.1.1 → 10.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dimples/sources/base.rb +9 -4
- data/lib/dimples/sources/page.rb +1 -1
- data/lib/dimples/sources/post.rb +5 -1
- data/lib/dimples/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4cb30bd078959510f0f81a130d22689cf34eba48ea90361806c9b046214e447
|
4
|
+
data.tar.gz: d24ddeeabc388b164fb82151ea13b9ae50cb7ecf1888d700bcccec9a56ec8ea1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f41a59f95690d77f5cb5836e558b15c39696bacd214966b43ca66d7c45f57f8fafe4267e320b17420c414a432dabb992d39fddf7403d0fe5ad185ab9a72a8b24
|
7
|
+
data.tar.gz: 06b9420670c7863edf252586cd589a3f37a9f6b2649ea858a5839436e3b324bad692505dd8678fef0d5f40833a92bf0db2e60b973322149036cc996681ee30d6
|
data/lib/dimples/sources/base.rb
CHANGED
@@ -16,6 +16,7 @@ module Dimples
|
|
16
16
|
@contents = File.read(@path)
|
17
17
|
|
18
18
|
parse_metadata(@contents)
|
19
|
+
assign_metadata
|
19
20
|
end
|
20
21
|
|
21
22
|
def parse_metadata(contents)
|
@@ -24,18 +25,22 @@ module Dimples
|
|
24
25
|
|
25
26
|
@metadata.merge!(YAML.safe_load(matches[1], symbolize_names: true, permitted_classes: [Date]))
|
26
27
|
@contents = matches.post_match.strip
|
28
|
+
end
|
27
29
|
|
30
|
+
def assign_metadata
|
28
31
|
@metadata.each_key do |key|
|
29
32
|
self.class.send(:define_method, key.to_sym) { @metadata[key] }
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
33
36
|
def write(output_path = nil, metadata = {})
|
34
|
-
output = render(metadata)
|
35
|
-
|
36
37
|
output_path = File.join(output_directory, filename) if output_path.nil?
|
37
38
|
output_dir = File.dirname(output_path)
|
38
39
|
|
40
|
+
@metadata[:url] = url_for(output_dir)
|
41
|
+
|
42
|
+
output = render(metadata)
|
43
|
+
|
39
44
|
FileUtils.mkdir_p(output_dir) unless File.directory?(output_dir)
|
40
45
|
File.write(output_path, output)
|
41
46
|
end
|
@@ -54,8 +59,8 @@ module Dimples
|
|
54
59
|
@site.config[:output][:root]
|
55
60
|
end
|
56
61
|
|
57
|
-
def
|
58
|
-
|
62
|
+
def url_for(path)
|
63
|
+
path.gsub(@site.config[:output][:root], '').concat('/')
|
59
64
|
end
|
60
65
|
|
61
66
|
def template
|
data/lib/dimples/sources/page.rb
CHANGED
data/lib/dimples/sources/post.rb
CHANGED
@@ -8,7 +8,11 @@ module Dimples
|
|
8
8
|
@output_directory ||= File.dirname(@path).gsub(
|
9
9
|
@site.config[:sources][:posts],
|
10
10
|
@site.config[:output][:posts]
|
11
|
-
).concat("/#{
|
11
|
+
).concat("/#{slug}/")
|
12
|
+
end
|
13
|
+
|
14
|
+
def slug
|
15
|
+
File.basename(@path)
|
12
16
|
end
|
13
17
|
|
14
18
|
def template
|
data/lib/dimples/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dimples
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.1.
|
4
|
+
version: 10.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Bogan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erb
|
@@ -76,7 +76,7 @@ licenses:
|
|
76
76
|
- MIT
|
77
77
|
metadata:
|
78
78
|
rubygems_mfa_required: 'true'
|
79
|
-
post_install_message:
|
79
|
+
post_install_message:
|
80
80
|
rdoc_options: []
|
81
81
|
require_paths:
|
82
82
|
- lib
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubygems_version: 3.4.10
|
95
|
-
signing_key:
|
95
|
+
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: A basic static site generator
|
98
98
|
test_files: []
|