brite 0.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.rdoc +30 -0
- data/LICENSE +199 -17
- data/README.rdoc +61 -0
- data/Syckfile +76 -0
- data/bin/brite +3 -3
- data/bin/brite-server +4 -0
- data/lib/brite.rb +11 -0
- data/lib/brite/command.rb +53 -56
- data/lib/brite/config.rb +94 -18
- data/lib/brite/controller.rb +181 -0
- data/lib/brite/layout.rb +24 -19
- data/lib/brite/meta/data.rb +26 -0
- data/lib/brite/meta/package +8 -0
- data/lib/brite/meta/profile +19 -0
- data/lib/brite/models/model.rb +97 -0
- data/lib/brite/models/page.rb +142 -0
- data/lib/brite/models/post.rb +9 -0
- data/lib/brite/models/site.rb +46 -0
- data/lib/brite/rackup.rb +6 -0
- data/lib/brite/server.rb +144 -0
- data/lib/plugins/sow/brite/awesome/Sowfile +11 -0
- data/lib/plugins/sow/brite/awesome/about.page +28 -0
- data/lib/plugins/sow/brite/awesome/assets/custom.less +96 -0
- data/lib/plugins/sow/brite/awesome/assets/fade.png +0 -0
- data/lib/plugins/sow/brite/awesome/assets/highlight.css +96 -0
- data/lib/plugins/sow/brite/awesome/assets/highlight.js +1 -0
- data/lib/plugins/sow/brite/awesome/assets/jquery.js +19 -0
- data/lib/plugins/sow/brite/awesome/assets/jquery.tabs.js +1 -0
- data/lib/plugins/sow/brite/awesome/assets/reset.css +57 -0
- data/lib/plugins/sow/brite/awesome/assets/ruby.png +0 -0
- data/lib/plugins/sow/brite/awesome/brite.yaml +3 -0
- data/lib/plugins/sow/brite/awesome/history.page +15 -0
- data/lib/plugins/sow/brite/awesome/index.page +18 -0
- data/lib/plugins/sow/brite/awesome/legal.page +28 -0
- data/lib/plugins/sow/brite/awesome/logs.page +14 -0
- data/lib/plugins/sow/brite/awesome/page.layout +75 -0
- data/lib/plugins/sow/brite/blog1/.rsync-filter +12 -0
- data/lib/plugins/sow/brite/blog1/2011/01/sample.html +293 -0
- data/lib/plugins/sow/brite/blog1/2011/01/sample.post +44 -0
- data/lib/plugins/sow/brite/blog1/Sowfile +10 -0
- data/lib/plugins/sow/brite/blog1/assets/images/bg.jpg +0 -0
- data/lib/plugins/sow/brite/blog1/assets/images/icon.jpg +0 -0
- data/lib/plugins/sow/brite/blog1/assets/styles/class.css +15 -0
- data/lib/plugins/sow/brite/blog1/assets/styles/id.css +85 -0
- data/lib/plugins/sow/brite/blog1/assets/styles/misc.css +0 -0
- data/lib/plugins/sow/brite/blog1/assets/styles/print.css +76 -0
- data/lib/plugins/sow/brite/blog1/assets/styles/reset.css +77 -0
- data/lib/plugins/sow/brite/blog1/assets/styles/tag.css +68 -0
- data/lib/plugins/sow/brite/blog1/brite.yml +3 -0
- data/lib/plugins/sow/brite/blog1/index.page +23 -0
- data/lib/plugins/sow/brite/blog1/page.layout +88 -0
- data/lib/plugins/sow/brite/blog1/post.layout +25 -0
- data/meta/data.rb +26 -0
- data/meta/package +8 -0
- data/meta/profile +19 -0
- metadata +86 -47
- data/HISTORY +0 -16
- data/MANIFEST +0 -28
- data/README +0 -42
- data/lib/brite/page.rb +0 -235
- data/lib/brite/part.rb +0 -31
- data/lib/brite/post.rb +0 -37
- data/lib/brite/site.rb +0 -137
- data/lib/brite/template.rb +0 -215
- data/meta/authors +0 -1
- data/meta/contact +0 -1
- data/meta/copyright +0 -1
- data/meta/description +0 -4
- data/meta/homepage +0 -1
- data/meta/license +0 -1
- data/meta/name +0 -1
- data/meta/repository +0 -1
- data/meta/requires +0 -1
- data/meta/ruby +0 -2
- data/meta/subtitle +0 -1
- data/meta/suite +0 -1
- data/meta/summary +0 -1
- data/meta/title +0 -1
- data/meta/version +0 -1
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
stencil: liquid
|
3
|
+
layout: page
|
4
|
+
|
5
|
+
--- html
|
6
|
+
|
7
|
+
<div class="page">
|
8
|
+
|
9
|
+
<h1>{{ page.title }}</h1>
|
10
|
+
|
11
|
+
{{ content }}
|
12
|
+
|
13
|
+
<small>Written by {{ page.author }}, {{ page.date | date_to_string }}</small>
|
14
|
+
|
15
|
+
<ul class="posts">
|
16
|
+
{% assign p = page.previous %}{% if p %}
|
17
|
+
<li><span>Previous: {{ p.date | date_to_string }}</span> » <a href="{{ p.url }}">{{ p.title }}</a></li>
|
18
|
+
{% endif %}
|
19
|
+
{% assign p = page.next %}{% if p %}
|
20
|
+
<li><span> Next: {{ p.date | date_to_string }}</span> » <a href="{{ p.url }}">{{ p.title }}</a></li>
|
21
|
+
{% endif %}
|
22
|
+
</ul>
|
23
|
+
|
24
|
+
</div>
|
25
|
+
|
data/meta/data.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Brite
|
2
|
+
|
3
|
+
def self.package
|
4
|
+
@package ||= (
|
5
|
+
require 'yaml'
|
6
|
+
YAML.load(File.new(File.dirname(__FILE__) + '/package'))
|
7
|
+
)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.profile
|
11
|
+
@profile ||= (
|
12
|
+
require 'yaml'
|
13
|
+
YAML.load(File.new(File.dirname(__FILE__) + '/profile'))
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.const_missing(name)
|
18
|
+
key = name.to_s.downcase
|
19
|
+
package[key] || profile[key] || super(name)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
# becuase Ruby 1.8~ gets in the way
|
25
|
+
Object.__send__(:remove_const, :VERSION) if Object.const_defined?(:VERSION)
|
26
|
+
|
data/meta/package
ADDED
data/meta/profile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
title : Brite
|
3
|
+
subtitle : Light Up Your Site
|
4
|
+
summary : Super Simple Static Site Generation
|
5
|
+
copyright: Copyright (c) 2006,2009 Thomas Sawyer
|
6
|
+
license : Apache v2.0
|
7
|
+
suite : proutils
|
8
|
+
contact : http://googlegroups.com/group/proutils
|
9
|
+
authors : Thomas Sawyer
|
10
|
+
|
11
|
+
description:
|
12
|
+
Brite is a remarkably easy to use, light-weight website
|
13
|
+
generator. It supports a variety of backend rendering engines
|
14
|
+
including rhtml via eruby, textile via redcloth, markdown
|
15
|
+
via rdiscount, with others on the way.
|
16
|
+
|
17
|
+
resources:
|
18
|
+
homepage: http://proutils.github.com/brite
|
19
|
+
repository: git://github.com/proutils/brite.git
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 7
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 0.6.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Thomas Sawyer
|
@@ -9,91 +15,124 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-11-12 00:00:00 -05:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
name: neapolitan
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
hash: 19
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 3
|
33
|
+
- 0
|
34
|
+
version: 0.3.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Brite is a remarkably easy to use, light-weight website generator. It supports a variety of backend rendering engines including rhtml via eruby, textile via redcloth, markdown via rdiscount, with others on the way.
|
38
|
+
email: ""
|
31
39
|
executables:
|
40
|
+
- brite-server
|
32
41
|
- brite
|
33
42
|
extensions: []
|
34
43
|
|
35
44
|
extra_rdoc_files:
|
36
|
-
- README
|
37
|
-
- MANIFEST
|
38
|
-
- LICENSE
|
39
|
-
- HISTORY
|
45
|
+
- README.rdoc
|
40
46
|
files:
|
41
47
|
- bin/brite
|
48
|
+
- bin/brite-server
|
42
49
|
- lib/brite/command.rb
|
43
50
|
- lib/brite/config.rb
|
51
|
+
- lib/brite/controller.rb
|
44
52
|
- lib/brite/layout.rb
|
45
|
-
- lib/brite/
|
46
|
-
- lib/brite/
|
47
|
-
- lib/brite/
|
48
|
-
- lib/brite/
|
49
|
-
- lib/brite/
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
53
|
+
- lib/brite/meta/data.rb
|
54
|
+
- lib/brite/meta/package
|
55
|
+
- lib/brite/meta/profile
|
56
|
+
- lib/brite/models/model.rb
|
57
|
+
- lib/brite/models/page.rb
|
58
|
+
- lib/brite/models/post.rb
|
59
|
+
- lib/brite/models/site.rb
|
60
|
+
- lib/brite/rackup.rb
|
61
|
+
- lib/brite/server.rb
|
62
|
+
- lib/brite.rb
|
63
|
+
- lib/plugins/sow/brite/awesome/Sowfile
|
64
|
+
- lib/plugins/sow/brite/awesome/about.page
|
65
|
+
- lib/plugins/sow/brite/awesome/assets/custom.less
|
66
|
+
- lib/plugins/sow/brite/awesome/assets/fade.png
|
67
|
+
- lib/plugins/sow/brite/awesome/assets/highlight.css
|
68
|
+
- lib/plugins/sow/brite/awesome/assets/highlight.js
|
69
|
+
- lib/plugins/sow/brite/awesome/assets/jquery.js
|
70
|
+
- lib/plugins/sow/brite/awesome/assets/jquery.tabs.js
|
71
|
+
- lib/plugins/sow/brite/awesome/assets/reset.css
|
72
|
+
- lib/plugins/sow/brite/awesome/assets/ruby.png
|
73
|
+
- lib/plugins/sow/brite/awesome/brite.yaml
|
74
|
+
- lib/plugins/sow/brite/awesome/history.page
|
75
|
+
- lib/plugins/sow/brite/awesome/index.page
|
76
|
+
- lib/plugins/sow/brite/awesome/legal.page
|
77
|
+
- lib/plugins/sow/brite/awesome/logs.page
|
78
|
+
- lib/plugins/sow/brite/awesome/page.layout
|
79
|
+
- lib/plugins/sow/brite/blog1/.rsync-filter
|
80
|
+
- lib/plugins/sow/brite/blog1/2011/01/sample.html
|
81
|
+
- lib/plugins/sow/brite/blog1/2011/01/sample.post
|
82
|
+
- lib/plugins/sow/brite/blog1/Sowfile
|
83
|
+
- lib/plugins/sow/brite/blog1/assets/images/bg.jpg
|
84
|
+
- lib/plugins/sow/brite/blog1/assets/images/icon.jpg
|
85
|
+
- lib/plugins/sow/brite/blog1/assets/styles/class.css
|
86
|
+
- lib/plugins/sow/brite/blog1/assets/styles/id.css
|
87
|
+
- lib/plugins/sow/brite/blog1/assets/styles/misc.css
|
88
|
+
- lib/plugins/sow/brite/blog1/assets/styles/print.css
|
89
|
+
- lib/plugins/sow/brite/blog1/assets/styles/reset.css
|
90
|
+
- lib/plugins/sow/brite/blog1/assets/styles/tag.css
|
91
|
+
- lib/plugins/sow/brite/blog1/brite.yml
|
92
|
+
- lib/plugins/sow/brite/blog1/index.page
|
93
|
+
- lib/plugins/sow/brite/blog1/page.layout
|
94
|
+
- lib/plugins/sow/brite/blog1/post.layout
|
95
|
+
- meta/data.rb
|
96
|
+
- meta/package
|
97
|
+
- meta/profile
|
98
|
+
- HISTORY.rdoc
|
65
99
|
- LICENSE
|
66
|
-
- README
|
67
|
-
-
|
68
|
-
- MANIFEST
|
100
|
+
- README.rdoc
|
101
|
+
- Syckfile
|
69
102
|
has_rdoc: true
|
70
103
|
homepage: http://proutils.github.com/brite
|
71
|
-
licenses:
|
72
|
-
|
104
|
+
licenses:
|
105
|
+
- Apache v2.0
|
73
106
|
post_install_message:
|
74
107
|
rdoc_options:
|
75
108
|
- --title
|
76
109
|
- Brite API
|
77
110
|
- --main
|
78
|
-
- README
|
111
|
+
- README.rdoc
|
79
112
|
require_paths:
|
80
113
|
- lib
|
81
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
82
116
|
requirements:
|
83
117
|
- - ">="
|
84
118
|
- !ruby/object:Gem::Version
|
119
|
+
hash: 3
|
120
|
+
segments:
|
121
|
+
- 0
|
85
122
|
version: "0"
|
86
|
-
version:
|
87
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
88
125
|
requirements:
|
89
126
|
- - ">="
|
90
127
|
- !ruby/object:Gem::Version
|
128
|
+
hash: 3
|
129
|
+
segments:
|
130
|
+
- 0
|
91
131
|
version: "0"
|
92
|
-
version:
|
93
132
|
requirements: []
|
94
133
|
|
95
134
|
rubyforge_project: brite
|
96
|
-
rubygems_version: 1.3.
|
135
|
+
rubygems_version: 1.3.7
|
97
136
|
signing_key:
|
98
137
|
specification_version: 3
|
99
138
|
summary: Super Simple Static Site Generation
|
data/HISTORY
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
= RELEASE HISTORY
|
2
|
-
|
3
|
-
== 0.5 / 2008-10-25
|
4
|
-
|
5
|
-
Brite (formerly Webrite) has been completely rewritten from the ground-up,
|
6
|
-
applying a number of ideas gathered from other systems and adding further
|
7
|
-
innovations. This is still an early release, and in need of features
|
8
|
-
and overt tire-kicking, but hey I'm already using to generate a pretty
|
9
|
-
damn nice looking site.
|
10
|
-
|
11
|
-
Changes:
|
12
|
-
|
13
|
-
* 1 Monumentously Important Enhancment
|
14
|
-
|
15
|
-
* Happy Rebirthday!
|
16
|
-
|
data/MANIFEST
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
#!mast bin lib meta test [A-Z]*
|
2
|
-
bin/brite
|
3
|
-
lib/brite/command.rb
|
4
|
-
lib/brite/config.rb
|
5
|
-
lib/brite/layout.rb
|
6
|
-
lib/brite/page.rb
|
7
|
-
lib/brite/part.rb
|
8
|
-
lib/brite/post.rb
|
9
|
-
lib/brite/site.rb
|
10
|
-
lib/brite/template.rb
|
11
|
-
meta/authors
|
12
|
-
meta/contact
|
13
|
-
meta/copyright
|
14
|
-
meta/description
|
15
|
-
meta/homepage
|
16
|
-
meta/license
|
17
|
-
meta/name
|
18
|
-
meta/repository
|
19
|
-
meta/requires
|
20
|
-
meta/ruby
|
21
|
-
meta/subtitle
|
22
|
-
meta/suite
|
23
|
-
meta/summary
|
24
|
-
meta/title
|
25
|
-
meta/version
|
26
|
-
LICENSE
|
27
|
-
README
|
28
|
-
HISTORY
|
data/README
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
= Brite
|
2
|
-
|
3
|
-
(The BrightLite of Static Website Generators)
|
4
|
-
|
5
|
-
* home: http://proutils.github.com/brite
|
6
|
-
* source: http://github.com/proutils/brite
|
7
|
-
|
8
|
-
|
9
|
-
== DESCRIPTION
|
10
|
-
|
11
|
-
Brite is an inovative static website/blog generation utility
|
12
|
-
which is extremely easy to use as it is versitle.
|
13
|
-
|
14
|
-
== FEATURES/ISSUES
|
15
|
-
|
16
|
-
* Awesome
|
17
|
-
* Extra Cool
|
18
|
-
* And Dyn-o-mite!
|
19
|
-
|
20
|
-
|
21
|
-
== SYNOPSIS
|
22
|
-
|
23
|
-
For now please see the Brite website and API documentation.
|
24
|
-
|
25
|
-
|
26
|
-
== HOW TO INSTALL
|
27
|
-
|
28
|
-
You know the routine ;)
|
29
|
-
|
30
|
-
$ sudop gem install brite
|
31
|
-
|
32
|
-
If you're old fashion and want to install to a site
|
33
|
-
location, see Setup.rb (http://protuils.github.com/setup).
|
34
|
-
|
35
|
-
|
36
|
-
== COPYRIGHT/LICENSE
|
37
|
-
|
38
|
-
Brite is Copyright (c) 2009 Thomas Sawyer
|
39
|
-
|
40
|
-
It is distributed under the terms of the MIT license.
|
41
|
-
|
42
|
-
|
data/lib/brite/page.rb
DELETED
@@ -1,235 +0,0 @@
|
|
1
|
-
require 'brite/part'
|
2
|
-
|
3
|
-
module Brite
|
4
|
-
|
5
|
-
# Page class
|
6
|
-
class Page
|
7
|
-
|
8
|
-
attr :file
|
9
|
-
|
10
|
-
# Template type (rhtml or liquid)
|
11
|
-
attr :stencil
|
12
|
-
|
13
|
-
# Layout name (relative filename less extension)
|
14
|
-
attr :layout
|
15
|
-
|
16
|
-
# Author
|
17
|
-
attr :author
|
18
|
-
|
19
|
-
# Title of page/post
|
20
|
-
attr :title
|
21
|
-
|
22
|
-
# Publish date
|
23
|
-
attr :date
|
24
|
-
|
25
|
-
# Tags (labels)
|
26
|
-
attr :tags
|
27
|
-
|
28
|
-
# Category ("a glorified tag")
|
29
|
-
attr :category
|
30
|
-
|
31
|
-
# rendered output text
|
32
|
-
attr :content
|
33
|
-
|
34
|
-
# output extension (defualt is 'html')
|
35
|
-
attr :extension
|
36
|
-
|
37
|
-
#
|
38
|
-
def initialize(site, file)
|
39
|
-
@site = site
|
40
|
-
@file = file
|
41
|
-
@parts = []
|
42
|
-
parse
|
43
|
-
end
|
44
|
-
|
45
|
-
def name
|
46
|
-
@name ||= file.chomp(File.extname(file))
|
47
|
-
end
|
48
|
-
|
49
|
-
#
|
50
|
-
def url
|
51
|
-
@url ||= name + extension
|
52
|
-
end
|
53
|
-
|
54
|
-
#
|
55
|
-
def extension
|
56
|
-
@extension ||= '.html'
|
57
|
-
end
|
58
|
-
|
59
|
-
#
|
60
|
-
def root
|
61
|
-
'../' * file.count('/')
|
62
|
-
end
|
63
|
-
|
64
|
-
# TODO
|
65
|
-
#def next
|
66
|
-
# self
|
67
|
-
#end
|
68
|
-
|
69
|
-
# TODO
|
70
|
-
#def previous
|
71
|
-
# self
|
72
|
-
#end
|
73
|
-
|
74
|
-
#
|
75
|
-
def to_h
|
76
|
-
{
|
77
|
-
'url' => url,
|
78
|
-
'author' => author,
|
79
|
-
'title' => title,
|
80
|
-
'date' => date,
|
81
|
-
'tags' => tags,
|
82
|
-
'category' => category,
|
83
|
-
'content' => content
|
84
|
-
}
|
85
|
-
end
|
86
|
-
|
87
|
-
#
|
88
|
-
def save(output=nil)
|
89
|
-
output ||= Dir.pwd # TODO
|
90
|
-
text = render
|
91
|
-
fname = file.chomp(File.extname(file)) + extension
|
92
|
-
if dryrun
|
93
|
-
puts "[DRYRUN] write #{fname}"
|
94
|
-
else
|
95
|
-
puts "write #{fname}"
|
96
|
-
File.open(fname, 'w'){ |f| f << text }
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def to_contextual_attributes
|
101
|
-
{ 'site'=>site.to_h, 'page'=>to_h, 'root'=>root }
|
102
|
-
end
|
103
|
-
|
104
|
-
#
|
105
|
-
def to_liquid
|
106
|
-
to_contextual_attributes
|
107
|
-
end
|
108
|
-
|
109
|
-
protected
|
110
|
-
|
111
|
-
# TODO: Should validate front matter before anything processing.
|
112
|
-
#
|
113
|
-
def render(inherit={})
|
114
|
-
attributes = to_contextual_attributes
|
115
|
-
|
116
|
-
attributes = attributes.merge(inherit)
|
117
|
-
|
118
|
-
#attributes['content'] = content if content
|
119
|
-
|
120
|
-
output = parts.map{ |part| part.render(stencil, attributes) }.join("\n")
|
121
|
-
|
122
|
-
@content = output
|
123
|
-
|
124
|
-
attributes = attributes.merge('content'=>output)
|
125
|
-
if layout
|
126
|
-
renout = site.lookup_layout(layout)
|
127
|
-
raise "No such layout -- #{layout}" unless renout
|
128
|
-
output = renout.render(attributes)
|
129
|
-
end
|
130
|
-
|
131
|
-
output
|
132
|
-
end
|
133
|
-
|
134
|
-
private
|
135
|
-
|
136
|
-
#
|
137
|
-
def site
|
138
|
-
@site
|
139
|
-
end
|
140
|
-
|
141
|
-
#
|
142
|
-
def parts
|
143
|
-
@parts
|
144
|
-
end
|
145
|
-
|
146
|
-
#
|
147
|
-
def dryrun
|
148
|
-
site.dryrun
|
149
|
-
end
|
150
|
-
|
151
|
-
#
|
152
|
-
def parse
|
153
|
-
hold = []
|
154
|
-
text = File.read(file)
|
155
|
-
sect = text.split(/^\-\-\-/)
|
156
|
-
|
157
|
-
if sect.size == 1
|
158
|
-
@prop = {}
|
159
|
-
@parts << Part.new(sect[0], site.defaults.format)
|
160
|
-
else
|
161
|
-
void = sect.shift
|
162
|
-
head = sect.shift
|
163
|
-
head = YAML::load(head)
|
164
|
-
|
165
|
-
parse_header(head)
|
166
|
-
|
167
|
-
sect.each do |body|
|
168
|
-
index = body.index("\n")
|
169
|
-
format = body[0...index].strip
|
170
|
-
format = site.defaults.format if format.empty?
|
171
|
-
text = body[index+1..-1]
|
172
|
-
@parts << Part.new(text, format)
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
|
-
#
|
179
|
-
def parse_header(head)
|
180
|
-
@stencil = head['stencil'] || site.defaults.stencil
|
181
|
-
@author = head['author'] || 'Anonymous'
|
182
|
-
@title = head['title']
|
183
|
-
@date = head['date']
|
184
|
-
@category = head['category']
|
185
|
-
@extension = head['extension']
|
186
|
-
|
187
|
-
self.tags = head['tags']
|
188
|
-
self.layout = head['layout']
|
189
|
-
end
|
190
|
-
|
191
|
-
def layout=(layout)
|
192
|
-
if FalseClass === layout
|
193
|
-
@layout = nil
|
194
|
-
else
|
195
|
-
@layout = layout || default_layout
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
#
|
200
|
-
def tags=(entry)
|
201
|
-
return entry unless entry
|
202
|
-
case entry
|
203
|
-
when String, Symbol
|
204
|
-
entry = entry.to_s.strip
|
205
|
-
if entry.index(/[,;]/)
|
206
|
-
entry = entry.split(/[,;]/)
|
207
|
-
else
|
208
|
-
entry = entry.split(/\s+/)
|
209
|
-
end
|
210
|
-
else
|
211
|
-
entry = entry.to_a.flatten
|
212
|
-
end
|
213
|
-
@tags = entry.map{ |e| e.strip }
|
214
|
-
end
|
215
|
-
|
216
|
-
# Default layout is different for pages vs. posts, so we
|
217
|
-
# use this method to differntiation them.
|
218
|
-
def default_layout
|
219
|
-
site.defaults.pagelayout
|
220
|
-
end
|
221
|
-
|
222
|
-
public
|
223
|
-
|
224
|
-
def to_s
|
225
|
-
file
|
226
|
-
end
|
227
|
-
|
228
|
-
def inspect
|
229
|
-
"<#{self.class}: #{file}>"
|
230
|
-
end
|
231
|
-
|
232
|
-
end
|
233
|
-
|
234
|
-
end
|
235
|
-
|