thewoolleyman-webgen 0.5.8.20090419

Sign up to get free protection for your applications and to get access to all the features.
Files changed (309) hide show
  1. data/AUTHORS +8 -0
  2. data/COPYING +10 -0
  3. data/GPL +340 -0
  4. data/Rakefile +334 -0
  5. data/THANKS +18 -0
  6. data/bin/webgen +12 -0
  7. data/data/webgen/resources.yaml +3 -0
  8. data/data/webgen/webgui/controller/main.rb +135 -0
  9. data/data/webgen/webgui/overrides/win32console.rb +0 -0
  10. data/data/webgen/webgui/public/css/jquery.autocomplete.css +50 -0
  11. data/data/webgen/webgui/public/css/ramaze_error.css +90 -0
  12. data/data/webgen/webgui/public/css/style.css +55 -0
  13. data/data/webgen/webgui/public/img/headerbg.jpg +0 -0
  14. data/data/webgen/webgui/public/img/webgen_logo.png +0 -0
  15. data/data/webgen/webgui/public/js/jquery.autocomplete.js +15 -0
  16. data/data/webgen/webgui/public/js/jquery.js +32 -0
  17. data/data/webgen/webgui/view/create_website.xhtml +22 -0
  18. data/data/webgen/webgui/view/error.xhtml +64 -0
  19. data/data/webgen/webgui/view/index.xhtml +22 -0
  20. data/data/webgen/webgui/view/manage_website.xhtml +18 -0
  21. data/data/webgen/webgui/view/page.xhtml +40 -0
  22. data/data/webgen/website_skeleton/README +10 -0
  23. data/data/webgen/website_skeleton/Rakefile +40 -0
  24. data/data/webgen/website_skeleton/config.yaml +17 -0
  25. data/data/webgen/website_skeleton/ext/init.rb +10 -0
  26. data/data/webgen/website_styles/1024px/README +13 -0
  27. data/data/webgen/website_styles/1024px/src/default.css +188 -0
  28. data/data/webgen/website_styles/1024px/src/default.template +60 -0
  29. data/data/webgen/website_styles/1024px/src/images/background.gif +0 -0
  30. data/data/webgen/website_styles/andreas00/README +13 -0
  31. data/data/webgen/website_styles/andreas00/src/default.css +290 -0
  32. data/data/webgen/website_styles/andreas00/src/default.template +60 -0
  33. data/data/webgen/website_styles/andreas00/src/images/bg.gif +0 -0
  34. data/data/webgen/website_styles/andreas00/src/images/front.jpg +0 -0
  35. data/data/webgen/website_styles/andreas00/src/images/menubg.gif +0 -0
  36. data/data/webgen/website_styles/andreas00/src/images/menubg2.gif +0 -0
  37. data/data/webgen/website_styles/andreas01/README +14 -0
  38. data/data/webgen/website_styles/andreas01/src/default.css +310 -0
  39. data/data/webgen/website_styles/andreas01/src/default.template +62 -0
  40. data/data/webgen/website_styles/andreas01/src/images/bg.gif +0 -0
  41. data/data/webgen/website_styles/andreas01/src/images/front.jpg +0 -0
  42. data/data/webgen/website_styles/andreas01/src/print.css +35 -0
  43. data/data/webgen/website_styles/andreas03/README +14 -0
  44. data/data/webgen/website_styles/andreas03/src/default.css +223 -0
  45. data/data/webgen/website_styles/andreas03/src/default.template +58 -0
  46. data/data/webgen/website_styles/andreas03/src/images/bodybg.png +0 -0
  47. data/data/webgen/website_styles/andreas03/src/images/contbg.png +0 -0
  48. data/data/webgen/website_styles/andreas03/src/images/footerbg.png +0 -0
  49. data/data/webgen/website_styles/andreas03/src/images/gradient1.png +0 -0
  50. data/data/webgen/website_styles/andreas03/src/images/gradient2.png +0 -0
  51. data/data/webgen/website_styles/andreas04/README +15 -0
  52. data/data/webgen/website_styles/andreas04/src/default.css +290 -0
  53. data/data/webgen/website_styles/andreas04/src/default.template +81 -0
  54. data/data/webgen/website_styles/andreas04/src/images/blinkarrow.gif +0 -0
  55. data/data/webgen/website_styles/andreas04/src/images/bodybg.png +0 -0
  56. data/data/webgen/website_styles/andreas04/src/images/contentbg.png +0 -0
  57. data/data/webgen/website_styles/andreas04/src/images/entrybg.png +0 -0
  58. data/data/webgen/website_styles/andreas04/src/images/flash.gif +0 -0
  59. data/data/webgen/website_styles/andreas04/src/images/flash2.gif +0 -0
  60. data/data/webgen/website_styles/andreas04/src/images/globe.gif +0 -0
  61. data/data/webgen/website_styles/andreas04/src/images/globebottom.gif +0 -0
  62. data/data/webgen/website_styles/andreas04/src/images/linkarrow.gif +0 -0
  63. data/data/webgen/website_styles/andreas04/src/images/menuhover.png +0 -0
  64. data/data/webgen/website_styles/andreas05/README +14 -0
  65. data/data/webgen/website_styles/andreas05/src/default.css +33 -0
  66. data/data/webgen/website_styles/andreas05/src/default.template +40 -0
  67. data/data/webgen/website_styles/andreas05/src/images/bodybg.gif +0 -0
  68. data/data/webgen/website_styles/andreas05/src/images/front.png +0 -0
  69. data/data/webgen/website_styles/andreas06/README +14 -0
  70. data/data/webgen/website_styles/andreas06/src/default.css +354 -0
  71. data/data/webgen/website_styles/andreas06/src/default.template +70 -0
  72. data/data/webgen/website_styles/andreas06/src/images/bodybg.gif +0 -0
  73. data/data/webgen/website_styles/andreas06/src/images/boxbg.gif +0 -0
  74. data/data/webgen/website_styles/andreas06/src/images/greypx.gif +0 -0
  75. data/data/webgen/website_styles/andreas06/src/images/header.jpg +0 -0
  76. data/data/webgen/website_styles/andreas06/src/images/innerbg.gif +0 -0
  77. data/data/webgen/website_styles/andreas06/src/images/leaves.jpg +0 -0
  78. data/data/webgen/website_styles/andreas06/src/images/tabs.gif +0 -0
  79. data/data/webgen/website_styles/andreas07/README +15 -0
  80. data/data/webgen/website_styles/andreas07/src/browserfix.css +7 -0
  81. data/data/webgen/website_styles/andreas07/src/default.css +92 -0
  82. data/data/webgen/website_styles/andreas07/src/default.template +42 -0
  83. data/data/webgen/website_styles/andreas07/src/images/bodybg.gif +0 -0
  84. data/data/webgen/website_styles/andreas07/src/images/sidebarbg.gif +0 -0
  85. data/data/webgen/website_styles/andreas08/README +14 -0
  86. data/data/webgen/website_styles/andreas08/src/default.css +224 -0
  87. data/data/webgen/website_styles/andreas08/src/default.template +51 -0
  88. data/data/webgen/website_styles/andreas09/README +14 -0
  89. data/data/webgen/website_styles/andreas09/src/default.css +308 -0
  90. data/data/webgen/website_styles/andreas09/src/default.template +68 -0
  91. data/data/webgen/website_styles/andreas09/src/images/bodybg-black.jpg +0 -0
  92. data/data/webgen/website_styles/andreas09/src/images/bodybg-green.jpg +0 -0
  93. data/data/webgen/website_styles/andreas09/src/images/bodybg-orange.jpg +0 -0
  94. data/data/webgen/website_styles/andreas09/src/images/bodybg-purple.jpg +0 -0
  95. data/data/webgen/website_styles/andreas09/src/images/bodybg-red.jpg +0 -0
  96. data/data/webgen/website_styles/andreas09/src/images/bodybg.jpg +0 -0
  97. data/data/webgen/website_styles/andreas09/src/images/footerbg.jpg +0 -0
  98. data/data/webgen/website_styles/andreas09/src/images/menuhover-black.jpg +0 -0
  99. data/data/webgen/website_styles/andreas09/src/images/menuhover-green.jpg +0 -0
  100. data/data/webgen/website_styles/andreas09/src/images/menuhover-orange.jpg +0 -0
  101. data/data/webgen/website_styles/andreas09/src/images/menuhover-purple.jpg +0 -0
  102. data/data/webgen/website_styles/andreas09/src/images/menuhover-red.jpg +0 -0
  103. data/data/webgen/website_styles/andreas09/src/images/menuhover.jpg +0 -0
  104. data/data/webgen/website_styles/simple/README +6 -0
  105. data/data/webgen/website_styles/simple/src/default.css +84 -0
  106. data/data/webgen/website_styles/simple/src/default.template +36 -0
  107. data/data/webgen/website_templates/default/README +6 -0
  108. data/data/webgen/website_templates/default/src/index.page +8 -0
  109. data/data/webgen/website_templates/project/README +5 -0
  110. data/data/webgen/website_templates/project/src/about.page +12 -0
  111. data/data/webgen/website_templates/project/src/download.page +15 -0
  112. data/data/webgen/website_templates/project/src/features.page +8 -0
  113. data/data/webgen/website_templates/project/src/index.page +9 -0
  114. data/data/webgen/website_templates/project/src/screenshots.page +18 -0
  115. data/doc/contentprocessor.template +11 -0
  116. data/doc/contentprocessor/blocks.page +129 -0
  117. data/doc/contentprocessor/builder.page +80 -0
  118. data/doc/contentprocessor/erb.page +59 -0
  119. data/doc/contentprocessor/erubis.page +46 -0
  120. data/doc/contentprocessor/fragments.page +25 -0
  121. data/doc/contentprocessor/haml.page +47 -0
  122. data/doc/contentprocessor/maruku.page +41 -0
  123. data/doc/contentprocessor/rdiscount.page +37 -0
  124. data/doc/contentprocessor/rdoc.page +36 -0
  125. data/doc/contentprocessor/redcloth.page +39 -0
  126. data/doc/contentprocessor/sass.page +31 -0
  127. data/doc/contentprocessor/tags.page +73 -0
  128. data/doc/extensions.metainfo +29 -0
  129. data/doc/extensions.page +16 -0
  130. data/doc/extensions.template +17 -0
  131. data/doc/faq.page +219 -0
  132. data/doc/getting_started.page +135 -0
  133. data/doc/index.page +65 -0
  134. data/doc/manual.page +589 -0
  135. data/doc/reference_configuration.page +959 -0
  136. data/doc/reference_metainfo.page +222 -0
  137. data/doc/source/filesystem.page +39 -0
  138. data/doc/source/tararchive.page +40 -0
  139. data/doc/sourcehandler.template +21 -0
  140. data/doc/sourcehandler/copy.page +19 -0
  141. data/doc/sourcehandler/directory.page +27 -0
  142. data/doc/sourcehandler/feed.page +105 -0
  143. data/doc/sourcehandler/metainfo.page +41 -0
  144. data/doc/sourcehandler/page.page +14 -0
  145. data/doc/sourcehandler/sitemap.page +46 -0
  146. data/doc/sourcehandler/template.page +45 -0
  147. data/doc/sourcehandler/virtual.page +49 -0
  148. data/doc/tag.template +25 -0
  149. data/doc/tag/breadcrumbtrail.page +40 -0
  150. data/doc/tag/coderay.page +49 -0
  151. data/doc/tag/date.page +31 -0
  152. data/doc/tag/executecommand.page +26 -0
  153. data/doc/tag/includefile.page +32 -0
  154. data/doc/tag/langbar.page +44 -0
  155. data/doc/tag/link.page +44 -0
  156. data/doc/tag/menu.page +106 -0
  157. data/doc/tag/metainfo.page +29 -0
  158. data/doc/tag/relocatable.page +38 -0
  159. data/doc/tag/sitemap.page +31 -0
  160. data/doc/tag/tikz.page +158 -0
  161. data/doc/upgrading.page +139 -0
  162. data/doc/webgen_page_format.page +129 -0
  163. data/lib/webgen/blackboard.rb +78 -0
  164. data/lib/webgen/cache.rb +87 -0
  165. data/lib/webgen/cli.rb +124 -0
  166. data/lib/webgen/cli/apply_command.rb +64 -0
  167. data/lib/webgen/cli/create_command.rb +66 -0
  168. data/lib/webgen/cli/run_command.rb +22 -0
  169. data/lib/webgen/cli/utils.rb +88 -0
  170. data/lib/webgen/cli/webgui_command.rb +72 -0
  171. data/lib/webgen/common.rb +21 -0
  172. data/lib/webgen/common/sitemap.rb +83 -0
  173. data/lib/webgen/configuration.rb +153 -0
  174. data/lib/webgen/contentprocessor.rb +99 -0
  175. data/lib/webgen/contentprocessor/blocks.rb +60 -0
  176. data/lib/webgen/contentprocessor/builder.rb +30 -0
  177. data/lib/webgen/contentprocessor/context.rb +89 -0
  178. data/lib/webgen/contentprocessor/erb.rb +28 -0
  179. data/lib/webgen/contentprocessor/erubis.rb +40 -0
  180. data/lib/webgen/contentprocessor/fragments.rb +25 -0
  181. data/lib/webgen/contentprocessor/haml.rb +30 -0
  182. data/lib/webgen/contentprocessor/maruku.rb +20 -0
  183. data/lib/webgen/contentprocessor/rdiscount.rb +17 -0
  184. data/lib/webgen/contentprocessor/rdoc.rb +19 -0
  185. data/lib/webgen/contentprocessor/redcloth.rb +17 -0
  186. data/lib/webgen/contentprocessor/sass.rb +20 -0
  187. data/lib/webgen/contentprocessor/tags.rb +136 -0
  188. data/lib/webgen/coreext.rb +13 -0
  189. data/lib/webgen/default_config.rb +215 -0
  190. data/lib/webgen/languages.rb +589 -0
  191. data/lib/webgen/loggable.rb +25 -0
  192. data/lib/webgen/logger.rb +97 -0
  193. data/lib/webgen/node.rb +391 -0
  194. data/lib/webgen/output.rb +82 -0
  195. data/lib/webgen/output/filesystem.rb +69 -0
  196. data/lib/webgen/page.rb +153 -0
  197. data/lib/webgen/path.rb +194 -0
  198. data/lib/webgen/source.rb +54 -0
  199. data/lib/webgen/source/filesystem.rb +61 -0
  200. data/lib/webgen/source/resource.rb +44 -0
  201. data/lib/webgen/source/stacked.rb +55 -0
  202. data/lib/webgen/source/tararchive.rb +73 -0
  203. data/lib/webgen/sourcehandler.rb +226 -0
  204. data/lib/webgen/sourcehandler/base.rb +248 -0
  205. data/lib/webgen/sourcehandler/copy.rb +43 -0
  206. data/lib/webgen/sourcehandler/directory.rb +36 -0
  207. data/lib/webgen/sourcehandler/feed.rb +117 -0
  208. data/lib/webgen/sourcehandler/fragment.rb +68 -0
  209. data/lib/webgen/sourcehandler/memory.rb +43 -0
  210. data/lib/webgen/sourcehandler/metainfo.rb +128 -0
  211. data/lib/webgen/sourcehandler/page.rb +59 -0
  212. data/lib/webgen/sourcehandler/sitemap.rb +60 -0
  213. data/lib/webgen/sourcehandler/template.rb +66 -0
  214. data/lib/webgen/sourcehandler/virtual.rb +110 -0
  215. data/lib/webgen/tag.rb +27 -0
  216. data/lib/webgen/tag/base.rb +170 -0
  217. data/lib/webgen/tag/breadcrumbtrail.rb +70 -0
  218. data/lib/webgen/tag/coderay.rb +31 -0
  219. data/lib/webgen/tag/date.rb +18 -0
  220. data/lib/webgen/tag/executecommand.rb +30 -0
  221. data/lib/webgen/tag/includefile.rb +42 -0
  222. data/lib/webgen/tag/langbar.rb +52 -0
  223. data/lib/webgen/tag/link.rb +26 -0
  224. data/lib/webgen/tag/menu.rb +207 -0
  225. data/lib/webgen/tag/metainfo.rb +25 -0
  226. data/lib/webgen/tag/relocatable.rb +54 -0
  227. data/lib/webgen/tag/sitemap.rb +41 -0
  228. data/lib/webgen/tag/tikz.rb +119 -0
  229. data/lib/webgen/tree.rb +90 -0
  230. data/lib/webgen/version.rb +8 -0
  231. data/lib/webgen/webgentask.rb +152 -0
  232. data/lib/webgen/website.rb +342 -0
  233. data/lib/webgen/websiteaccess.rb +31 -0
  234. data/lib/webgen/websitemanager.rb +127 -0
  235. data/man/man1/webgen.1 +73 -0
  236. data/misc/default.css +384 -0
  237. data/misc/default.template +75 -0
  238. data/misc/htmldoc.metainfo +25 -0
  239. data/misc/htmldoc.virtual +5 -0
  240. data/misc/images/arrow.gif +0 -0
  241. data/misc/images/error.png +0 -0
  242. data/misc/images/headerbg.jpg +0 -0
  243. data/misc/images/important.png +0 -0
  244. data/misc/images/information.png +0 -0
  245. data/misc/images/quote.gif +0 -0
  246. data/misc/images/warning.png +0 -0
  247. data/setup.rb +1585 -0
  248. data/test/helper.rb +45 -0
  249. data/test/test_blackboard.rb +60 -0
  250. data/test/test_cache.rb +59 -0
  251. data/test/test_cli.rb +21 -0
  252. data/test/test_common.rb +18 -0
  253. data/test/test_common_sitemap.rb +58 -0
  254. data/test/test_configuration.rb +68 -0
  255. data/test/test_contentprocessor.rb +33 -0
  256. data/test/test_contentprocessor_blocks.rb +68 -0
  257. data/test/test_contentprocessor_builder.rb +23 -0
  258. data/test/test_contentprocessor_context.rb +40 -0
  259. data/test/test_contentprocessor_erb.rb +23 -0
  260. data/test/test_contentprocessor_erubis.rb +49 -0
  261. data/test/test_contentprocessor_fragments.rb +42 -0
  262. data/test/test_contentprocessor_haml.rb +23 -0
  263. data/test/test_contentprocessor_maruku.rb +29 -0
  264. data/test/test_contentprocessor_rdiscount.rb +17 -0
  265. data/test/test_contentprocessor_rdoc.rb +18 -0
  266. data/test/test_contentprocessor_redcloth.rb +15 -0
  267. data/test/test_contentprocessor_sass.rb +22 -0
  268. data/test/test_contentprocessor_tags.rb +99 -0
  269. data/test/test_languages.rb +67 -0
  270. data/test/test_loggable.rb +32 -0
  271. data/test/test_logger.rb +94 -0
  272. data/test/test_node.rb +367 -0
  273. data/test/test_output_filesystem.rb +60 -0
  274. data/test/test_page.rb +214 -0
  275. data/test/test_path.rb +165 -0
  276. data/test/test_source_filesystem.rb +76 -0
  277. data/test/test_source_resource.rb +28 -0
  278. data/test/test_source_stacked.rb +36 -0
  279. data/test/test_source_tararchive.rb +65 -0
  280. data/test/test_sourcehandler_base.rb +123 -0
  281. data/test/test_sourcehandler_copy.rb +47 -0
  282. data/test/test_sourcehandler_directory.rb +42 -0
  283. data/test/test_sourcehandler_feed.rb +77 -0
  284. data/test/test_sourcehandler_fragment.rb +69 -0
  285. data/test/test_sourcehandler_memory.rb +44 -0
  286. data/test/test_sourcehandler_metainfo.rb +118 -0
  287. data/test/test_sourcehandler_page.rb +65 -0
  288. data/test/test_sourcehandler_sitemap.rb +49 -0
  289. data/test/test_sourcehandler_template.rb +65 -0
  290. data/test/test_sourcehandler_virtual.rb +87 -0
  291. data/test/test_tag_base.rb +85 -0
  292. data/test/test_tag_breadcrumbtrail.rb +91 -0
  293. data/test/test_tag_coderay.rb +32 -0
  294. data/test/test_tag_date.rb +18 -0
  295. data/test/test_tag_executecommand.rb +41 -0
  296. data/test/test_tag_includefile.rb +50 -0
  297. data/test/test_tag_langbar.rb +72 -0
  298. data/test/test_tag_link.rb +69 -0
  299. data/test/test_tag_menu.rb +207 -0
  300. data/test/test_tag_metainfo.rb +19 -0
  301. data/test/test_tag_relocatable.rb +59 -0
  302. data/test/test_tag_sitemap.rb +47 -0
  303. data/test/test_tag_tikz.rb +69 -0
  304. data/test/test_tree.rb +70 -0
  305. data/test/test_webgentask.rb +23 -0
  306. data/test/test_website.rb +98 -0
  307. data/test/test_websiteaccess.rb +25 -0
  308. data/test/test_websitemanager.rb +70 -0
  309. metadata +613 -0
