dimples 11.1.0 → 11.2.0

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: 460c9cb2f4d18fb2857e20558f9c376934d3e24bace8be2854bf9b4f0367ea7b
4
- data.tar.gz: 26192c3c2a912ca0dc7a66f61e6881e1fc8cfa8103322c1780620e1453e49078
3
+ metadata.gz: 53b0d98c918f5d4860900213f9797177cc07a801464911856127d8f3bb4e6ac0
4
+ data.tar.gz: c48d064da98832cfda7d8a878929dcfa1914e584521bc9cd2eab62f2c9245012
5
5
  SHA512:
6
- metadata.gz: c0f4473b95bb948c8b58733a53cfdcaf995c66804a93a632f7cf4bfbad6f66b38b4ed179a5fd520b9bcbbb6b08aad2f4f3c4f4f7e6584634801ff3ba42631f94
7
- data.tar.gz: bd3ce7b193fccabf55425531d388afc4bc049969512d0c674a5411d0a8e9ce942dd518ed3d2c9c743de0ad083417caac973f05b52bd796f3d87052d284fefd50
6
+ metadata.gz: 99fe1fdcdd089fa248708aace30b3593ca4935e344206bc37118e20c8421992fe0acf8c10c0b32a713c1b71533b2612f59fd1b089491fa2a5fe4dfb57a4b7abf
7
+ data.tar.gz: 1d0a41b232f0f6caacaba68ed9ec39013e40a75812564c6391f7b2120f6cc2556b329cc774cdf6816ac9ac0b1df89059ae8229ca592a5bbd21211fd4991b54d9
data/lib/dimples/post.rb CHANGED
@@ -9,6 +9,8 @@ module Dimples
9
9
  attr_reader :markdown
10
10
  end
11
11
 
12
+ attr_reader :rendered_contents
13
+
12
14
  def initialize(path:)
13
15
  super(source: Pathname.new(path))
14
16
  end
data/lib/dimples/site.rb CHANGED
@@ -145,16 +145,19 @@ module Dimples
145
145
  end
146
146
 
147
147
  context = { page: Context.from_hash(entry.metadata.merge(context)), site: self }
148
- body = entry.contents
149
148
  full_path = File.join(output_path, entry.filename)
150
149
 
151
- until entry.nil?
152
- body = entry.render(context: context) { body }
153
- entry = templates[entry.layout&.to_sym]
154
- end
155
-
156
150
  FileUtils.mkdir_p(output_path) unless File.directory?(output_path)
157
- File.write(full_path, body)
151
+ File.write(full_path, render_entry(entry: entry, context: context, body: entry.contents))
152
+ end
153
+
154
+ def render_entry(entry:, context: {}, body: nil)
155
+ rendered_body = entry.render(context: context) { body }.strip
156
+
157
+ template = templates[entry.layout&.to_sym]
158
+ return rendered_body if template.nil?
159
+
160
+ render_entry(entry: template, context:, body: rendered_body)
158
161
  end
159
162
 
160
163
  def prepare_output_directory
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dimples
4
- VERSION = '11.1.0'
4
+ VERSION = '11.2.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimples
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.1.0
4
+ version: 11.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan