charsi 0.1.2 → 0.1.3
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 +4 -4
- data/charsi.gemspec +1 -1
- data/lib/charsi/app.rb +7 -0
- data/lib/charsi/template.rb +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68bef40ef4cf1b6c65db0027a9df2ea6d788821d599aea4ee1682543fd11b38e
|
4
|
+
data.tar.gz: 9f3f4f5acda8d2bc23fab91591857cdc032099d12c32567f8519f91a4ac4e66f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f29a0ff3a07e0043db88b04a9de7d51dc8301b639249fad95a9a3855f9e18498d1a9a6790b5bd2d736daca1c7182ab34b3e9d8904ca5ad6af093b3509775a3b0
|
7
|
+
data.tar.gz: 545bf0905a06d7174e3373aaeb72ce82cf51399debc26f3c54068e6b5f3c746c865483801d52342b090e831a9615ff08a5cba704a46d72c9dbb5734f408782a4
|
data/charsi.gemspec
CHANGED
data/lib/charsi/app.rb
CHANGED
@@ -23,6 +23,13 @@ module Charsi
|
|
23
23
|
"<script src='assets/javascript/#{asset}?#{@cache_slug}'></script>"
|
24
24
|
end
|
25
25
|
|
26
|
+
def render_partial(partial_name, **locals)
|
27
|
+
partial_path = @config.path(:views_dir, "_#{partial_name}.erb")
|
28
|
+
template = Tilt::ERBTemplate.new(partial_path)
|
29
|
+
|
30
|
+
template.render(self, **locals)
|
31
|
+
end
|
32
|
+
|
26
33
|
private
|
27
34
|
|
28
35
|
def load_helpers
|
data/lib/charsi/template.rb
CHANGED
@@ -12,7 +12,9 @@ module Charsi
|
|
12
12
|
views_path = @config.path(:views_dir, '*.erb')
|
13
13
|
|
14
14
|
Dir.glob(views_path).each do |view|
|
15
|
-
|
15
|
+
next if File.basename(view).start_with?('_')
|
16
|
+
|
17
|
+
output_file = determine_output_filename(view)
|
16
18
|
output_path = @config.path(:output_dir, output_file)
|
17
19
|
|
18
20
|
processed_view = parse_erb_with_layout(view)
|
@@ -23,6 +25,14 @@ module Charsi
|
|
23
25
|
|
24
26
|
private
|
25
27
|
|
28
|
+
def determine_output_filename(view_path)
|
29
|
+
basename = File.basename(view_path, '.erb')
|
30
|
+
|
31
|
+
# If basename already has an extension, use it as-is
|
32
|
+
# otherwise, default to .htmli
|
33
|
+
basename.include?('.') ? basename : "#{basename}.html"
|
34
|
+
end
|
35
|
+
|
26
36
|
def parse_erb_with_layout(view_path, layout: 'default.erb')
|
27
37
|
layout_path = @config.path(:layout_dir, layout)
|
28
38
|
|