blowmage-webby 0.9.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. data/History.txt +214 -0
  2. data/Manifest.txt +249 -0
  3. data/README.rdoc +92 -0
  4. data/Rakefile +56 -0
  5. data/bin/webby +41 -0
  6. data/bin/webby-gen +41 -0
  7. data/examples/blog/Sitefile +7 -0
  8. data/examples/blog/tasks/blog.rake +72 -0
  9. data/examples/blog/templates/atom_feed.erb +40 -0
  10. data/examples/blog/templates/blog/month.erb +22 -0
  11. data/examples/blog/templates/blog/post.erb +16 -0
  12. data/examples/blog/templates/blog/year.erb +22 -0
  13. data/examples/presentation/Sitefile +10 -0
  14. data/examples/presentation/content/css/uv/twilight.css +137 -0
  15. data/examples/presentation/content/presentation/_sample_code.txt +10 -0
  16. data/examples/presentation/content/presentation/index.txt +63 -0
  17. data/examples/presentation/content/presentation/s5/blank.gif +0 -0
  18. data/examples/presentation/content/presentation/s5/bodybg.gif +0 -0
  19. data/examples/presentation/content/presentation/s5/framing.css +23 -0
  20. data/examples/presentation/content/presentation/s5/iepngfix.htc +42 -0
  21. data/examples/presentation/content/presentation/s5/opera.css +7 -0
  22. data/examples/presentation/content/presentation/s5/outline.css +15 -0
  23. data/examples/presentation/content/presentation/s5/pretty.css +86 -0
  24. data/examples/presentation/content/presentation/s5/print.css +25 -0
  25. data/examples/presentation/content/presentation/s5/s5-core.css +9 -0
  26. data/examples/presentation/content/presentation/s5/slides.css +3 -0
  27. data/examples/presentation/content/presentation/s5/slides.js +553 -0
  28. data/examples/presentation/layouts/presentation.txt +43 -0
  29. data/examples/presentation/templates/_code_partial.erb +13 -0
  30. data/examples/presentation/templates/presentation.erb +40 -0
  31. data/examples/tumblog/Sitefile +9 -0
  32. data/examples/tumblog/content/css/tumblog.css +308 -0
  33. data/examples/tumblog/content/images/tumblog/permalink.gif +0 -0
  34. data/examples/tumblog/content/images/tumblog/rss.gif +0 -0
  35. data/examples/tumblog/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
  36. data/examples/tumblog/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
  37. data/examples/tumblog/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
  38. data/examples/tumblog/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
  39. data/examples/tumblog/content/tumblog/200807/up-a-tree/index.txt +13 -0
  40. data/examples/tumblog/content/tumblog/index.txt +37 -0
  41. data/examples/tumblog/content/tumblog/rss.txt +37 -0
  42. data/examples/tumblog/layouts/tumblog/default.txt +44 -0
  43. data/examples/tumblog/layouts/tumblog/post.txt +15 -0
  44. data/examples/tumblog/lib/tumblog_helper.rb +32 -0
  45. data/examples/tumblog/tasks/tumblog.rake +30 -0
  46. data/examples/tumblog/templates/atom_feed.erb +40 -0
  47. data/examples/tumblog/templates/tumblog/conversation.erb +12 -0
  48. data/examples/tumblog/templates/tumblog/link.erb +10 -0
  49. data/examples/tumblog/templates/tumblog/photo.erb +13 -0
  50. data/examples/tumblog/templates/tumblog/post.erb +12 -0
  51. data/examples/tumblog/templates/tumblog/quote.erb +11 -0
  52. data/examples/webby/Sitefile +19 -0
  53. data/examples/webby/content/communicate/index.txt +28 -0
  54. data/examples/webby/content/css/background.gif +0 -0
  55. data/examples/webby/content/css/blueprint/print.css +76 -0
  56. data/examples/webby/content/css/blueprint/screen.css +696 -0
  57. data/examples/webby/content/css/coderay.css +96 -0
  58. data/examples/webby/content/css/site.css +196 -0
  59. data/examples/webby/content/css/uv/twilight.css +137 -0
  60. data/examples/webby/content/index.txt +37 -0
  61. data/examples/webby/content/learn/index.txt +28 -0
  62. data/examples/webby/content/reference/index.txt +204 -0
  63. data/examples/webby/content/release-notes/index.txt +21 -0
  64. data/examples/webby/content/release-notes/rel-0-9-0/index.txt +74 -0
  65. data/examples/webby/content/release-notes/rel-0-9-1/index.txt +93 -0
  66. data/examples/webby/content/release-notes/rel-0-9-2/index.txt +14 -0
  67. data/examples/webby/content/release-notes/rel-0-9-3/index.txt +47 -0
  68. data/examples/webby/content/robots.txt +6 -0
  69. data/examples/webby/content/script/jquery.corner.js +152 -0
  70. data/examples/webby/content/script/jquery.js +31 -0
  71. data/examples/webby/content/sitemap.txt +31 -0
  72. data/examples/webby/content/tips_and_tricks/index.txt +97 -0
  73. data/examples/webby/content/tutorial/index.txt +135 -0
  74. data/examples/webby/content/user-manual/index.txt +419 -0
  75. data/examples/webby/layouts/default.txt +49 -0
  76. data/examples/webby/templates/page.erb +10 -0
  77. data/examples/website/Sitefile +7 -0
  78. data/examples/website/content/css/blueprint/ie.css +26 -0
  79. data/examples/website/content/css/blueprint/plugins/buttons/icons/cross.png +0 -0
  80. data/examples/website/content/css/blueprint/plugins/buttons/icons/key.png +0 -0
  81. data/examples/website/content/css/blueprint/plugins/buttons/icons/tick.png +0 -0
  82. data/examples/website/content/css/blueprint/plugins/buttons/readme.txt +32 -0
  83. data/examples/website/content/css/blueprint/plugins/buttons/screen.css +97 -0
  84. data/examples/website/content/css/blueprint/plugins/fancy-type/readme.txt +14 -0
  85. data/examples/website/content/css/blueprint/plugins/fancy-type/screen.css +71 -0
  86. data/examples/website/content/css/blueprint/plugins/link-icons/icons/doc.png +0 -0
  87. data/examples/website/content/css/blueprint/plugins/link-icons/icons/email.png +0 -0
  88. data/examples/website/content/css/blueprint/plugins/link-icons/icons/external.png +0 -0
  89. data/examples/website/content/css/blueprint/plugins/link-icons/icons/feed.png +0 -0
  90. data/examples/website/content/css/blueprint/plugins/link-icons/icons/im.png +0 -0
  91. data/examples/website/content/css/blueprint/plugins/link-icons/icons/pdf.png +0 -0
  92. data/examples/website/content/css/blueprint/plugins/link-icons/icons/visited.png +0 -0
  93. data/examples/website/content/css/blueprint/plugins/link-icons/icons/xls.png +0 -0
  94. data/examples/website/content/css/blueprint/plugins/link-icons/readme.txt +18 -0
  95. data/examples/website/content/css/blueprint/plugins/link-icons/screen.css +40 -0
  96. data/examples/website/content/css/blueprint/plugins/rtl/readme.txt +10 -0
  97. data/examples/website/content/css/blueprint/plugins/rtl/screen.css +109 -0
  98. data/examples/website/content/css/blueprint/print.css +30 -0
  99. data/examples/website/content/css/blueprint/screen.css +251 -0
  100. data/examples/website/content/css/blueprint/src/forms.css +49 -0
  101. data/examples/website/content/css/blueprint/src/grid.css +212 -0
  102. data/examples/website/content/css/blueprint/src/grid.png +0 -0
  103. data/examples/website/content/css/blueprint/src/ie.css +59 -0
  104. data/examples/website/content/css/blueprint/src/print.css +85 -0
  105. data/examples/website/content/css/blueprint/src/reset.css +38 -0
  106. data/examples/website/content/css/blueprint/src/typography.css +105 -0
  107. data/examples/website/content/css/coderay.css +111 -0
  108. data/examples/website/content/css/site.css +67 -0
  109. data/examples/website/content/index.txt +19 -0
  110. data/examples/website/layouts/default.txt +61 -0
  111. data/examples/website/lib/breadcrumbs.rb +28 -0
  112. data/examples/website/templates/_partial.erb +10 -0
  113. data/examples/website/templates/page.erb +18 -0
  114. data/lib/webby.rb +233 -0
  115. data/lib/webby/apps.rb +12 -0
  116. data/lib/webby/apps/generator.rb +276 -0
  117. data/lib/webby/apps/main.rb +258 -0
  118. data/lib/webby/auto_builder.rb +157 -0
  119. data/lib/webby/builder.rb +172 -0
  120. data/lib/webby/core_ext/enumerable.rb +11 -0
  121. data/lib/webby/core_ext/hash.rb +28 -0
  122. data/lib/webby/core_ext/kernel.rb +26 -0
  123. data/lib/webby/core_ext/string.rb +163 -0
  124. data/lib/webby/core_ext/time.rb +9 -0
  125. data/lib/webby/filters.rb +83 -0
  126. data/lib/webby/filters/basepath.rb +97 -0
  127. data/lib/webby/filters/erb.rb +9 -0
  128. data/lib/webby/filters/haml.rb +18 -0
  129. data/lib/webby/filters/markdown.rb +16 -0
  130. data/lib/webby/filters/maruku.rb +16 -0
  131. data/lib/webby/filters/outline.rb +309 -0
  132. data/lib/webby/filters/sass.rb +17 -0
  133. data/lib/webby/filters/slides.rb +56 -0
  134. data/lib/webby/filters/textile.rb +16 -0
  135. data/lib/webby/filters/tidy.rb +76 -0
  136. data/lib/webby/filters/wiki_words.rb +14 -0
  137. data/lib/webby/helpers.rb +30 -0
  138. data/lib/webby/helpers/capture_helper.rb +141 -0
  139. data/lib/webby/helpers/coderay_helper.rb +69 -0
  140. data/lib/webby/helpers/graphviz_helper.rb +136 -0
  141. data/lib/webby/helpers/tag_helper.rb +65 -0
  142. data/lib/webby/helpers/tex_img_helper.rb +133 -0
  143. data/lib/webby/helpers/ultraviolet_helper.rb +63 -0
  144. data/lib/webby/helpers/url_helper.rb +241 -0
  145. data/lib/webby/journal.rb +126 -0
  146. data/lib/webby/link_validator.rb +160 -0
  147. data/lib/webby/renderer.rb +386 -0
  148. data/lib/webby/resources.rb +136 -0
  149. data/lib/webby/resources/db.rb +251 -0
  150. data/lib/webby/resources/layout.rb +54 -0
  151. data/lib/webby/resources/meta_file.rb +211 -0
  152. data/lib/webby/resources/page.rb +82 -0
  153. data/lib/webby/resources/partial.rb +85 -0
  154. data/lib/webby/resources/resource.rb +201 -0
  155. data/lib/webby/resources/static.rb +36 -0
  156. data/lib/webby/stelan/mktemp.rb +135 -0
  157. data/lib/webby/stelan/paginator.rb +165 -0
  158. data/lib/webby/tasks/build.rake +27 -0
  159. data/lib/webby/tasks/create.rake +25 -0
  160. data/lib/webby/tasks/deploy.rake +22 -0
  161. data/lib/webby/tasks/growl.rake +16 -0
  162. data/lib/webby/tasks/validate.rake +19 -0
  163. data/spec/core_ext/hash_spec.rb +47 -0
  164. data/spec/core_ext/string_spec.rb +110 -0
  165. data/spec/core_ext/time_spec.rb +19 -0
  166. data/spec/data/hooligans/bad_meta_data_1.txt +34 -0
  167. data/spec/data/hooligans/bad_meta_data_2.txt +34 -0
  168. data/spec/data/html/anchor.html +11 -0
  169. data/spec/data/html/external.html +10 -0
  170. data/spec/data/html/invalid-relative.html +10 -0
  171. data/spec/data/html/relative-anchor.html +10 -0
  172. data/spec/data/html/relative-invalid-anchor.html +10 -0
  173. data/spec/data/html/relative.html +10 -0
  174. data/spec/data/outline/basic.out +81 -0
  175. data/spec/data/outline/basic.txt +25 -0
  176. data/spec/data/outline/no_clobber.out +86 -0
  177. data/spec/data/outline/numbering.out +81 -0
  178. data/spec/data/outline/numbering_only.out +21 -0
  179. data/spec/data/outline/toc_range_1.out +66 -0
  180. data/spec/data/outline/toc_range_2.out +55 -0
  181. data/spec/data/outline/toc_style.out +81 -0
  182. data/spec/data/site/Sitefile +9 -0
  183. data/spec/data/site/content/_partial.txt +10 -0
  184. data/spec/data/site/content/css/coderay.css +111 -0
  185. data/spec/data/site/content/css/site.css +67 -0
  186. data/spec/data/site/content/css/tumblog.css +308 -0
  187. data/spec/data/site/content/images/tumblog/permalink.gif +0 -0
  188. data/spec/data/site/content/images/tumblog/rss.gif +0 -0
  189. data/spec/data/site/content/index.txt +19 -0
  190. data/spec/data/site/content/photos.txt +21 -0
  191. data/spec/data/site/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
  192. data/spec/data/site/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
  193. data/spec/data/site/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
  194. data/spec/data/site/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
  195. data/spec/data/site/content/tumblog/200807/up-a-tree/index.txt +13 -0
  196. data/spec/data/site/content/tumblog/index.txt +37 -0
  197. data/spec/data/site/content/tumblog/rss.txt +37 -0
  198. data/spec/data/site/layouts/default.txt +58 -0
  199. data/spec/data/site/layouts/tumblog/default.txt +44 -0
  200. data/spec/data/site/layouts/tumblog/post.txt +15 -0
  201. data/spec/data/site/lib/breadcrumbs.rb +28 -0
  202. data/spec/data/site/lib/tumblog_helper.rb +32 -0
  203. data/spec/data/site/tasks/tumblog.rake +30 -0
  204. data/spec/data/site/templates/_partial.erb +10 -0
  205. data/spec/data/site/templates/atom_feed.erb +40 -0
  206. data/spec/data/site/templates/page.erb +18 -0
  207. data/spec/data/site/templates/presentation.erb +40 -0
  208. data/spec/data/site/templates/tumblog/conversation.erb +12 -0
  209. data/spec/data/site/templates/tumblog/link.erb +10 -0
  210. data/spec/data/site/templates/tumblog/photo.erb +13 -0
  211. data/spec/data/site/templates/tumblog/post.erb +12 -0
  212. data/spec/data/site/templates/tumblog/quote.erb +11 -0
  213. data/spec/spec.opts +1 -0
  214. data/spec/spec_helper.rb +58 -0
  215. data/spec/webby/apps/generator_spec.rb +117 -0
  216. data/spec/webby/apps/main_spec.rb +88 -0
  217. data/spec/webby/filters/basepath_spec.rb +167 -0
  218. data/spec/webby/filters/maruku_spec.rb +31 -0
  219. data/spec/webby/filters/outline_spec.rb +92 -0
  220. data/spec/webby/filters/textile_spec.rb +31 -0
  221. data/spec/webby/helpers/capture_helper_spec.rb +56 -0
  222. data/spec/webby/link_validator_spec.rb +154 -0
  223. data/spec/webby/renderer_spec.rb +139 -0
  224. data/spec/webby/resources/db_spec.rb +250 -0
  225. data/spec/webby/resources/layout_spec.rb +83 -0
  226. data/spec/webby/resources/meta_file_spec.rb +171 -0
  227. data/spec/webby/resources/page_spec.rb +129 -0
  228. data/spec/webby/resources/partial_spec.rb +58 -0
  229. data/spec/webby/resources/resource_spec.rb +219 -0
  230. data/spec/webby/resources/static_spec.rb +49 -0
  231. data/spec/webby/resources_spec.rb +69 -0
  232. data/tasks/ann.rake +80 -0
  233. data/tasks/bones.rake +20 -0
  234. data/tasks/gem.rake +192 -0
  235. data/tasks/git.rake +40 -0
  236. data/tasks/manifest.rake +48 -0
  237. data/tasks/mswin32.rake +38 -0
  238. data/tasks/notes.rake +27 -0
  239. data/tasks/post_load.rake +39 -0
  240. data/tasks/rdoc.rake +50 -0
  241. data/tasks/rubyforge.rake +55 -0
  242. data/tasks/setup.rb +279 -0
  243. data/tasks/spec.rake +54 -0
  244. data/tasks/svn.rake +47 -0
  245. data/tasks/test.rake +40 -0
  246. data/tasks/website.rake +37 -0
  247. metadata +386 -0
