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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2cacf89713b13f50ad0ebe1ce862ad84fa7b88b5a71297c2dcfa5c5b44d6afe
4
- data.tar.gz: e460984bfa0c4e8b23f9ad13e838d17a0c1a03ea09894295619c9d4641cf5de2
3
+ metadata.gz: 68bef40ef4cf1b6c65db0027a9df2ea6d788821d599aea4ee1682543fd11b38e
4
+ data.tar.gz: 9f3f4f5acda8d2bc23fab91591857cdc032099d12c32567f8519f91a4ac4e66f
5
5
  SHA512:
6
- metadata.gz: baf2444f0cbff82668fe697e9fd1e655a177b55171c187a475931e628d500c2933686bc856072a9ab0bf12152eb1db05bd04774b27bdf15187866b0121a125a5
7
- data.tar.gz: '08bf088c251de38ada92c83f4eca065356262e44f9c9dc7575d0519536f880527cc7c445df3dc8caa25efef67302ba4b265c2d4c6c4285ecc04a7a4ddd012c02'
6
+ metadata.gz: f29a0ff3a07e0043db88b04a9de7d51dc8301b639249fad95a9a3855f9e18498d1a9a6790b5bd2d736daca1c7182ab34b3e9d8904ca5ad6af093b3509775a3b0
7
+ data.tar.gz: 545bf0905a06d7174e3373aaeb72ce82cf51399debc26f3c54068e6b5f3c746c865483801d52342b090e831a9615ff08a5cba704a46d72c9dbb5734f408782a4
data/charsi.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'charsi'
3
- spec.version = '0.1.2'
3
+ spec.version = '0.1.3'
4
4
 
5
5
  spec.authors = ['Ryan Beasse']
6
6
  spec.email = ['me@ryanbeasse.com']
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
@@ -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
- output_file = File.basename(view, '.erb') + '.html'
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: charsi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Beasse