howl 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -22,3 +22,4 @@ pkg
22
22
 
23
23
  ## PROJECT::SPECIFIC
24
24
  test/fixtures/generated
25
+ sample_site/generated
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
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.0"
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
- template = render_view.delete("template")
36
+ template_name = render_view.delete("template")
37
37
 
38
- if template
39
- if @site.templates[template + @extension]
40
- rendered = @site.templates[template + @extension].render(
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 #{template + @extension} does not exist in file #{path}"
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,9 @@
1
+ require 'howl'
2
+
3
+ task :default => :generate
4
+
5
+ desc "Generate this site"
6
+ task :generate do
7
+ site = Howl::Site.new(File.dirname(__FILE__))
8
+ site.write_to_disk
9
+ end
@@ -0,0 +1,4 @@
1
+ template: default.html
2
+ title: First Post
3
+
4
+ Welcome to your Howl blog!
@@ -0,0 +1,10 @@
1
+ template: default.html
2
+
3
+ {{#posts}}
4
+ <article id="{{dom_id}}" class="post">
5
+ <h2 class="post-title"><a href="{{link}}">{{title}}</a></h2>
6
+ <div class="post-content">
7
+ {{& rendered_content}}
8
+ </div>
9
+ </article>
10
+ {{/posts}}
@@ -0,0 +1,7 @@
1
+ template: site.html
2
+
3
+ <h1>{{title}}</h1>
4
+
5
+ <section id="main">
6
+ {{& content}}
7
+ </section>
@@ -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
- - 0
9
- version: 0.4.0
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