hydeweb 0.0.8.pre1 → 0.0.8.pre2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -5,6 +5,9 @@ v0.0.8
5
5
  - Implement Project#all.
6
6
  - Implement Page#all and Page#all(type).
7
7
  - Fix binary files losing extensions on 'hyde build'.
8
+ - Allow "layout: false" to ensure that a page doesn't have a layout.
9
+ - Fix bug where "index.html.haml" and "index.rss.haml" clash.
10
+ - Implement Page#content.
8
11
 
9
12
  v0.0.7
10
13
  ------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8.pre1
1
+ 0.0.8.pre2
data/hydeweb.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hydeweb}
8
- s.version = "0.0.8.pre1"
8
+ s.version = "0.0.8.pre2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rico Sta. Cruz", "Sinefunc, Inc."]
data/lib/hyde/meta.rb CHANGED
@@ -14,8 +14,10 @@ module Hyde
14
14
 
15
15
  def layout=(value)
16
16
  super value
17
- @page.layout = @page.project[value, :Layout]
18
- @page.layout.referrer = (page.referrer || page)
17
+ if value.is_a?(String)
18
+ @page.layout = @page.project[value, :Layout]
19
+ @page.layout.referrer = (page.referrer || page)
20
+ end
19
21
  end
20
22
  end
21
23
  end
data/lib/hyde/page.rb CHANGED
@@ -37,20 +37,23 @@ module Hyde
37
37
 
38
38
  # Returns the rendered output.
39
39
  def render(data = {}, &block)
40
- data = @meta | data
41
- data[:page] ||= self
42
- output = @renderer.render(data, &block)
43
- output = layout.render(data) { output } unless layout.nil?
40
+ output = content(data, &block)
41
+ output = layout.render(get_data(data)) { output } unless layout.nil?
44
42
  output
45
43
  end
46
44
 
45
+ # Returns the HTML content.
46
+ def content(data = {}, &block)
47
+ @renderer.render(get_data(data), &block)
48
+ end
49
+
47
50
  def layout=(val)
48
51
  @layout = val
49
52
  end
50
53
 
51
54
  def layout
52
55
  begin
53
- @layout ||= project[DEFAULT_LAYOUT, :Layout] if !@renderer.nil? and @renderer.layoutable?
56
+ @layout ||= project[DEFAULT_LAYOUT, :Layout] if !@renderer.nil? and @renderer.layoutable? and meta.layout != false
54
57
  @layout
55
58
  rescue NotFound
56
59
  nil
@@ -73,7 +76,7 @@ module Hyde
73
76
  if renderer.is_a?(Renderer::Passthru)
74
77
  '/' + @name
75
78
  else
76
- url = File.split(@name)
79
+ url = [ File.dirname(@name), File.basename(@filename) ]
77
80
  url[1] = File.basename(url[1], '.*')
78
81
  url[1] = (url[1] + @renderer.default_ext) unless url[1].include?('.')
79
82
  '/' + url.join('/')
@@ -193,5 +196,14 @@ module Hyde
193
196
  def self.get_filename(path, project)
194
197
  project.root(:site, path)
195
198
  end
199
+
200
+ private
201
+
202
+ # Data for rendering
203
+ def get_data(data)
204
+ data = @meta | data
205
+ data[:page] ||= self
206
+ data
207
+ end
196
208
  end
197
209
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydeweb
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1876988224
4
+ hash: -1876988223
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
9
  - 8
10
- - pre1
11
- version: 0.0.8.pre1
10
+ - pre2
11
+ version: 0.0.8.pre2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Rico Sta. Cruz