howl 0.4.0 → 0.4.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.
- data/.gitignore +1 -0
- data/VERSION +1 -1
- data/howl.gemspec +6 -1
- data/lib/howl/template.rb +12 -5
- data/sample_site/Rakefile +9 -0
- data/sample_site/posts/first_post.md +4 -0
- data/sample_site/site/index.html +10 -0
- data/sample_site/templates/default.html +7 -0
- data/sample_site/templates/site.html +17 -0
- metadata +7 -2
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/howl.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{howl}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Clinton R. Nixon"]
|
@@ -36,6 +36,11 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/howl/site.rb",
|
37
37
|
"lib/howl/template.rb",
|
38
38
|
"lib/howl/view.rb",
|
39
|
+
"sample_site/Rakefile",
|
40
|
+
"sample_site/posts/first_post.md",
|
41
|
+
"sample_site/site/index.html",
|
42
|
+
"sample_site/templates/default.html",
|
43
|
+
"sample_site/templates/site.html",
|
39
44
|
"test/fixtures/posts/first_post.html",
|
40
45
|
"test/fixtures/posts/markdown_post.md",
|
41
46
|
"test/fixtures/posts/no_date.html",
|
data/lib/howl/template.rb
CHANGED
@@ -33,14 +33,15 @@ module Howl
|
|
33
33
|
def render(render_view = View.new)
|
34
34
|
render_view.merge!(@view)
|
35
35
|
rendered = converter.convert(Mustache.render(@content, render_view))
|
36
|
-
|
36
|
+
template_name = render_view.delete("template")
|
37
37
|
|
38
|
-
if
|
39
|
-
|
40
|
-
|
38
|
+
if template_name
|
39
|
+
template = find_template(template_name)
|
40
|
+
if template
|
41
|
+
rendered = template.render(
|
41
42
|
render_view.merge("content" => rendered))
|
42
43
|
else
|
43
|
-
puts "Warning: Template #{
|
44
|
+
puts "Warning: Template #{template_name} does not exist in file #{path}"
|
44
45
|
rendered
|
45
46
|
end
|
46
47
|
end
|
@@ -50,6 +51,12 @@ module Howl
|
|
50
51
|
|
51
52
|
private
|
52
53
|
|
54
|
+
def find_template(template_name)
|
55
|
+
@site.templates[template_name] ||
|
56
|
+
@site.templates[template_name + extension] ||
|
57
|
+
@site.templates[template_name + converter.extension]
|
58
|
+
end
|
59
|
+
|
53
60
|
def load_file
|
54
61
|
content = @path.read
|
55
62
|
view, content = content.split("\n\n", 2)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset=utf-8 />
|
5
|
+
<title>{{title}}</title>
|
6
|
+
<!--[if IE]>
|
7
|
+
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
8
|
+
<![endif]-->
|
9
|
+
<style>
|
10
|
+
article, aside, dialog, figure, footer, header,
|
11
|
+
hgroup, menu, nav, section { display: block; }
|
12
|
+
</style>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
{{& content}}
|
16
|
+
</body>
|
17
|
+
</html>
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 1
|
9
|
+
version: 0.4.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Clinton R. Nixon
|
@@ -125,6 +125,11 @@ files:
|
|
125
125
|
- lib/howl/site.rb
|
126
126
|
- lib/howl/template.rb
|
127
127
|
- lib/howl/view.rb
|
128
|
+
- sample_site/Rakefile
|
129
|
+
- sample_site/posts/first_post.md
|
130
|
+
- sample_site/site/index.html
|
131
|
+
- sample_site/templates/default.html
|
132
|
+
- sample_site/templates/site.html
|
128
133
|
- test/fixtures/posts/first_post.html
|
129
134
|
- test/fixtures/posts/markdown_post.md
|
130
135
|
- test/fixtures/posts/no_date.html
|