webby 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +11 -0
- data/Manifest.txt +45 -2
- data/Rakefile +1 -2
- data/examples/webby/content/css/site.css +1 -1
- data/examples/webby/content/learn/index.txt +1 -1
- data/examples/webby/content/release-notes/index.txt +21 -0
- data/examples/webby/content/release-notes/rel-0-9-0/index.txt +1 -0
- data/examples/webby/content/release-notes/rel-0-9-1/index.txt +93 -0
- data/examples/webby/content/tips_and_tricks/index.txt +14 -13
- data/examples/webby/content/tutorial/index.txt +13 -9
- data/examples/webby/content/user-manual/index.txt +8 -8
- data/examples/webby/layouts/default.txt +1 -1
- data/lib/webby.rb +2 -1
- data/lib/webby/apps/main.rb +25 -13
- data/lib/webby/auto_builder.rb +2 -0
- data/lib/webby/builder.rb +2 -5
- data/lib/webby/filters.rb +5 -13
- data/lib/webby/renderer.rb +7 -5
- data/lib/webby/resources.rb +54 -14
- data/lib/webby/resources/db.rb +4 -4
- data/lib/webby/resources/layout.rb +14 -23
- data/lib/webby/resources/meta_file.rb +208 -0
- data/lib/webby/resources/page.rb +21 -58
- data/lib/webby/resources/partial.rb +10 -4
- data/lib/webby/resources/resource.rb +68 -27
- data/lib/webby/resources/static.rb +6 -22
- data/lib/webby/stelan/paginator.rb +17 -2
- data/spec/data/Sitefile +9 -0
- data/spec/data/content/_partial.txt +10 -0
- data/spec/data/content/css/coderay.css +111 -0
- data/spec/data/content/css/site.css +67 -0
- data/spec/data/content/css/tumblog.css +308 -0
- data/spec/data/content/images/tumblog/permalink.gif +0 -0
- data/spec/data/content/images/tumblog/rss.gif +0 -0
- data/spec/data/content/index.txt +19 -0
- data/spec/data/content/photos.txt +21 -0
- data/spec/data/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
- data/spec/data/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
- data/spec/data/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
- data/spec/data/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
- data/spec/data/content/tumblog/200807/up-a-tree/index.txt +13 -0
- data/spec/data/content/tumblog/index.txt +37 -0
- data/spec/data/content/tumblog/rss.txt +37 -0
- data/spec/data/hooligans/bad_meta_data_1.txt +34 -0
- data/spec/data/hooligans/bad_meta_data_2.txt +34 -0
- data/spec/data/layouts/default.txt +58 -0
- data/spec/data/layouts/tumblog/default.txt +44 -0
- data/spec/data/layouts/tumblog/post.txt +15 -0
- data/spec/data/lib/breadcrumbs.rb +28 -0
- data/spec/data/lib/tumblog_helper.rb +32 -0
- data/spec/data/tasks/tumblog.rake +30 -0
- data/spec/data/templates/_partial.erb +10 -0
- data/spec/data/templates/atom_feed.erb +40 -0
- data/spec/data/templates/page.erb +18 -0
- data/spec/data/templates/presentation.erb +40 -0
- data/spec/data/templates/tumblog/conversation.erb +12 -0
- data/spec/data/templates/tumblog/link.erb +10 -0
- data/spec/data/templates/tumblog/photo.erb +13 -0
- data/spec/data/templates/tumblog/post.erb +12 -0
- data/spec/data/templates/tumblog/quote.erb +11 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/webby/apps/generator_spec.rb +4 -0
- data/spec/webby/apps/main_spec.rb +16 -3
- data/spec/webby/filters/textile_spec.rb +20 -0
- data/spec/webby/renderer_spec.rb +139 -0
- data/spec/webby/resources/db_spec.rb +250 -0
- data/spec/webby/resources/layout_spec.rb +83 -0
- data/spec/webby/resources/meta_file_spec.rb +157 -0
- data/spec/webby/resources/page_spec.rb +111 -0
- data/spec/webby/resources/partial_spec.rb +58 -0
- data/spec/webby/resources/resource_spec.rb +214 -0
- data/spec/webby/resources/static_spec.rb +49 -0
- data/spec/webby/resources_spec.rb +55 -3
- metadata +64 -6
- data/lib/webby/resources/file.rb +0 -221
- data/spec/webby/resources/file_spec.rb +0 -104
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
== 0.9.1 / 2008-09-10
|
2
|
+
|
3
|
+
* 1 major enhancement
|
4
|
+
- multiple output files can be generated from a single page
|
5
|
+
* 2 minor enhancements
|
6
|
+
- simplified the handling of meta-data at the top of files
|
7
|
+
- pagination now honors the "page per directory" flag
|
8
|
+
* 2 bug fixes
|
9
|
+
- filename extensions were not being preserved when creating a new page
|
10
|
+
- webby now works properly with rake 0.8.2
|
11
|
+
|
1
12
|
== 0.9.0 / 2008-08-25
|
2
13
|
|
3
14
|
* 2 major enhancements
|
data/Manifest.txt
CHANGED
@@ -60,7 +60,9 @@ examples/webby/content/css/uv/twilight.css
|
|
60
60
|
examples/webby/content/index.txt
|
61
61
|
examples/webby/content/learn/index.txt
|
62
62
|
examples/webby/content/reference/index.txt
|
63
|
+
examples/webby/content/release-notes/index.txt
|
63
64
|
examples/webby/content/release-notes/rel-0-9-0/index.txt
|
65
|
+
examples/webby/content/release-notes/rel-0-9-1/index.txt
|
64
66
|
examples/webby/content/robots.txt
|
65
67
|
examples/webby/content/script/jquery.corner.js
|
66
68
|
examples/webby/content/script/jquery.js
|
@@ -134,8 +136,8 @@ lib/webby/link_validator.rb
|
|
134
136
|
lib/webby/renderer.rb
|
135
137
|
lib/webby/resources.rb
|
136
138
|
lib/webby/resources/db.rb
|
137
|
-
lib/webby/resources/file.rb
|
138
139
|
lib/webby/resources/layout.rb
|
140
|
+
lib/webby/resources/meta_file.rb
|
139
141
|
lib/webby/resources/page.rb
|
140
142
|
lib/webby/resources/partial.rb
|
141
143
|
lib/webby/resources/resource.rb
|
@@ -152,12 +154,53 @@ lib/webby/tasks/validate.rake
|
|
152
154
|
spec/core_ext/hash_spec.rb
|
153
155
|
spec/core_ext/string_spec.rb
|
154
156
|
spec/core_ext/time_spec.rb
|
157
|
+
spec/data/Sitefile
|
158
|
+
spec/data/content/_partial.txt
|
159
|
+
spec/data/content/css/coderay.css
|
160
|
+
spec/data/content/css/site.css
|
161
|
+
spec/data/content/css/tumblog.css
|
162
|
+
spec/data/content/images/tumblog/permalink.gif
|
163
|
+
spec/data/content/images/tumblog/rss.gif
|
164
|
+
spec/data/content/index.txt
|
165
|
+
spec/data/content/photos.txt
|
166
|
+
spec/data/content/tumblog/200806/the-noble-chicken/index.txt
|
167
|
+
spec/data/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt
|
168
|
+
spec/data/content/tumblog/200807/mad-city-chickens/index.txt
|
169
|
+
spec/data/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt
|
170
|
+
spec/data/content/tumblog/200807/up-a-tree/index.txt
|
171
|
+
spec/data/content/tumblog/index.txt
|
172
|
+
spec/data/content/tumblog/rss.txt
|
173
|
+
spec/data/hooligans/bad_meta_data_1.txt
|
174
|
+
spec/data/hooligans/bad_meta_data_2.txt
|
175
|
+
spec/data/layouts/default.txt
|
176
|
+
spec/data/layouts/tumblog/default.txt
|
177
|
+
spec/data/layouts/tumblog/post.txt
|
178
|
+
spec/data/lib/breadcrumbs.rb
|
179
|
+
spec/data/lib/tumblog_helper.rb
|
180
|
+
spec/data/tasks/tumblog.rake
|
181
|
+
spec/data/templates/_partial.erb
|
182
|
+
spec/data/templates/atom_feed.erb
|
183
|
+
spec/data/templates/page.erb
|
184
|
+
spec/data/templates/presentation.erb
|
185
|
+
spec/data/templates/tumblog/conversation.erb
|
186
|
+
spec/data/templates/tumblog/link.erb
|
187
|
+
spec/data/templates/tumblog/photo.erb
|
188
|
+
spec/data/templates/tumblog/post.erb
|
189
|
+
spec/data/templates/tumblog/quote.erb
|
155
190
|
spec/spec.opts
|
156
191
|
spec/spec_helper.rb
|
157
192
|
spec/webby/apps/generator_spec.rb
|
158
193
|
spec/webby/apps/main_spec.rb
|
194
|
+
spec/webby/filters/textile_spec.rb
|
159
195
|
spec/webby/helpers/capture_helper_spec.rb
|
160
|
-
spec/webby/
|
196
|
+
spec/webby/renderer_spec.rb
|
197
|
+
spec/webby/resources/db_spec.rb
|
198
|
+
spec/webby/resources/layout_spec.rb
|
199
|
+
spec/webby/resources/meta_file_spec.rb
|
200
|
+
spec/webby/resources/page_spec.rb
|
201
|
+
spec/webby/resources/partial_spec.rb
|
202
|
+
spec/webby/resources/resource_spec.rb
|
203
|
+
spec/webby/resources/static_spec.rb
|
161
204
|
spec/webby/resources_spec.rb
|
162
205
|
tasks/ann.rake
|
163
206
|
tasks/bones.rake
|
data/Rakefile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# $Id$
|
2
1
|
|
3
2
|
load 'tasks/setup.rb'
|
4
3
|
|
@@ -15,7 +14,7 @@ PROJ.url = 'http://webby.rubyforge.org/'
|
|
15
14
|
PROJ.description = paragraphs_of('README.txt', 3).join("\n\n")
|
16
15
|
PROJ.rubyforge.name = 'webby'
|
17
16
|
PROJ.version = Webby::VERSION
|
18
|
-
PROJ.release_name = '
|
17
|
+
PROJ.release_name = 'Gallus Gallus Toothicus'
|
19
18
|
|
20
19
|
PROJ.ruby_opts = %w[-W0]
|
21
20
|
PROJ.exclude << %w(^examples/[^/]+/output ^tasks/archive ^tags$ ^webby.gemspec$)
|
@@ -23,6 +23,6 @@ p(pull). *<%= link_to_page('Reference') %>*
|
|
23
23
|
|
24
24
|
p(pulltext). The reference does not provide an introduction to Webby. Instead, it is an indexed collection of the various Webby features with a brief explanation of each. It is useful when you vaguely remember reading something about filters and only need a quick refresher of the details without instructional text.
|
25
25
|
|
26
|
-
p(pull). *<%= link_to_page('Release Notes'
|
26
|
+
p(pull). *<%= link_to_page('Release Notes') %>*
|
27
27
|
|
28
28
|
p(pulltext). These are the release notes for past and present versions of Webby. Actually, it's only for the current version of Webby since formal release notes were only recently thought of by the developer. %(quiet)Bad developer! No latte!!%
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
title: Release Notes
|
3
|
+
created_at: 2008-09-10 19:53:33.084767 -06:00
|
4
|
+
dirty: true
|
5
|
+
filter:
|
6
|
+
- erb
|
7
|
+
- textile
|
8
|
+
---
|
9
|
+
h2. <%= h(@page.title) %>
|
10
|
+
|
11
|
+
Below are links to the release notes for the various version of Webby that have been officially released. Please note the humorous release names; these were created at great expense by a team of comedy writers hand picked by Stephen Colbert.
|
12
|
+
|
13
|
+
<% @pages.find(:all,
|
14
|
+
:sort_by => 'title',
|
15
|
+
:reverse => true,
|
16
|
+
:in_directory => @page.directory,
|
17
|
+
:recursive => true).each do |page|
|
18
|
+
next if page == @page
|
19
|
+
-%>
|
20
|
+
* *<%= link_to_page page %>* %(quiet)-- <%= h(page.release_name) %>%
|
21
|
+
<% end -%>
|
@@ -0,0 +1,93 @@
|
|
1
|
+
---
|
2
|
+
title: Release 0.9.1
|
3
|
+
created_at: 2008-09-10 19:33:47.822421 -06:00
|
4
|
+
filter:
|
5
|
+
- erb
|
6
|
+
- textile
|
7
|
+
release_name: Gallus Gallus Toothicus
|
8
|
+
---
|
9
|
+
h2. <%= h(@page.title) %>
|
10
|
+
|
11
|
+
Release 0.9.1 adds one new significant feature and fixes some bugs. The big new feature is the ability to generate multiple output files from a single content page. See below for more information.
|
12
|
+
|
13
|
+
* 1 major enhancement
|
14
|
+
** Multiple output files can be generated from a single page
|
15
|
+
* 2 minor enhancements
|
16
|
+
** Pagination now honors the "page per directory" flag
|
17
|
+
** Simplified the handling of meta-data at the top of files
|
18
|
+
* 2 bug fixes
|
19
|
+
** Filename extensions were not being preserved when creating a new page
|
20
|
+
** Webby now works properly with rake 0.8.2
|
21
|
+
|
22
|
+
h3. Multiple Output Files
|
23
|
+
|
24
|
+
What's that, you say? Multiple output files, you say?
|
25
|
+
|
26
|
+
Why, yes!
|
27
|
+
|
28
|
+
Let's take the example of a photo gallery containing a page of thumbnails that each link to a larger picture with a title and a description. To make such a creation in webby would require each "large picture" page to have it's own file in the content directory, but the only difference between these files would be the _title_ and the _description_.
|
29
|
+
|
30
|
+
A better way to handle such a beastie would be a single file in the content folder that contains the titles and descriptions of *all* the photos in the meta-data. The content of this page would be filled in differently for each specific photo page generated.
|
31
|
+
|
32
|
+
This is now possible in webby by specifying the specifics for each photo in separate meta-data blocks at the top of the page. One output file will be generated for each meta-data block.
|
33
|
+
|
34
|
+
<pre>
|
35
|
+
<%= Webby::YAML_SEP %>
|
36
|
+
title: First Photo
|
37
|
+
created_at: 2008-09-10 19:33:47.822421 -06:00
|
38
|
+
filter:
|
39
|
+
- erb
|
40
|
+
- textile
|
41
|
+
filename: photo-1
|
42
|
+
photo: IMG001.jpg
|
43
|
+
description: This is the first photo
|
44
|
+
<%= Webby::YAML_SEP %>
|
45
|
+
title: Second Photo
|
46
|
+
filename: photo-2
|
47
|
+
photo: IMG002.jpg
|
48
|
+
description: This is the second photo
|
49
|
+
<%= Webby::YAML_SEP %>
|
50
|
+
title: Thrid Photo
|
51
|
+
filename: photo-3
|
52
|
+
photo: IMG003.jpg
|
53
|
+
description: This is the thrid photo
|
54
|
+
<%= Webby::YAML_SEP %>
|
55
|
+
h1. <%%= @page.title %>
|
56
|
+
|
57
|
+
!<%%= @page.photo %>!
|
58
|
+
|
59
|
+
p(desc). <%%= description %>
|
60
|
+
</pre>
|
61
|
+
|
62
|
+
The example above will result in three output files being generated. The output destination is generated by combining the @directory@ / @filename@ . @extension@ One of those must be different in each meta-data block, otherwise the resulting output files will overwrite one another. In the example, I have chose to modify the @filename@.
|
63
|
+
|
64
|
+
The first meta-data block defines the base set of meta-data for the page. Each subsequent meta-data block _modifies_ the meta-data of the first block. So, each resulting output file will be processed by the erb and textile filters (because they appear in the first meta-data block) without having to explicitly specify those filters in each block. Meta-data defined in the second block does not affect the third or subsequent blocks; only the *first* meta-data block defines inheritable parameters.
|
65
|
+
|
66
|
+
h4. Another Example
|
67
|
+
|
68
|
+
Let's say you want to generate an HTML file *and* a PDF file for a single page. This is easily done by specifying different filters.
|
69
|
+
|
70
|
+
<pre>
|
71
|
+
<%= Webby::YAML_SEP %>
|
72
|
+
title: Downloadable Instructions
|
73
|
+
created_at: 2008-09-10 19:33:47.822421 -06:00
|
74
|
+
filter:
|
75
|
+
- erb
|
76
|
+
- textile
|
77
|
+
<%= Webby::YAML_SEP %>
|
78
|
+
extension: pdf
|
79
|
+
layout: none
|
80
|
+
filter:
|
81
|
+
- erb
|
82
|
+
- textile
|
83
|
+
- htmldoc
|
84
|
+
<%= Webby::YAML_SEP %>
|
85
|
+
|
86
|
+
content goes here ...
|
87
|
+
</pre>
|
88
|
+
|
89
|
+
In this example, the first meta-data block generates an HTML page in the standard webby fashion -- render the page and insert into the default layout. The second meta-data block adds the "htmldoc" filter<sup><a href="#fn1">1</a></sup> to the end of the filter stack. This uses the "htmldoc":http://www.htmldoc.org program to convert HTML into PDF format.
|
90
|
+
|
91
|
+
Again, we specify a different output file by changing the extension from the default to "pdf", and we prevent site navigation and headers / footers from appearing in the generated PDF by setting the layout to none. The title is inherited from the first meta-data block.
|
92
|
+
|
93
|
+
fn1(fn). This filter does not exist, but the "htmldoc":http://www.htmldoc.org program does exist. So the filter is not out of the question, and it most likely will make an appearance in a later release of webby.
|
@@ -2,6 +2,7 @@
|
|
2
2
|
title: Tips & Tricks
|
3
3
|
created_at: 2007-08-29 08:57:11.000000 -06:00
|
4
4
|
filter:
|
5
|
+
- erb
|
5
6
|
- textile
|
6
7
|
- outline
|
7
8
|
---
|
@@ -19,25 +20,25 @@ Pagination is the process of organizing information onto a page such that a fixe
|
|
19
20
|
Let's assume that your website has a collection of articles in a folder called "articles" in the content directory. The goal is to display these articles ten at a time in reverse chronological order.
|
20
21
|
|
21
22
|
<pre>
|
22
|
-
|
23
|
+
<%= Webby::YAML_SEP %>
|
23
24
|
title: Articles
|
24
25
|
filter:
|
25
26
|
- erb
|
26
27
|
- textile
|
27
|
-
|
28
|
-
h2.
|
28
|
+
<%= Webby::YAML_SEP %>
|
29
|
+
h2. <%%= h(@page.title) %>
|
29
30
|
|
30
|
-
|
31
|
+
<%%
|
31
32
|
articles = @pages.find(:all, :in_directory => "articles",
|
32
33
|
:sort_by => "mtime", :reverse => true)
|
33
34
|
paginate(articles, 10) do |page|
|
34
35
|
%>
|
35
|
-
|
36
|
+
<%%= page.render %>
|
36
37
|
<hr />
|
37
|
-
|
38
|
+
<%% end %>
|
38
39
|
|
39
|
-
|
40
|
-
|
40
|
+
<%%= link_to("Prev", @pager.prev) if @pager.prev? %>
|
41
|
+
<%%= link_to("Next", @pager.next) if @pager.next? %>
|
41
42
|
</pre>
|
42
43
|
|
43
44
|
In the example page above, the first step is get the collection of articles we are interested in the paginating. This is done using the <code>@pages.find</code> method to retrieve all the pages from the articles folder sorted in reverse order by modification time. When we have the collection of articles, we pass them to the @paginate@ method along with the desired number of articles per page. The @paginate@ method will pass each page in the @articles@ collection to the supplied block of code, but for each ten pages passed to the block, a new webpage will be created.
|
@@ -61,19 +62,19 @@ h2. CodeRay
|
|
61
62
|
To include "CodeRay":http://coderay.rubychan.de/ syntax highlighting support in a page you need to have the @coderay@ gem installed, and you need to include the CodeRay stylesheet in your layout. The following example shows a page that uses CodeRay syntax highlighting combined with Textile markup.
|
62
63
|
|
63
64
|
<pre>
|
64
|
-
|
65
|
+
<%= Webby::YAML_SEP %>
|
65
66
|
title: CodeRay Example
|
66
67
|
filter:
|
67
68
|
- erb
|
68
69
|
- textile
|
69
|
-
|
70
|
-
h2.
|
70
|
+
<%= Webby::YAML_SEP %>
|
71
|
+
h2. <%%= h(@page.title) %>
|
71
72
|
|
72
73
|
This is the @render_page@ function from the Webby static website generation
|
73
74
|
system. It is used to render a page by applying the specified filters in
|
74
75
|
succession to the page contents.
|
75
76
|
|
76
|
-
|
77
|
+
<%% coderay(:lang => "ruby", :line_numbers => "inline") do -%>
|
77
78
|
# call-seq:
|
78
79
|
# render_page => string
|
79
80
|
#
|
@@ -90,7 +91,7 @@ def render_page
|
|
90
91
|
|
91
92
|
str
|
92
93
|
end
|
93
|
-
|
94
|
+
<%% end -%>
|
94
95
|
</pre>
|
95
96
|
|
96
97
|
There are more options that can be passed to the CodeRay syntax highlighter than those shown in the example above. Take a look at the RDoc documentation for the "CodeRay Helper":/rdoc/classes/Webby/Helpers/CodeRayHelper.html class for more information.
|
@@ -1,8 +1,12 @@
|
|
1
1
|
---
|
2
2
|
title: Tutorial
|
3
3
|
created_at: 2007-08-21 17:02:40.000000 -06:00
|
4
|
-
filter:
|
4
|
+
filter:
|
5
|
+
- erb
|
6
|
+
- textile
|
5
7
|
---
|
8
|
+
h1. Tutorial
|
9
|
+
|
6
10
|
h2. Require
|
7
11
|
|
8
12
|
Webby has a family of friends that help it get it's job done. The command-line is where Webby lives and works. You should be comfortable with your terminal if you're going to get serious with Webby. Webby is built on top of "Ruby":http://www.ruby-lang.org/, and many of the templates use Ruby in one way or another. Learning a little bit about Ruby will make Webby far less intimidating.
|
@@ -48,14 +52,14 @@ h2. Making Changes
|
|
48
52
|
Of course "Lorem Ipsum" is some great content, but if everyone posted their site in such a state the web would be a monochromatic smurf blue. Let's change that into something more creative, more us. Open the *content/index.txt* file in your favorite editor.
|
49
53
|
|
50
54
|
<pre class="code">
|
51
|
-
|
55
|
+
<%= Webby::YAML_SEP %>
|
52
56
|
title: Home Page
|
53
57
|
created_at: Tue Aug 21 17:02:40 -0600 2007
|
54
58
|
filter:
|
55
59
|
- erb
|
56
60
|
- textile
|
57
|
-
|
58
|
-
h2.
|
61
|
+
<%= Webby::YAML_SEP %>
|
62
|
+
h2. <%%= @page.title %>
|
59
63
|
|
60
64
|
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc congue ipsum
|
61
65
|
vestibulum libero. Aenean vitae justo. Nam eget tellus. Etiam convallis, est
|
@@ -70,7 +74,7 @@ This is not the entire contents of the file, just to enough to get a feel for ho
|
|
70
74
|
|
71
75
|
The content of this page is not HTML, but it ends up that way. How? Webby uses _filters_ on the page to transform the text into HTML. The *filter* item in the meta-data tells Webby which filters to apply to the page. Two filters will be applied, "erb" and "textile" - in that order. Each filter operates on the page text (everything after the meta-data).
|
72
76
|
|
73
|
-
The erb filter (erb stands for "embedded Ruby") allows Webby to process Ruby statements found in the page text and to substitute the output of those Ruby statements back into the page text. The Ruby statements appear between
|
77
|
+
The erb filter (erb stands for "embedded Ruby") allows Webby to process Ruby statements found in the page text and to substitute the output of those Ruby statements back into the page text. The Ruby statements appear between @<%%= ruby_code %>@ delimiters. The meta-data found at the top of the page is made available through the @@page@ object. You can see from the index.txt file that the page title, "Home Page", will be substituted on the first line.
|
74
78
|
|
75
79
|
The textile filter operates on all page text. It is a human readable markup that gets converted into HTML. For example, the line <notextile><code>h2. Litora Sociis</code></notextile> will be converted into <notextile><code><h2> Litora Sociis</h2></code></notextile> by the textile filter. It is a powerful markup language that simplifies web publishing.
|
76
80
|
|
@@ -101,18 +105,18 @@ h2. Change the Layout
|
|
101
105
|
The next step is to change how the page looks. In fact, we want to change the appearance of all the pages in our website. This is easily done by changing the website layout file in the _layouts_ folder. Open the *layouts/default.txt* file in your favorite editor.
|
102
106
|
|
103
107
|
<pre class="code">
|
104
|
-
|
108
|
+
<%= Webby::YAML_SEP %>
|
105
109
|
extension: html
|
106
110
|
filter: erb
|
107
|
-
|
111
|
+
<%= Webby::YAML_SEP %>
|
108
112
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
109
113
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
110
114
|
|
111
115
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
|
112
116
|
<head>
|
113
117
|
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
|
114
|
-
<title
|
115
|
-
<meta name="author" content="
|
118
|
+
<title><%%= @page.title %></title>
|
119
|
+
<meta name="author" content="<%%= @page.author %>" />
|
116
120
|
...
|
117
121
|
</pre>
|
118
122
|
|
@@ -133,13 +133,13 @@ Pages are found in the _content_ folder along with regular files. Pages contain
|
|
133
133
|
Let's look at an example page.
|
134
134
|
|
135
135
|
<pre>
|
136
|
-
|
136
|
+
<%= Webby::YAML_SEP %>
|
137
137
|
title: Lorem Ipsum
|
138
138
|
created_at: Wed Aug 29 08:57:00 -0600 2007
|
139
139
|
filter:
|
140
140
|
- erb
|
141
141
|
- textile
|
142
|
-
|
142
|
+
<%= Webby::YAML_SEP %>
|
143
143
|
h2. <%%= @page.title %>
|
144
144
|
|
145
145
|
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc congue ipsum
|
@@ -169,12 +169,13 @@ Attribute identifiers cannot contain spaces; they must be separated from their v
|
|
169
169
|
|
170
170
|
There are a few attributes that control when, where, and how pages are rendered. These are listed below with a brief description of how the attribute affects the system.
|
171
171
|
|
172
|
-
* *
|
172
|
+
* *directory* -- Defines the path in the output directory where the rendered page should be stored. If left empty, then the path of the page in the content folder is used as the output directory.
|
173
173
|
* *dirty* -- The dirty flag is used to determine whether the page should rendered or not. Normally this is automatically determined by the filter engine, but it can be overridden by setting this attribute. If the dirty flag is set to _true_ then the page will always be rendered. If the dirty flag is set to _false_ then the page will never be rendered.
|
174
174
|
* *extension* -- Defines the extension that will be appended to the filename of the rendered page in the output folder. The extension is determined by looking at the following:
|
175
175
|
** the meta-data of the current page for an @extension@ attribute
|
176
176
|
** the meta-data of layout file of the current page for an @extension@ attribute
|
177
177
|
** the extension of this page file in the _content_ folder
|
178
|
+
* *filename* -- The name of the rendered page in the output folder. If left blank, the name of the file in the content folder is used.
|
178
179
|
* *filter* -- Defines the list of filters that will be applied to the contents of this page. If left blank, then the default filter will be applied to the page contents.
|
179
180
|
* *layout* -- Defines the layout that the page contents will be rendered into. The default layout will be used if this attribute is not defined. The value of @nil@ should be specified if the page should not be rendered into any layout.
|
180
181
|
|
@@ -182,12 +183,11 @@ The following attributes are defined for each page in the content folder. These
|
|
182
183
|
|
183
184
|
* *path* -- The full path to the file in the _content_ folder
|
184
185
|
* *dir* -- The relative directory in the output folder where the page will be rendered
|
185
|
-
* *
|
186
|
+
* *name* -- The name of the file in the _content_ folder excluding any path information
|
186
187
|
* *ext* -- The extension of the file in the _content_ folder
|
187
188
|
* *mtime* -- The modification time of the file in the _content_ folder
|
188
|
-
* *number* -- Reserved variable used for multi-page content
|
189
189
|
* *url* -- A URL suitable for creating a link to the page
|
190
|
-
* *
|
190
|
+
* *destination* -- The path in the output folder where the page will be rendered
|
191
191
|
|
192
192
|
h4. Page Filters
|
193
193
|
|
@@ -213,10 +213,10 @@ The diagram to the right shows a typical page rendering process. The content of
|
|
213
213
|
Layouts are treated exactly as pages are treated with one exception -- the layout has access to the rendered contents of another page in site. The content of the page being rendered is made available to the layout via the @@content@ variable accessible from the ERB filter.
|
214
214
|
|
215
215
|
<pre>
|
216
|
-
|
216
|
+
<%= Webby::YAML_SEP %>
|
217
217
|
extension: html
|
218
218
|
filter: erb
|
219
|
-
|
219
|
+
<%= Webby::YAML_SEP %>
|
220
220
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
|
221
221
|
<head>
|
222
222
|
<title><%= @page.title %></title>
|
@@ -28,7 +28,7 @@ filter:
|
|
28
28
|
<div class="column span-17 prepend-4 append-3 first last" id="header">
|
29
29
|
<ul
|
30
30
|
><li><%= link_to_page('Learn') %></li
|
31
|
-
><li><%= link_to_page('Communicate') %></
|
31
|
+
><li><%= link_to_page('Communicate') %></li
|
32
32
|
></ul>
|
33
33
|
<h1><a href="/">Webby</a></h1>
|
34
34
|
<p>- ascii alchemy</p>
|