data/doc/manual.page ADDED
@@ -0,0 +1,589 @@
1
+ ---
2
+ title: Manual
3
+ ---
4
+ # Introduction
5
+
6
+ This manual describes all of webgen in as much detail as possible. If you still find something
7
+ missing, don't hesistate to write a mail to the mailing list!
8
+
9
+ The manual is structured in such a way that it can be read from top to bottom while creating a
10
+ webgen website. This means that first the information on how to use the webgen CLI comes, then how a
11
+ webgen website is structured and how content can be added and so on.
12
+
13
+
14
+
15
+ # The `webgen` command {#cli}
16
+
17
+ The executable for webgen is called... webgen ;-) It uses a command style syntax (like Subversion's
18
+ `svn` or Rubygem's `gem` commands) through the [cmdparse] library. To get an overview of the
19
+ possible commands run `webgen help`.
20
+
21
+ The main command is the `render` command which does the actual website generation. This command uses
22
+ either the environment variable `WEBGEN_WEBSITE` (if it is set and non-empty) or the current working
23
+ directory as website directory if none was specified via the gloabl `-d` option. All other commands
24
+ that need a valid webgen website directory specified work in the same way.
25
+
26
+ You can invoke a command by specifying its name after the executable name. Also counting the
27
+ executable `webgen` as a command, the options for a command are specified directly after the command
28
+ name and before the next command or any arguments. For example, all the following command lines are
29
+ valid:
30
+
31
+ $ webgen
32
+ $ webgen render
33
+ $ webgen -d doc render
34
+ $ webgen -v create -t project new_site
35
+ $ webgen help create
36
+
37
+ Following is a short overview of the available commands:
38
+
39
+ * `apply [-f] STYLE`
40
+
41
+ Applies the style `STYLE` to the given webgen website. The files that will be written to website
42
+ directory are shown and the user is asked to confirm that the shown files should indeed be
43
+ written (and sometimes overwritten). If the `-f` option is used, the files are always written.
44
+
45
+ * `create [-t TEMPLATE] [-s STYLE] SITE_DIR`
46
+
47
+ Creates a basic webgen website in `SITE_DIR` using the optional template and styles. All
48
+ available templates and styles are listed in the help output for the command.
49
+
50
+ * `help`
51
+
52
+ Displays usage information. Can be used to show information about a command by using the command
53
+ name as argument, eg. `webgen help create`.
54
+
55
+ * `render`
56
+
57
+ Renders the given webgen website.
58
+
59
+ * `version`
60
+
61
+ Displays the version of webgen.
62
+
63
+ * `webgui`
64
+
65
+ Starts the webgen webgui, a browser based graphical user interface for managing webgen
66
+ websites. First the webgui web application is started and then the webgui is opened in the
67
+ default browser.
68
+
69
+ [cmdparse]: http://cmdparse.rubyforge.org
70
+
71
+
72
+
73
+ # A webgen Website {#website}
74
+
75
+ webgen needs a special directory structure so that it works out of the box. This directory structure
76
+ is automatically created by the `webgen create` command. You can alternatively use the webgui to
77
+ create the website directory.
78
+
79
+ The root directory of webgen website is called the website directory. You can have the following
80
+ files and directories under this directory:
81
+
82
+ * `src`: The source directory in which all the source files for the website are. If this directory
83
+ should not be called `src` or you want to include additional source directories, you need to
84
+ change the [`sources` configuration option]({relocatable: reference_configuration.html#sources}).
85
+
86
+ * `out`: This directory is created, if it does not exist, when webgen generates the HTML files. All
87
+ the output files are put into this directory. The name of this directory can be changed by setting
88
+ the [`output` configuration option]({relocatable: reference_configuration.html#output}).
89
+
90
+ * `ext`: The extension directory (optional). You can put self-written extensions into this directory
91
+ so that they are used by webgen. See the [extension directory]({relocatable: '#website-ext'})
92
+ section for more information.
93
+
94
+ * `config.yaml`: This file can be used to set configuration options for the website. See the
95
+ [Configuration File]({relocatable: '#website-configfile'}) section for more information.
96
+
97
+ * `Rakefile`: This file is provided for your convenience to execute tasks via `rake` and provides
98
+ some useful tasks out of the box. See the [Rakefile]({relocatable: '#website-rakefile'}) section
99
+ for more information.
100
+
101
+ ## Extension Directory {#website-ext}
102
+
103
+ The extension directory is used for modifying core behaviour of webgen or adding extensions. It is
104
+ called `ext` and has to reside directly under the website directory. All files called `init.rb` in
105
+ this directory or any of its subdirectories are loaded when webgen renders the website. So you need
106
+ to make sure to either place all extensions in `init.rb` or load them from this file. The latter
107
+ approach is better since you can use the lazy loading feature that webgen uses internally,
108
+ ie. extensions are loaded only when they are needed.
109
+
110
+ ## Configuration File {#website-configfile}
111
+
112
+ Many user will want to change some configuration options, for example, the default language of the
113
+ website since not all people will want to write websites in English. This is primarily done via the
114
+ configuration file.
115
+
116
+ The configuration file is called `config.yaml` and has to be placed directly under the website
117
+ directory. It uses [YAML](http://www.yaml.org) as file format. You can find a list of all available
118
+ configuration options that can be set in the [Configuration Options Reference]({relocatable:
119
+ reference_configuration.html}).
120
+
121
+ Each configuration option can be set in the configuration file by specifing the configuration option
122
+ name and the new value as a key/value pair. A sample configuration file looks like this:
123
+
124
+ website.lang: de
125
+ website.link_to_current_page: true
126
+
127
+ Since some configuration options have a complex structure, there exist several special configuration
128
+ keys to help setting these configuration options:
129
+
130
+ * `default_meta_info`: Set the default meta information for one or more source handlers.
131
+
132
+ This key needs needs a Hash as value which should be of the following form:
133
+
134
+ SOURCE_HANDLER_NAME:
135
+ mi_key: mi_value
136
+ other_key: other_value
137
+ :action: replace
138
+
139
+ So each entry has to specify the name of a source handler (or the special value `:all` which
140
+ sets the default meta information for all source handlers) and the meta information items that
141
+ should be set or modified. If you don't want to update the meta information hash but want to
142
+ replace it, you need to add `:action: replace` as meta information entry.
143
+
144
+ If a source handler called `Webgen::SourceHandler::SOURCE_HANDLER_NAME` exists, the meta
145
+ information is set for this source handler instead.
146
+
147
+ For example, the following snippet of a configuration file sets the meta information item
148
+ `in_menu` to `true` for `Webgen::SourceHandler::Page`:
149
+
150
+ default_meta_info:
151
+ Page:
152
+ in_menu: true
153
+
154
+ * `default_processing_pipeline`: Set the default processing pipeline for one or more source
155
+ handlers.
156
+
157
+ This key needs a Hash as value which should be of the following form:
158
+
159
+ SOURCE_HANDLER_NAME: PIPELINE
160
+
161
+ Each key-value pair specifies the name of a source handler and the new default processing
162
+ pipeline. The value for the processing pipeline has to consist of the short names of content
163
+ processors separated by commas and normally includes `erb`, `tags`, `blocks` and the name of a
164
+ content processor for a markup language. The short name(s) of a content processor is (are)
165
+ stated on its documentation page. Be aware that the content processors are executed in the order
166
+ in which they are specified!
167
+
168
+ If a source handler called `Webgen::SourceHandler::SOURCE_HANDLER_NAME` exists, the meta
169
+ information is set for this source handler instead.
170
+
171
+ For example, the following snippet of a configuration file sets the default processing pipeline
172
+ for 'Webgen::SourceHandler::Page':
173
+
174
+ default_processing_pipeline:
175
+ Page: erb,tags,textile,blocks
176
+
177
+ * `patterns`: Set the used path patterns for one or more source handlers.
178
+
179
+ This key needs a Hash value and provides two different ways of setting the path patterns:
180
+
181
+ SOURCE_HANDLER_NAME: [**/*.jpg, **/*.css]
182
+
183
+ SOURCE_HANDLER_NAME:
184
+ add: [**/*.jpg]
185
+ del: [**/*.js]
186
+
187
+ The first form replaces the path patterns for the source handler with the given patterns. The
188
+ second form allows to add or delete individual patterns.
189
+
190
+ If a source handler called `Webgen::SourceHandler::SOURCE_HANDLER_NAME` exists, the meta
191
+ information is set for this source handler instead.
192
+
193
+ For example, the following snippet of a configuration file adds the pattern `**/*.pdf` to the
194
+ patterns of `Webgen::SourceHandler::Copy`:
195
+
196
+ patterns:
197
+ Copy:
198
+ add: [**/*.pdf]
199
+
200
+ ## Rakefile {#website-rakefile}
201
+
202
+ The Rakefile that is automatically created upon website creation provides a place to specify
203
+ recurring task for your website, for example, for deploying the website to a server. It contains
204
+ some useful tasks out of the box:
205
+
206
+ * `webgen`: Renders the webgen website once.
207
+ * `auto_webgen`: Automatically renders the website when a source file has changed. This is very
208
+ useful when developing a website because you don't need to change back and forth between your
209
+ website code and the command line to rebuild the site.
210
+ * `clobber_webgen`: Removes all webgen generated products (the output files and the cache file).
211
+
212
+
213
+
214
+ # All About Paths and Sources {#source}
215
+
216
+ A source provides paths that identity files or directories. webgen can use paths from many sources.
217
+ The most commonly used source is the file system source which provides paths and information on them
218
+ from the file system.
219
+
220
+
221
+ ## Path Types {#source-types}
222
+
223
+ webgen can handle many different types of files through the different source handler classes.
224
+
225
+ The most important files are the page and template files as they are used to define the content and
226
+ the layout of a website. Have a look at the [Webgen Page Format documentation]({relocatable:
227
+ webgen_page_format.html}) to see how these files look like and how they are structured. After that
228
+ have a look at the documentation of the source handler class SourceHandler::Page and
229
+ SourceHandler::Template as they are responsible for handling these page and template files!
230
+
231
+ You can naturally use any other type of file. However, be aware that some files may not be processed
232
+ by webgen when no source handler class for them exists. For example, there is currently no source
233
+ handler class for `.svg` files, so those files would be ignored. If you just want to have files
234
+ copied from a source to the output directory (like images or CSS files), the
235
+ [SourceHandler::Copy]({relocatable: sourcehandler/copy.html}) class is what you need! Look through
236
+ the documentation of the [availabe source handler classes]({relocatable: extensions.html}) to get a
237
+ feeling of what files are handled by webgen.
238
+
239
+
240
+ ## Source Paths Naming Convention {#source-naming}
241
+
242
+ webgen assumes that the paths provided by the sources follow a special naming convention sothat meta
243
+ information can be extracted correctly from the path name:
244
+
245
+ [sort_info.]basename[.lang].extension
246
+
247
+ * `sort_info`
248
+
249
+ This part is optional and has to consist of the digits 0 to 9. Its value is used for the meta
250
+ information `sort_info`. If not specified, it defaults to the value zero.
251
+
252
+ * `basename`
253
+
254
+ This part is used on the one hand to generate the `title` meta information (but with `_` and `-`
255
+ replaced by spaces). And on the other hand, the canonical name is derived from it. `basename`
256
+ must not contain any dots, spaces or any character from the following list: ``; / ? * : ` & = +
257
+ $ ,``. If you do use one of them webgen may not work correctly!
258
+
259
+ > If two paths have the same `basename` and `extension` part, they should define the same
260
+ > content but for different languages. This allows webgen to automatically deliver the right
261
+ > language version of the content
262
+ {.important}
263
+
264
+ * `lang`
265
+
266
+ This part is optional and has to be an [ISO-639-1/2](http://www.loc.gov/standards/iso639-2/)
267
+ language identifier (two or three characters (a-z) long). If not specified, it is assumed that
268
+ the path is language independent (for example, images are normally not specific for a specific
269
+ language). However, this behaviour may be different for some source handler classes (for
270
+ example, all paths handled by SourceHandler::Page are assigned the default language if none is
271
+ set).
272
+
273
+ If the language identifier can't be matched to a valid language, it is assumed that this part
274
+ isn't actually a language identifier but a part of the extension. This also means that in the
275
+ special case where the first part of an extension is also a valid language identifier, the first
276
+ part is interpreted as language identifier and not as part of the extension.
277
+
278
+ * `extension`
279
+
280
+ The file extension can be anything and can include dots.
281
+
282
+ Following are some examples of source path names:
283
+
284
+ |Path name | Parsed meta information
285
+ |--------------------------|------------------------------------------------
286
+ |`name.png` | title: Name, language: none, sort\_info: 0, basename: name, cn: name.png
287
+ |`name.de.png` | title: Name, language: de, sort\_info: 0, basename: name, cn: name.png
288
+ |`01.name_of-file.eo.page` | title: Name of file, language: eo, sort\_info: 1, basename: name_of-file, cn: name_of-file.page
289
+ |`name.tar.bz2` | title: Name, language: none, sort\_info: 0, basename: name, cn: name.tar.bz2
290
+ |`name.de.tar.bz2` | title: Name, language: de, sort\_info: 0, basename: name, cn: name.tar.bz2
291
+
292
+ Notice: The first two and the last two examples define the same content for two different languages
293
+ (or more exactly: the first one is unlocalized and the second one localized to German) as they have
294
+ the same canonical name.
295
+
296
+
297
+ ## Canonical Name of a File ### {#source-cn}
298
+
299
+ webgen provides the functionality to define the same content in more than one language, ie. to
300
+ localize content. This is achieved with the _canonical name_ of a path, short CN.
301
+
302
+ When multiple paths share the same canonical name, webgen assumes that they have the same content
303
+ but in different languages. It is also possible to specify a _language independent_ path (i.e. one
304
+ without a language) which is used as a fallback. Therefore when a path should be resolved using a
305
+ canonical name and a given language, it is first tried to get the path in the requested language. If
306
+ this is not possible (ie. no such localization exists), the unlocalized path is returned if it
307
+ exists.
308
+
309
+ For example, assume that we have the following `src` directory:
310
+
311
+ /test.jpg
312
+ /images/my.jpg
313
+ /images/my.de.jpg
314
+ /index.page
315
+ /index.fr.page
316
+ /index.de.page
317
+
318
+ Since the path `images/my.jpg` has no language part, it is assumed to be unlocalized. In contrast,
319
+ `images/my.de.jpg` has the "same" picture but in a German version. So, when specifying
320
+ `images/my.jpg` in `index.de.page`, the correct localized version will be returned, i.e.
321
+ `images/my.de.jpg`. When specifying `images/my.jpg` in `index.page` or in `index.fr.page`, the
322
+ unlocalized version will be returned since no localized version exists.
323
+
324
+ > Directories and fragments are never localized, only files are!
325
+ {.important}
326
+
327
+ It is also possible to use the _localized canonical name_ of a path (short: LCN) to resolve it. The
328
+ localized canonical name is the same as the canonical name but with a language code inserted before
329
+ the extension. If the localized canonical name is used to resolve a path, a possibly additionally
330
+ specified language is ignored as it is assumed that the user really only wants the path in the
331
+ specified language!
332
+
333
+ Continuing the above example, this means that `images/my.de.jpg` is always returned when one
334
+ specifies `images/my.de.jpg` in any of the index page files, e.g. in `index.fr.page`.
335
+
336
+ Both canonical and localized canonical names can be absolute (ACN and ALCN) which is done by using
337
+ the full path starting with a slash. This is especially useful when you don't exactly know in which
338
+ hierarchy level a certain canoncial name gets evaluated.
339
+
340
+ Everything said above also means that all paths are not resolved using their real source or output
341
+ names but using the (localized) canonical name! So when specifying paths for extensions, for example
342
+ when using the [relocatable tag]({relocatable: tag/relocatable.html}), you always have to use the
343
+ (absolute) (localized) canonical names. This is different from previous webgen versions!
344
+
345
+
346
+ ## Output Path Name Construction ### {#source-output}
347
+
348
+ There is currently only one method, called `standard`, for creating output path names which is
349
+ described here. However, webgen allows developers to create other output path name creation
350
+ methods. More information on this can be found in the [API documentation]({relocatable: api.html}).
351
+
352
+ The output path for a given source path is constructed using the meta information
353
+ `output_path_style`. This meta information is set to a default value and can be overwritten by
354
+ setting it for a specific source handler or for a path individually. The value for this meta
355
+ information key is an array which can have the following values:
356
+
357
+ * strings (for inserting arbitrary text into output names)
358
+ * arrays (for grouping values - only interesting for the language part)
359
+ * symbols for inserting special values:
360
+ * `:cnbase`: The basename of the path.
361
+ * `:parent`: The parent path.
362
+ * `:lang`: The language.
363
+ * `:ext`: The file extension including the leading dot.
364
+ * `:year`, `:month`, `:day`: The creation year, month and day, respectively, of the source path.
365
+ An error is raised if the needed meta information `created_at` is not set on the path.
366
+
367
+ > The constructed output path must always be an absolute one, ie. it has to start at the root of the
368
+ > output directory. Therefore, the `:parent` part should always be included!
369
+ {.important}
370
+
371
+ Following are some examples of output path names for given source path names (assuming that `en` is
372
+ the default language and that the path is under a directory called `/img/`):
373
+
374
+ * `output_path_style=[:parent, :cnbase, [., :lang], :ext]` (the default)
375
+
376
+ * `index.jpg` --> `/img/index.jpg`
377
+
378
+ Since the source path is unlocalized, no language part is used and the whole sub array with
379
+ the `:lang` symbol is dropped.
380
+
381
+ * `index.en.jpg` --> `/img/index.jpg`
382
+
383
+ This happens if the configuration option `sourcehandler.default_lang_in_output_path` is
384
+ `false` and no unlocalized version of this path exists.
385
+
386
+ * `index.en.jpg` --> `/img/index.en.jpg`
387
+
388
+ Similar to the last example but this result occurs when there is an unlocalized version of
389
+ the path which is naturally named `index.jpg`!
390
+
391
+ * `index.de.jpg` --> `/img/index.de.jpg`
392
+
393
+ Since `de` is not the default language, the language part is always used!
394
+
395
+ * `output_path_style=[:parent, :cnbase, :ext, ., :lang]`
396
+
397
+ * `index.jpg` --> `/img/index.jpg.`
398
+
399
+ Be aware of the trailing dot since the `:lang` value is not defined in a sub array!
400
+
401
+ * `output_path_style=[:parent, :year, /, :month, /, :cnbase, [., :lang], :ext]`
402
+
403
+ * `index.jpg` --> `/img/2008/09/index.jpg`
404
+
405
+ This output path style can be used to create blog archive style output names.
406
+
407
+
408
+ ## Path Patterns {#source-pathpattern}
409
+
410
+ Each source handler specifies path patterns which are used to locate the files that the class can
411
+ handle. Normally these patterns are used to match file extensions, however, they are much more
412
+ powerful. For detailed information on the structure of path patterns have a look at the
413
+ [Dir.glob](http://ruby-doc.org/core/classes/Dir.html#M002375) API documentation.
414
+
415
+ The path patterns that are handled by a particular source handler are stated on its documentation
416
+ page. These patterns can be changed by modfying the configuration option `sourcehandler.patterns`
417
+ although that is not recommended except in some few cases (for example, it is useful to add some
418
+ patterns for SourceHandler::Copy). The information about how these path patterns work are useful for
419
+ the usage of webgen because of two reasons:
420
+
421
+ * so that you know which files will be processed by a specific source handler class
422
+
423
+ * so that you can specify additional path patterns for some source handlers like the
424
+ SourceHandler::Copy
425
+
426
+ Here are some example path patterns:
427
+
428
+ <table class="examples" markdown='1'>
429
+ <tr><th>Path Pattern</th><th>Result</th></tr>
430
+ <tr>
431
+ <td>`*/*.html`</td>
432
+ <td>All files with the extension `html` in the subdirectories of the source directory</td>
433
+ </tr>
434
+ <tr>
435
+ <td>`**/*.html`</td>
436
+ <td>All files with the extension `html` in all directories</td>
437
+ </tr>
438
+ <tr>
439
+ <td>`**/{foo,bar}*`</td>
440
+ <td>All files in all directories which start with `foo` or `bar`</td>
441
+ </tr>
442
+ <tr>
443
+ <td>`**/???`</td>
444
+ <td>All files in all directories whose file name is exactly three characters long</td>
445
+ </tr>
446
+ </table>
447
+
448
+
449
+ ## Handling of files in the source directory {#source-handling}
450
+
451
+ Following is the list of rules how source files are handled by webgen:
452
+
453
+ * All path names of all sources specified in the configuration option [`sources`]({relocatable:
454
+ reference_configuration.html#sources}) are fetched. Prior listed sources have priority over later
455
+ listed sources if both specify the same path.
456
+
457
+ * Those paths which match a pattern of the configuration option
458
+ [`sourcehandler.ignore`]({relocatable: reference_configuration.html#sourcehandlerignore}) are excluded.
459
+
460
+ * The source handler classes are invoked according to the invocation order specified in
461
+ [`sourcehandler.invoke`]({relocatable: reference_configuration.html#sourcehandlerinvoke}) and
462
+ they use only those paths that match one of their path patterns specified in
463
+ [`sourcehandler.patterns`]({relocatable: reference_configuration.html#sourcehandlerpatterns}).
464
+
465
+ As you might have deduced from the processing list above, it is possible that one path is handled by
466
+ multiple source handlers. This can be used, for example, to render an XML file as HTML and copy it
467
+ verbatim.
468
+
469
+
470
+ ## Path Meta Information {#source-metainfo}
471
+
472
+ Each path can have meta information, i.e. information about the path itself, associated with it, for
473
+ example the title of the path, if it should appear in a menu and so on. This meta information can be
474
+ specified in several ways, including:
475
+
476
+ * Source handlers can provide default meta information for their handled paths (set using the
477
+ configuration option [`sourcehandler.default_meta_info`]({relocatable:
478
+ reference_configuration.html#sourcehandlerdefault_meta_info}).
479
+
480
+ * Some file types allow meta information to be specified directly in the file, for example page
481
+ files in [Webgen Page Format]({relocatable: webgen_page_format.html}).
482
+
483
+ * Meta information can also be specified in special meta information backing files. These files are
484
+ handled by the source handler [SourceHandler::Metainfo]({relocatable:
485
+ sourcehandler/metainfo.html}).
486
+
487
+ There is clearly defined order in which meta information is applied to a node for a path:
488
+
489
+ 1. The path gets read by a source and some meta information is extracted from the path name.
490
+
491
+ 2. This meta information is overwritten with meta information specified for all source handlers and
492
+ then with meta information specified for the source handler that handles the path.
493
+
494
+ 3. Extensions can now overwrite meta information before the path gets handled by a source
495
+ handler. For example, the SourceHandler::Metainfo assigns meta information specified for paths at
496
+ this stage.
497
+
498
+ 4. Before the node for the path gets created, meta information from the content of the path itself
499
+ may overwrite the current meta information (this is the case, for example, with files in Webgen
500
+ Page Format).
501
+
502
+ 5. The node gets created with the provided meta information.
503
+
504
+ 6. After the node has been created, extensions may overwrite meta information again. For example,
505
+ the SourceHandler::Metainfo assigns meta information specified for nodes at this stage.
506
+
507
+
508
+
509
+ # webgen Extensions
510
+
511
+ webgen comes with many extensions that allow for rapid creation of static websites. The variety of
512
+ the extensions allows you to use your tools of choice, for example, your preferred markup
513
+ language. And if your choice is not available, you can write the extension for it yourself or make a
514
+ feature request!
515
+
516
+ Extensions are only loaded when they are needed. For example, if you don't use `.feed` files for
517
+ automatically generating atom/RSS feeds for your website, the source handler that handles these
518
+ files will never be loaded. Therefore you don't need to explicitly enable extensions, they just sit
519
+ in the background and wait till the webgen core needs them.
520
+
521
+ There are several types of extensions:
522
+
523
+ * **Content Processors**: These extensions process content, for example, the content of files in
524
+ Webgen Page Format. It is not specified how they have to process the content but this type of
525
+ extension can basically be divided into two groups:
526
+
527
+ * Markup processors: Processors like Maruku or RedCloth belong to this group and they convert
528
+ markup text that is easy to read and write to a more structure format like HTML. This allows
529
+ you to write an HTML page without knowing HTML.
530
+
531
+ * String replacers: These processors normally process special strings and substitute them with
532
+ other content. For example, the `erb` processors replaces delimited strings interpreted as
533
+ Ruby code with the interpreted value. Another example would be webgen's `tags` processor which
534
+ replaces strings like `\{relocatable: ../index.html}` with a processed value.
535
+
536
+ * **Source Handler**: These extensions are used for handling source paths. They read the content of
537
+ a path and produce one or more nodes (the internal representation of an output path, see [source
538
+ handling]({relocatable: '#source-handling'}) for more information on nodes). So a source handler
539
+ can do something simple like just copying a source path to the output directory but they can
540
+ also do complex things like creating a whole image gallery from just one source path.
541
+
542
+ * **Tags**: This type of extension allows the easy inclusion of dynamic content in, for example,
543
+ page and template files. Each tag extension is used for a specific task like creating a menu or
544
+ a breadcrumb trail.
545
+
546
+
547
+
548
+ # A webgen Run
549
+
550
+ When webgen is started, it first looks for a cache file and uses it if it exists. The cache file
551
+ provides information on the previous run and allows webgen to render only those paths that have
552
+ changed since the last time.
553
+
554
+ Each webgen run consists of one or more update/write cycles. During the update phase the internal
555
+ tree structure is updated to reflect the current situation:
556
+
557
+ * Nodes are created from newly found source paths.
558
+ * If a source path was deleted since the last webgen run, the nodes created from it will be deleted.
559
+ * All nodes in the tree are checked if they have changed and, if so, are marked for regeneration.
560
+
561
+ > The name used for describing a directory or file once it is placed in the internal tree structure
562
+ > is 'node'.
563
+ {.information}
564
+
565
+ After the update cycle has finished, the internal tree representation is up-to-date and contains all
566
+ necessary information to write its nodes. This is done in the write phase which writes out all
567
+ changed nodes.
568
+
569
+ It is possible that the internal tree structure changes during the write phase. For example, after
570
+ writing a page file fragments node for it may have been generated. After the write phase it is
571
+ checked if something like this has happened. If webgen finds such a condition, a new update/write
572
+ cycle is initiated. This is done as long as needed.
573
+
574
+ Since it is possible that multiple update/write cycles are used in one webgen run, it is shown in
575
+ the log messages when a new cycle started. This is necessary because sometimes some warning or error
576
+ log messages may be generated during an earlier cycle but the error conditions are automatically
577
+ solved in later cycles. By marking where the cycles start a user can compare the log messages of the
578
+ different cycles and see what he needs to solve himself.
579
+
580
+
581
+ # Extending webgen
582
+
583
+ If you know the programming language Ruby a little bit, you can easily extend webgen and add new
584
+ features that you need. All the needed developer documentation is available in the [API
585
+ documentation](rdoc/index.html), along with sample implementations for all major types of extensions
586
+ (source class, output classes, source handler class, content processors classes, tag classes, ...)
587
+ and detailed information about the inner workings of webgen. Have a look at the [extension
588
+ directory]({relocatable: '#website-ext'}) section for more information on naming files and where to
589
+ put the extensions.