GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: A lightweight and flexible website management system.
Homepage: http://webby.rubyforge.org/
Clone URL: git://github.com/TwP/webby.git
Updating the documentation for page attributes. Adding tests for filters 
and making the filters code more testable.
Tim Pease (author)
Wed Sep 10 09:54:31 -0700 2008
commit  93b5c60960ad8caffa62107c6db6d89d1aed9b35
tree    ed5f3b28ac61e2a55810dedf81a25eeee380ab37
parent  bc32751153fd2066dab0e07288615c2283883a8b
...
169
170
171
172
 
173
174
175
176
177
 
178
179
180
...
182
183
184
185
 
186
187
188
189
190
 
191
192
193
...
169
170
171
 
172
173
174
175
176
177
178
179
180
181
...
183
184
185
 
186
187
188
 
189
 
190
191
192
193
0
@@ -169,12 +169,13 @@ Attribute identifiers cannot contain spaces; they must be separated from their v
0
 
0
 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.
0
 
0
-* *destination* -- Defines the path in the output directory where the rendered page should be stored.
0
+* *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.
0
 * *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.
0
 * *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:
0
 ** the meta-data of the current page for an @extension@ attribute
0
 ** the meta-data of layout file of the current page for an @extension@ attribute
0
 ** the extension of this page file in the _content_ folder
0
+* *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.
0
 * *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.
0
 * *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.
0
 
0
@@ -182,12 +183,11 @@ The following attributes are defined for each page in the content folder. These
0
 
0
 * *path* -- The full path to the file in the _content_ folder
0
 * *dir* -- The relative directory in the output folder where the page will be rendered
0
-* *filename* -- The name of the file in the _content_ folder excluding any path information
0
+* *name* -- The name of the file in the _content_ folder excluding any path information
0
 * *ext* -- The extension of the file in the _content_ folder
0
 * *mtime* -- The modification time of the file in the _content_ folder
0
-* *number* -- Reserved variable used for multi-page content
0
 * *url* -- A URL suitable for creating a link to the page
0
-* *render* -- Returns the contents of the page as rendered by the Webby filter engine
0
+* *destination* -- The path in the output folder where the page will be rendered
0
 
0
 h4. Page Filters
0
 
...
5
6
7
8
 
9
10
11
...
16
17
18
19
 
20
21
22
23
24
25
26
27
 
28
29
30
...
53
54
55
56
 
57
58
59
...
69
70
71
72
73
74
75
76
77
 
78
79
80
...
5
6
7
 
8
9
10
11
...
16
17
18
 
19
20
21
 
 
 
 
22
 
23
24
25
26
...
49
50
51
 
52
53
54
55
...
65
66
67
 
 
 
 
68
 
69
70
71
72
0
@@ -5,7 +5,7 @@ module Filters
0
     
0
     # Register a handler for a filter
0
     def register( filter, &block )
0
- handlers[filter.to_s] = block
0
+ _handlers[filter.to_s] = block
0
     end
0
     
0
     # Process input through filters
0
@@ -16,15 +16,11 @@ module Filters
0
     
0
     # Access a filter handler
0
     def []( name )
0
- handlers[name]
0
+ _handlers[name]
0
     end
0
       
0
- #######
0
- private
0
- #######
0
-
0
     # The registered filter handlers
0
- def handlers
0
+ def _handlers
0
       @handlers ||= {}
0
     end
0
     
0
@@ -53,7 +49,7 @@ module Filters
0
           raise ::Webby::Error, "unknown filter: #{filter.inspect}" if handler.nil?
0
 
0
           args = [result, self][0, handler.arity]
0
- handle(filter, handler, *args)
0
+ _handle(filter, handler, *args)
0
         end
0
       ensure
0
         @renderer.instance_variable_set(:@_cursor, @prev_cursor)
0
@@ -69,12 +65,8 @@ module Filters
0
         filters[@processed]
0
       end
0
       
0
- #######
0
- private
0
- #######
0
-
0
       # Process arguments through a single filter
0
- def handle(filter, handler, *args)
0
+ def _handle(filter, handler, *args)
0
         result = handler.call(*args)
0
         @processed += 1
0
         result

Comments

    No one has commented yet.