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|
template = f.fetch(:template, default_template)
f[:dependencies].push(template)
f[:stream].transform_all { |body|
b = binding()
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)
}
template = f.fetch(:template){ f.fetch("template", default_template) }
p [template, f[:out_path], f.keys]
if template != "None"
f[:dependencies].push(template)
f[:stream].transform_all { |body|
b = binding()
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

View file

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

View file

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