@@ -0,0 +1,419 @@
1
+ ---
2
+ title: User Manual
3
+ created_at: 2007-08-29 08:57:00.000000 -06:00
4
+ filter:
5
+ - erb
6
+ - textile
7
+ - outline
8
+ ---
9
+ <div class="toc push-1">
10
+
11
+ p(title). Table of Contents
12
+
13
+ <toc toc_range="h2-h6" />
14
+ </div>
15
+
16
+ h1. <%= h(@page.title) %>
17
+
18
+ h2. Introduction
19
+
20
+ Webby was created out of the desire for a simple way to build and manage small websites. The goal was a system that could take files written in plain text, combine them with a layout file and produce web pages. In this system, a single page can be written quickly without the need for HTML markup; the look and feel of the entire site can be changed by modifying the site layout file.
21
+
22
+ <% graphviz :path => "images", :alt => "Webby Overview" do %>
23
+ digraph overview {
24
+ rankdir = LR;
25
+ edge [fontname="Verdana", fontsize=8];
26
+ node [fontname="Verdana", fontsize=10];
27
+
28
+ layout [label="Layout",color="#BBBBBB",style=filled];
29
+ p1 [label="Page 1",color=red];
30
+ h1 [label="HTML 1",color=red];
31
+ p2 [label="Page 2",color=green];
32
+ h2 [label="HTML 2",color=green];
33
+ p3 [label="Page 3",color=blue];
34
+ h3 [label="HTML 3",color=blue];
35
+
36
+ p1 -> layout -> h1 [color=red];
37
+ p2 -> layout -> h2 [color=green];
38
+ p3 -> layout -> h3 [color=blue];
39
+ }
40
+ <% end %>
41
+
42
+ The diagram above shows the basic concept of how Webby works. Changing the layout file will result in changes to every generated HTML file. Changes to a single page will result in changes only to the HTML file corresponding to that particular page.
43
+
44
+ Webby does not limit the output to HTML. Webby can be used to generate XML files for RSS or Atom news feeds, CSS files for styling web pages, or any other type of text file that you can think of.
45
+
46
+ h3. Requirements
47
+
48
+ Webby is written in the Ruby programming language. To install and run Webby you will need the following applications installed on your system:
49
+
50
+ * "Ruby":http://ruby-lang.org
51
+ * "RubyGems":http://rubygems.org/read/chapter/3
52
+
53
+ h3. Installation
54
+
55
+ Webby is easily installed as a Ruby gem. From a command prompt type the following:
56
+
57
+ pre. sudo gem install webby
58
+
59
+ This will install Webby and all its required dependencies.
60
+
61
+ To make use of all the features Webby has to offer, the following gems should also be installed. These gems provide different ways to transform text into HTML or CSS.
62
+
63
+ * RedCloth
64
+ * rdiscount
65
+ * haml
66
+ * coderay
67
+ * ultraviolet
68
+
69
+ Webby can also use a few other programs to clean up generated HTML and to create pretty graphs and pictures. Where external programs are required, they will be duly noted in the manual.
70
+
71
+ h3. Running Webby
72
+
73
+ When Webby is installed, two command line programs are installed alongside the gem: @webby@ and @webby-gen@. The latter program is used to create a new Webby site folder and files. The former program is used within the site folder to generate the final site output from the content and layouts. Type @webby --help@ on the command line to see the options this program supports.
74
+
75
+ <pre>
76
+ webby --help
77
+
78
+ Usage: webby [options] task [task args]
79
+
80
+ -D, --describe [PATTERN] describe the tasks (matching optional PATTERN), then exit
81
+ -P, --prereqs display the tasks and dependencies, then exit
82
+ -T, --tasks [PATTERN] display the tasks (matching optional PATTERN) with descriptions, then exit
83
+ -t, --trace turn on invoke/execute tracing, enable full backtrace
84
+
85
+ common options:
86
+ -h, --help show this message
87
+ --version show version
88
+ </pre>
89
+
90
+ The @webby@ program is actually a smart wrapper around "Rake":http://docs.rubyrake.org/. It is used to run the tasks that will create new pages, build the output products, and deploy the site to a server. The list of available tasks can be seen by typing the following command in a Webby site folder:
91
+
92
+ pre. webby -T
93
+
94
+ The second program, @webby-gen@, is used less often but it is no less important. This is the *generate* command, and it is used to create a new Webby site folder and files. Type @webby-gen --help@ on the command line to see how the program is used.
95
+
96
+ <pre>
97
+ webby-gen --help
98
+
99
+ Usage: webby-gen [options] template site
100
+
101
+ -f, --force overwrite files that already exist
102
+ -s, --skip skip files that already exist
103
+ -u, --update update rake tasks for the site
104
+ -p, --pretend run but do not make any changes
105
+
106
+ -t, --templates list available templates
107
+
108
+ common options:
109
+ -h, --help show this message
110
+ --version show version
111
+ </pre>
112
+
113
+ The Webby generate command will create a new site folder (or update an existing site folder) using files from the desired template type. Each template is a collection of files that can be used as the starting point for a Webby project. You can see the list of available templates:
114
+
115
+ pre. webby-gen --templates
116
+
117
+ h2. Working With Resources
118
+
119
+ A resource is any file that is found in the _content_ or _layouts_ folders. Resources are either copied to the output folder or they are processed through the Webby filter engine to generate an output file. Resources fall into one of three types:
120
+
121
+ * Files
122
+ * Pages
123
+ * Layouts
124
+
125
+ Files are the simplest resource to handle. They are copied, unchanged, from the content folder to the output folder. Files include resources such as images, CSS stylesheets, and so forth. A file will be copied from its location in the content folder to its corresponding location in the output folder -- i.e. a file located at @content/some/folder/image.jpg@ would be copied to @output/some/folder/image.jpg@.
126
+
127
+ Files will only be found in the _content_ folder. The _layouts_ folder is reserved solely for layouts.
128
+
129
+ h3(#pages). Pages
130
+
131
+ Pages are found in the _content_ folder along with regular files. Pages contain *meta-data* at the top of the file; this is what differentiates a page from a regular file. The meta-data is a section of "YAML":http://www.yaml.org/spec/1.1/ formatted text that describes various properties and attributes of the page. These attributes are used by Webby to determine how the page will be processed by the filter engine.
132
+
133
+ Let's look at an example page.
134
+
135
+ <pre>
136
+ <%= Webby::YAML_SEP %>
137
+ title: Lorem Ipsum
138
+ created_at: Wed Aug 29 08:57:00 -0600 2007
139
+ filter:
140
+ - erb
141
+ - textile
142
+ <%= Webby::YAML_SEP %>
143
+ h2. <%%= @page.title %>
144
+
145
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc congue ipsum
146
+ vestibulum libero. Aenean vitae justo. Nam eget tellus. Etiam convallis, est eu
147
+ lobortis mattis, lectus tellus tempus felis, a ultricies erat ipsum at metus.
148
+ </pre>
149
+
150
+ The page meta-data is contained in the first section. It is located between the two @---@ lines. The page meta-data will not be present in the generated HTML file. Only the page content (the text below the second @---@ line) will be rendered into the final HTML file. The meta-data defines a collection of attributes that (1) are made available to the various Webby filters and (2) provide instructions to the Webby filter engine itself.
151
+
152
+ Three attributes are defined in the above example: @title@, @created_at@, and @filter@. The first attribute, @title@, is associated with the value "Lorem Ipsum". This attribute is used in the first line of the page content to render the title using a combination of the ERB and Textile filters (more can be read in the "Filters":#filters section of this manual). The example page above will result in the following snippet of HTML code.
153
+
154
+ <pre>
155
+ <h2>Lorem Ipsum</h2>
156
+
157
+ <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc congue ipsum
158
+ vestibulum libero. Aenean vitae justo. Nam eget tellus. Etiam convallis, est eu
159
+ lobortis mattis, lectus tellus tempus felis, a ultricies erat ipsum at metus.</p>
160
+ </pre>
161
+
162
+ You can see that the value of the @title@ attribute was substituted for the ERB snippet @<%%= @page.title %>@. All page attributes can be accessed using the @@page.attribute@ syntax within an ERB block. This will be discussed in greater detail in the "ERB Filter":#erbfilter section.
163
+
164
+ The last attribute in the meta-data section is the @filter@ attribute. The value for this attribute is a list of filters that will be applied to the page contents. The filters will be applied in the order they are specified. For the example page this would be the ERB filter followed by the Textile filter.
165
+
166
+ h4. Page Attributes
167
+
168
+ Attribute identifiers cannot contain spaces; they must be separated from their values by a colon. Other than that, you are free to define as many attributes as you like. Aside from defining values that can be rendered into a page, attributes are also used to find other pages in the site. Finding and linking to other pages is discussed in the "ERB Filter":#erbfilter section.
169
+
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
+
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
+ * *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
+ * *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
+ ** the meta-data of the current page for an @extension@ attribute
176
+ ** the meta-data of layout file of the current page for an @extension@ attribute
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.
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.
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.
181
+
182
+ The following attributes are defined for each page in the content folder. These attributes cannot be changed in the page's meta-data section. However, they are available to the ERB filter when rendering the contents of a page.
183
+
184
+ * *path* -- The full path to the file in the _content_ folder
185
+ * *dir* -- The relative directory in the output folder where the page will be rendered
186
+ * *name* -- The name of the file in the _content_ folder excluding any path information
187
+ * *ext* -- The extension of the file in the _content_ folder
188
+ * *mtime* -- The modification time of the file in the _content_ folder
189
+ * *url* -- A URL suitable for creating a link to the page
190
+ * *destination* -- The path in the output folder where the page will be rendered
191
+
192
+ h4. Page Filters
193
+
194
+ Filters operate on the content of a page by transforming the text of the content section according to the rules of the individual filter. Some filters transform simplified markup into true HTML syntax; examples of these are the Textile filter and the Markdown filter. Other filters will rewrite URLs (basepath filter) or clean up the generated HTML (tidy filter). All the filters are discussed in detail in the "Filters":#filters section of this document.
195
+
196
+ h3. Layouts
197
+
198
+ Layouts provide the basic framework for a page -- the header, the footer, the navigation. They provide a consistent look and feel across all pages in the website. Individual pages contain just the content for that particular page.
199
+
200
+ <% graphviz :path => "images", :class => "push-0", :alt => "layout diagram" do %>
201
+ digraph layout_graph {
202
+ rankdir = LR;
203
+ edge [fontname="Verdana", fontsize=8];
204
+ node [fontname="Verdana", fontsize=10];
205
+
206
+ page -> layout [label="rendered\ninto"];
207
+ layout -> HTML [label="results\nin"];
208
+ }
209
+ <% end %>
210
+
211
+ The diagram to the right shows a typical page rendering process. The content of a page is rendered by the Webby filter engine. The rendered content is inserted into the layout specified by the page; the content insertion occurs as the layout is being rendered. The result is the HTML that is stored in the _output_ folder.
212
+
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
+
215
+ <pre>
216
+ <%= Webby::YAML_SEP %>
217
+ extension: html
218
+ filter: erb
219
+ <%= Webby::YAML_SEP %>
220
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
221
+ <head>
222
+ <title><%= @page.title %></title>
223
+ </head>
224
+ <body>
225
+ <%%= @content %>
226
+ </body>
227
+ </html>
228
+ </pre>
229
+
230
+ The example above shows a very simple layout. The content for the current page being rendered will be inserted between the HTML body tags.
231
+
232
+ Along with the @@content@ variable, all the attributes of the current page being rendered are also accessible in the layout. The page title is inserted into the HTML title tags. But again, any page attribute can be accessed within the layout via the @@page@ variable.
233
+
234
+ h2(#filters). Filters
235
+
236
+ Filters are used in Webby to transform the text of pages and layouts. The filters applied to a page are defined in the meta-data of the page. The filters are used to transform different parts of the page contents resulting in HTML syntax, images, highlighted code, etc. Filters apply equally to pages and to layouts -- that is, pages and layouts are treated in the same manner by filters.
237
+
238
+ This section will look at the various filters provided by Webby, what those filters do, and how they should be used. Enjoy!
239
+
240
+ h3(#erbfilter). ERB
241
+
242
+ "ERB":http://ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html provides an easy to use but powerful templating system for Ruby. Using ERB, Ruby code can be added to any plain text document for the purposes of generating document information details and/or flow control. Much of the functionality Webby has to offer is made available through the erb filter. ERB does not place any limitations on the content of the page, so it is recommended to use the erb filter with another filter that simplifies the HTML markup -- Textile is my favorite, but Markdown and HAML support are provided in Webby, as well. Chose the markup language that suits your style.
243
+
244
+ Some examples of ERB have already been seen in the "pages":#pages section of this document. Ruby code is placed between ERB delimiters, @<%%= ruby code %>@ somewhere in the content section of your page or layout. The erb filter executes that code and inserts the results into the page. Webby provides quite a few features that are accessed via ERB. Page attributes are one feature, and "helper methods":#helpermethods are another that are discussed elsewhere in this manual.
245
+
246
+ <pre>
247
+ The title of this page is "<%%= @page.title" %>".
248
+ </pre>
249
+
250
+ <pre>
251
+ The title of this page is "<%= @page.title %>".
252
+ </pre>
253
+
254
+ <div class="label">Usage</div>
255
+ <div class="desc">
256
+ Include "erb" in the filter list of the page or layout that contains ERB formatting.
257
+ </div>
258
+
259
+ <div class="label">Options</div>
260
+ <div class="desc">
261
+ none
262
+ </div>
263
+
264
+ <div class="label">Require</div>
265
+ <div class="desc">
266
+ none
267
+ </div>
268
+
269
+ h3. Textile
270
+
271
+ "Textile":http://en.wikipedia.org/wiki/Textile_%28markup_language%29 is a lightweight markup language originally developed by Dean Allen and billed as a "humane Web text generator". The textile filter converts Textile formatted text into valid, well-formed XHTML.
272
+
273
+ A complete textile reference is beyond the scope of this document. Please refer to the "Textile reference":http://hobix.com/textile/ compiled by _why the luck stiff_ <sup><a href="#fn1">1</a></sup>.
274
+
275
+ The textile filter will operate on all the contents of a page or layout. Given that fact, it should be one of the last filters applied to the page. You can prevent a section of the page from being processed by the textile filter by surrounding it with @<notextile>...</notextile>@ tags.
276
+
277
+ <div class="label">Usage</div>
278
+ <div class="desc">
279
+ Include "textile" in the filter list of the page or layout that contains Textile formatting
280
+ </div>
281
+
282
+ <div class="label">Options</div>
283
+ <div class="desc">
284
+ none
285
+ </div>
286
+
287
+ <div class="label">Require</div>
288
+ <div class="desc">
289
+ The *RedCloth* gem must be installed on your system in order to use the textile filter.
290
+ </div>
291
+
292
+ fn1(fn){clear:both}. Please don't ask. Why is very smart, he wrote the Ruby code that handles Textile markup, and the code is very solid. Enjoy the benefits of his work.
293
+
294
+ h3. Markdown
295
+
296
+ "Markdown":http://daringfireball.net/projects/markdown/ is a lightweight markup language created by John Gruber. It allows you to write using an easy-to-read, easy-to-write plain text format. From the Markdown web page:
297
+
298
+ bq. The overriding design goal for Markdown's formatting syntax is to make it as readable as possible. The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it's been marked up with tags or formatting instructions. While Markdown's syntax has been influenced by several existing text-to-HTML filters, the single biggest source of inspiration for Markdown's syntax is the format of plain text email.
299
+
300
+ The markdown filter will operate on all the contents of a page or layout. Given that fact, it should be one of the last filters applied to the page.
301
+
302
+ <div class="label">Usage</div>
303
+ <div class="desc">
304
+ Include "markdown" in the filter list of the page or layout that contains Markdown formatting.
305
+ </div>
306
+
307
+ <div class="label">Options</div>
308
+ <div class="desc">
309
+ none
310
+ </div>
311
+
312
+ <div class="label">Require</div>
313
+ <div class="desc">
314
+ The *rdiscount* gem must be installed on your system in order to use the markdown filter.
315
+ </div>
316
+
317
+ h3. HAML & SASS
318
+
319
+ "HAML":http://haml.hamptoncatlin.com/ is a markup language created by Hampton Catlin that's used to cleanly and simply describe the XHTML of any web document without the use of inline code. SASS is the equivalent for CSS documents. From the HAML website:
320
+
321
+ bq. "HAML":http://haml.hamptoncatlin.com/docs/haml and "SASS":http://haml.hamptoncatlin.com/docs/sass are templating engines for the two most common types of documents on the web: HTML and CSS, respectively. They are designed to make it both easier and more pleasant to code HTML and CSS documents, by eliminating redundancy, reflecting the underlying structure that the document represents, and providing elegant, easily understandable, and powerful syntax.
322
+
323
+ Both the haml and the sass filter will operate on all the contents of a page or layout. Given that fact, these should be one of the last filters applied to the page.
324
+
325
+ <div class="label">Usage</div>
326
+ <div class="desc">
327
+ Include "haml" in the filter list of the page or layout that contains HAML formatting. Include "sass" in the filter list of the page that contains SASS formatting (this should be a CSS page).
328
+ </div>
329
+
330
+ <div class="label">Options</div>
331
+ <div class="desc">
332
+
333
+ Options are passed to the haml filter by setting the "haml_options" in the page meta-data -- the hash of options defined under the "haml_options" attribute will be passed to the haml filter engine when it is run. Please refer to the HAML documentation for the list of available options.
334
+
335
+ p(last). Options are passed to the sass filter by setting the "sass_options" in the page meta-data -- the hash of options defined under the "sass_options" attribute will be passed to the sass filter engine when it is run. Please refer to the SASS documentation for the list of available options.
336
+
337
+ </div>
338
+
339
+ <div class="label">Require</div>
340
+ <div class="desc">
341
+ The *haml* gem must be installed on your system in order to use the haml filter or the sass filter.
342
+ </div>
343
+
344
+ h3. Outline
345
+
346
+ The Outline filter is used to insert outline numbering into HTML heading tags (h1, h2, h3, etc.) and to generate a table of contents based on the heading tags. The table of contents is inserted into the page at the location of the @<toc />@ tag. If there is no @<toc />@ tag, then a table of contents will not be created but outline numbering will still take place.
347
+
348
+ If a table of contents is desired without outline numbers being inserted into the heading tags, this can be specified in the attibutes of the @<toc />@ tag itself.
349
+
350
+ <pre>
351
+ <toc numbering="off" />
352
+ </pre>
353
+
354
+ This will generate a table of contents, but not insert outline numbering into the heading tags. The full list of "TOC attributes":/rdoc/classes/Webby/Filters/Outline.html can be found in the source documentation.
355
+
356
+ The Outline filter will only work on valid HTML or XHTML pages. Therefore it should be used after any markup langauge filters (textile, markdown, etc.).
357
+
358
+ h3. BasePath
359
+
360
+ The basepath filter is used to rewrite the base path location for all URLs in a page. This is useful for the times when the publish location of the website is no at the root of the web server -- @http://your.website.com/path/to/your/site@ for example. This allows pages and resources (images, javascript, stylesheets, etc.) to be referenced from the root of the Webby web server for easy development, but the paths of these resources can easily be changed by the basepath filter when the website is being deployed.
361
+
362
+ The basepath filter only works on HTML/XHTML text, and therefore, it should be one of the last (if not the last) filter applied to your content. It is recommended to only include the basepath filter in your layout(s). The basepath filter should appear before the tidy filter.
363
+
364
+ <div class="label">Usage</div>
365
+ <div class="desc">
366
+
367
+ Include "basepath" in the filter list of your layout(s). Specify the new base path to use either as a command line argument or as an option configured in the _Rakefile_. The base path specified on the command line takes precedence over the base path specified in the Rakefile.
368
+
369
+ <pre style="margin-bottom:0">
370
+ $ webby rebuild BASE='http://your.website.com/path/to/your/site'
371
+ </pre>
372
+ </div>
373
+
374
+ <div class="label">Options</div>
375
+ <div class="desc">
376
+
377
+ Options can be passed to the basepath filter by specifying them in the project _Rakefile_.
378
+
379
+ <pre style="margin-bottom:0">
380
+ SITE.xpaths << '/html/body//img[@usemap]'
381
+ SITE.base = 'http://webby.rubyforge.org'
382
+ </pre>
383
+ </div>
384
+
385
+ <div class="label">Require</div>
386
+ <div class="desc">
387
+ none
388
+ </div>
389
+
390
+ h3(#tidy). Tidy
391
+
392
+ "Tidy":http://www.w3.org/People/Raggett/tidy/ is a useful application for cleaning up and detecting errors in XHTML text. The tidy filter will run your XHTML code through the tidy program and report any errors in the build log. From the HTML Tidy website:
393
+
394
+ bq. When editing HTML it's easy to make mistakes. Wouldn't it be nice if there was a simple way to fix these mistakes automatically and tidy up sloppy editing into nicely layed out markup? Well now there is! Dave Raggett's HTML TIDY is a free utility for doing just that. Tidy is able to fix up a wide range of problems and to bring to your attention things that you need to work on yourself. Each item found is listed with the line number and column so that you can see where the problem lies in your markup. Tidy won't generate a cleaned up version when there are problems that it can't be sure of how to handle. These are logged as "errors" rather than "warnings".
395
+
396
+ The tidy program only works on HTML/XHTML text, and therefore, tidy should be one of the last (if not the last) filter applied to your content. It is recommended to only include the tidy filter in your layout(s).
397
+
398
+ <div class="label">Usage</div>
399
+ <div class="desc">
400
+ Include "tidy" as the last item in the filter list of your layout(s).
401
+ </div>
402
+
403
+ <div class="label">Options</div>
404
+ <div class="desc">
405
+
406
+ Options can be passed to the tidy program by specifying them in the project _Rakefile_. These are the command line options that will be passed to the tidy program when it is run.
407
+
408
+ <pre style="margin-bottom:0">
409
+ SITE.tidy_options = '-indent -wrap 80'
410
+ </pre>
411
+ </div>
412
+
413
+ <div class="label">Require</div>
414
+ <div class="desc">
415
+ The HTML Tidy application must be installed on your system, and the @tidy@ executable must be available on the path.
416
+ </div>
417
+
418
+ h2. Using Rake
419
+
@@ -0,0 +1,49 @@
1
+ ---
2
+ extension: html
3
+ filter:
4
+ - erb
5
+ - basepath
6
+ ---
7
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
8
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
9
+
10
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
11
+ <head>
12
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
13
+ <title>Webby :: <%= h(@page.title) %></title>
14
+ <meta name="author" content="<%= h(@page.author) %>" />
15
+
16
+ <link rel="stylesheet" href="/css/blueprint/print.css" type="text/css" media="print" />
17
+ <link rel="stylesheet" href="/css/site.css" type="text/css" media="screen, projection" />
18
+
19
+ <script type="text/javascript" src="/script/jquery.js"></script>
20
+ <script type="text/javascript" src="/script/jquery.corner.js"></script>
21
+
22
+ <%= @page.content_for_head %>
23
+ </head>
24
+ <body>
25
+
26
+ <div class="container">
27
+
28
+ <div class="column span-17 prepend-4 append-3 first last" id="header">
29
+ <ul
30
+ ><li><%= link_to_page('Learn') %></li
31
+ ><li><%= link_to_page('Communicate') %></li
32
+ ></ul>
33
+ <h1><a href="/">Webby</a></h1>
34
+ <p>- ascii alchemy</p>
35
+ </div>
36
+
37
+ <div class="column span-17 prepend-4 append-3 last">
38
+ <%= @content %>
39
+ </div>
40
+
41
+ <div class="column span-21 prepend-2 append-1 first last" id="footer">
42
+ <hr />
43
+ <p>This website was created with <a href="http://webby.rubyforge.org">Webby</a><br />
44
+ Webby is released under the MIT license</p>
45
+ </div>
46
+
47
+ </div>
48
+ </body>
49
+ </html>