gryphon 1.0.0 → 1.0.1

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: aec8dfc0ffa76193cd8528f8375b6eea622aed8499d3b340945f38a1dce1bb31
4
- data.tar.gz: 030fbf23c1515be0a8a207184c5f574bf8cc2d2a4574e7f92d239be6271437ac
3
+ metadata.gz: 6677aa017915ce15f99611f557914898ff049a6dbe5f1270ed6b7275176dcc7d
4
+ data.tar.gz: 867d225f62915e3da24f3e802650da288d325380cf3a32102bc9ee449ff4f0cc
5
5
  SHA512:
6
- metadata.gz: 6b30add9bae44b30943a4bdb0ad03da9c95c09edc80b1f8881c0fb728de6cec3efd3f911094356eff0b2a3c060d4ba5c64e84709fa0d1ec7f62b61003303bf4d
7
- data.tar.gz: 7083d7c2b16b3d0b19a074dc8adc954e4b7329b3b9787dc751362c8c10a3af1a7d51d06d0aac59c5ad6b91b192be31ed2bb650058145bace57e5ebdd5e2a87eb
6
+ metadata.gz: 524b871958bf1ac83366aee8ff6e354256153b837a2eeb02fbe443da8c51a85149962f517b088c7149928748f58a9dbbb18119b8059f5a64d885bde068ec866c
7
+ data.tar.gz: cb62f13ddf2df3f278b4b7c199900e88ab1c33892eb1672b4cb0c1189b4a68188b07b75bfe96189df3aa77c3b06bb3f1a2f9bb34b3f4b43c5adda52607bb6fd3
@@ -53,11 +53,13 @@ module Gryphon
53
53
  # @return [String]
54
54
  # @raise [Errors::ParseError]
55
55
  def build_output(file)
56
+ docs = parse_file(file)
56
57
  content =
57
58
  if @layout_file.exist?
58
- @renderer.render(@layout_file.content, { yield: file.basename(TEMPLATE_EXT) })
59
+ docs[0][:yield] = docs[1]
60
+ @renderer.render(@layout_file.content, docs[0])
59
61
  else
60
- @renderer.render_file(file)
62
+ @renderer.render(docs[1], docs[0])
61
63
  end
62
64
 
63
65
  HtmlBeautifier.beautify(content, stop_on_errors: true)
@@ -73,6 +75,17 @@ module Gryphon
73
75
  path.dirname.mkpath
74
76
  path.write(content)
75
77
  end
78
+
79
+ # @param file [Pathname]
80
+ # @return [Array]
81
+ # @raise [Psych::SyntaxError]
82
+ def parse_file(file)
83
+ docs = YAML.safe_load_stream(File.read(file), filename: file)
84
+
85
+ docs = [{}, docs[0]] unless docs[1]
86
+
87
+ docs
88
+ end
76
89
  end
77
90
  end
78
91
  end
@@ -9,16 +9,8 @@ module Gryphon
9
9
  class MustacheRenderer < Mustache
10
10
  # @param _name [String]
11
11
  # @return [String]
12
- # @raise [Psych::SyntaxError]
13
12
  def partial(_name)
14
- name = context[:yield]
15
- path = "#{template_path}/#{name}.#{template_extension}"
16
- docs = YAML.safe_load_stream(File.read(path), filename: name)
17
- content = docs[1] || docs[0]
18
-
19
- context.push(docs[0]) unless docs[1].nil?
20
-
21
- content
13
+ context[:yield]
22
14
  end
23
15
  end
24
16
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gryphon
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gryphon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Birmingham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-08 00:00:00.000000000 Z
11
+ date: 2026-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlbeautifier