dimples 10.1.1 → 10.1.2

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: 1851462f5263625c3180103f3be8e6484246bdd21609a401ab779f26d489cfc7
4
- data.tar.gz: 5b2312987fd9ceb6c78f8be7152445bf25161fd4e16f6bf9a1e055b9b21d5502
3
+ metadata.gz: 3b53c9172b38c343af3d3dbb59e6afad5ae83b69dc67fd8ac3ac54235f1b84dc
4
+ data.tar.gz: 1fe366c13c8c0c78229c24c5fc8077a356688232b9c5753ca017c94ee0d04d63
5
5
  SHA512:
6
- metadata.gz: 92451497846e5d3724a09d98ea88e9eec50f96b282061cf96fcb17be39bc180bad42d2e9994077545bd70b3f4ba68a8d11fee2d29cd66f2b812c82a8673c1811
7
- data.tar.gz: a23cc742b62eed3ace4b40bb38002c392c5be58525177f4d159e3f983ad15ccbda1331e5cf9080841f1295b604cb09d361b215c647bd09040deb7c23f017eb47
6
+ metadata.gz: 035ac6bfdd3cb492b1959767405a7e0f17502226fa0df2795563b929a03a5c83221600ae33932aac7135553f9a730a5a44832652886a5b26a4ee50568556c748
7
+ data.tar.gz: 41c5bfabcce91caf99ef62ed3c92b5dbf8f338538c424d8d5e1ef087ac31e8f574f41cf0931862d75e2cf32d24f66300315ca3d6db1a4d633af82df61d91ee7c
@@ -31,11 +31,13 @@ module Dimples
31
31
  end
32
32
 
33
33
  def write(output_path = nil, metadata = {})
34
- output = render(metadata)
35
-
36
34
  output_path = File.join(output_directory, filename) if output_path.nil?
37
35
  output_dir = File.dirname(output_path)
38
36
 
37
+ @metadata[:url] = url_for(output_dir)
38
+
39
+ output = render(metadata)
40
+
39
41
  FileUtils.mkdir_p(output_dir) unless File.directory?(output_dir)
40
42
  File.write(output_path, output)
41
43
  end
@@ -54,8 +56,8 @@ module Dimples
54
56
  @site.config[:output][:root]
55
57
  end
56
58
 
57
- def url
58
- @metadata[:url] || output_directory.gsub(@site.config[:output][:root], '')
59
+ def url_for(path)
60
+ path.gsub(@site.config[:output][:root], '').concat('/')
59
61
  end
60
62
 
61
63
  def template
@@ -12,7 +12,7 @@ module Dimples
12
12
  end
13
13
 
14
14
  def url
15
- @metadata[:url] || super.tap do |url|
15
+ super.tap do |url|
16
16
  url.concat(filename) unless filename == 'index.html'
17
17
  end
18
18
  end
@@ -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("/#{@metadata[:slug]}/")
11
+ ).concat("/#{slug}/")
12
+ end
13
+
14
+ def slug
15
+ File.basename(@path)
12
16
  end
13
17
 
14
18
  def template
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dimples
4
- VERSION = '10.1.1'
4
+ VERSION = '10.1.2'
5
5
  end
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.1
4
+ version: 10.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-04 00:00:00.000000000 Z
11
+ date: 2024-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erb