Gemsmith now accepts template: None

This commit is contained in:
Oliver Kennedy 2017-06-02 15:38:02 -04:00
parent 6fba7b0cc2
commit 9b1250fcf1
3 changed files with 16 additions and 10 deletions

View file

@ -195,14 +195,17 @@ module GemSmith
} }
apply { |f| apply { |f|
template = f.fetch(:template, default_template) template = f.fetch(:template){ f.fetch("template", default_template) }
f[:dependencies].push(template) p [template, f[:out_path], f.keys]
f[:stream].transform_all { |body| if template != "None"
b = binding() f[:dependencies].push(template)
f.each { |k,v| b.local_variable_set(k, v) } f[:stream].transform_all { |body|
$gemsmith[:now_rendering] = File.join(f[:rel_dir], File.basename(f[:out_path])) b = binding()
erb[template].result(b) f.each { |k,v| b.local_variable_set(k, v) }
} $gemsmith[:now_rendering] = File.join(f[:rel_dir], File.basename(f[:out_path]))
erb[template].result(b)
}
end
} }
end end

View file

@ -1,6 +1,6 @@
---- ---
template: None template: None
---- ---
This is a test. This is a test.

View file

@ -1,4 +1,7 @@
<%
name = if defined? name then name else "A Mysterious Stranger" end
%>
<div class="person"> <div class="person">
<% if defined? pic %> <% if defined? pic %>
<img class="photo" src="<%=pic%>" width="<%=pic_w%>" height="<%=pic_h%>" /> <img class="photo" src="<%=pic%>" width="<%=pic_w%>" height="<%=pic_h%>" />