webgen 0.5.17 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (408) hide show
  1. data/API.rdoc +143 -0
  2. data/AUTHORS +0 -1
  3. data/COPYING +17 -8
  4. data/ChangeLog +4456 -0
  5. data/GPL +623 -289
  6. data/README.md +71 -0
  7. data/Rakefile +87 -99
  8. data/VERSION +1 -1
  9. data/bin/webgen +1 -7
  10. data/data/webgen/basic_website_template/ext/init.rb +15 -0
  11. data/data/webgen/basic_website_template/webgen.config +18 -0
  12. data/data/webgen/bundle_template_files/README.md.erb +24 -0
  13. data/data/webgen/bundle_template_files/Rakefile.erb +36 -0
  14. data/data/webgen/bundle_template_files/info.yaml.erb +16 -0
  15. data/data/webgen/bundle_template_files/init.rb.erb +1 -0
  16. data/data/webgen/passive_sources/default.metainfo +32 -0
  17. data/data/webgen/passive_sources/stylesheets/coderay-default.css +109 -118
  18. data/data/webgen/passive_sources/templates/feed.template +62 -0
  19. data/data/webgen/passive_sources/templates/sitemap.template +3 -6
  20. data/data/webgen/passive_sources/templates/tag.template +42 -0
  21. data/data/webgen/website_bundles/default/README +2 -2
  22. data/lib/webgen/blackboard.rb +15 -51
  23. data/lib/webgen/bundle/built-in-show-changes/init.rb +54 -0
  24. data/lib/webgen/bundle/built-in/init.rb +366 -0
  25. data/lib/webgen/bundle_loader.rb +126 -0
  26. data/lib/webgen/cache.rb +9 -18
  27. data/lib/webgen/cli.rb +131 -58
  28. data/lib/webgen/cli/bundle_command.rb +30 -0
  29. data/lib/webgen/cli/create_bundle_command.rb +46 -0
  30. data/lib/webgen/cli/create_command.rb +48 -60
  31. data/lib/webgen/cli/generate_command.rb +25 -0
  32. data/lib/webgen/cli/install_bundle_command.rb +34 -0
  33. data/lib/webgen/cli/list_bundle_command.rb +108 -0
  34. data/lib/webgen/cli/logger.rb +45 -0
  35. data/lib/webgen/cli/show_command.rb +30 -0
  36. data/lib/webgen/cli/show_config_command.rb +63 -0
  37. data/lib/webgen/cli/show_dependencies_command.rb +103 -0
  38. data/lib/webgen/cli/show_extensions_command.rb +74 -0
  39. data/lib/webgen/cli/utils.rb +68 -95
  40. data/lib/webgen/configuration.rb +143 -105
  41. data/lib/webgen/content_processor.rb +160 -0
  42. data/lib/webgen/content_processor/blocks.rb +96 -0
  43. data/lib/webgen/content_processor/builder.rb +25 -0
  44. data/lib/webgen/content_processor/erb.rb +25 -0
  45. data/lib/webgen/content_processor/erubis.rb +31 -0
  46. data/lib/webgen/content_processor/fragments.rb +82 -0
  47. data/lib/webgen/content_processor/haml.rb +25 -0
  48. data/lib/webgen/content_processor/html_head.rb +157 -0
  49. data/lib/webgen/content_processor/kramdown.rb +49 -0
  50. data/lib/webgen/content_processor/maruku.rb +39 -0
  51. data/lib/webgen/content_processor/r_discount.rb +21 -0
  52. data/lib/webgen/content_processor/rdoc.rb +22 -0
  53. data/lib/webgen/content_processor/redcloth.rb +23 -0
  54. data/lib/webgen/content_processor/ruby.rb +20 -0
  55. data/lib/webgen/content_processor/sass.rb +145 -0
  56. data/lib/webgen/content_processor/scss.rb +23 -0
  57. data/lib/webgen/content_processor/tags.rb +30 -0
  58. data/lib/webgen/content_processor/tidy.rb +32 -0
  59. data/lib/webgen/content_processor/tikz.rb +116 -0
  60. data/lib/webgen/content_processor/xmllint.rb +31 -0
  61. data/lib/webgen/context.rb +57 -29
  62. data/lib/webgen/context/html_head.rb +60 -0
  63. data/lib/webgen/context/nodes.rb +32 -27
  64. data/lib/webgen/context/rendering.rb +39 -0
  65. data/lib/webgen/context/webgen_tags.rb +25 -0
  66. data/lib/webgen/core_ext.rb +25 -0
  67. data/lib/webgen/destination.rb +151 -0
  68. data/lib/webgen/destination/file_system.rb +62 -0
  69. data/lib/webgen/error.rb +59 -49
  70. data/lib/webgen/extension_manager.rb +121 -0
  71. data/lib/webgen/item_tracker.rb +237 -0
  72. data/lib/webgen/item_tracker/file.rb +39 -0
  73. data/lib/webgen/item_tracker/missing_node.rb +61 -0
  74. data/lib/webgen/item_tracker/node_content.rb +40 -0
  75. data/lib/webgen/item_tracker/node_meta_info.rb +53 -0
  76. data/lib/webgen/item_tracker/nodes.rb +92 -0
  77. data/lib/webgen/logger.rb +26 -82
  78. data/lib/webgen/node.rb +122 -367
  79. data/lib/webgen/node_finder.rb +336 -0
  80. data/lib/webgen/page.rb +48 -85
  81. data/lib/webgen/path.rb +218 -156
  82. data/lib/webgen/path_handler.rb +400 -0
  83. data/lib/webgen/path_handler/base.rb +220 -0
  84. data/lib/webgen/path_handler/copy.rb +78 -0
  85. data/lib/webgen/path_handler/directory.rb +21 -0
  86. data/lib/webgen/path_handler/feed.rb +82 -0
  87. data/lib/webgen/path_handler/meta_info.rb +84 -0
  88. data/lib/webgen/path_handler/page.rb +38 -0
  89. data/lib/webgen/path_handler/page_utils.rb +79 -0
  90. data/lib/webgen/path_handler/sitemap.rb +52 -0
  91. data/lib/webgen/path_handler/template.rb +96 -0
  92. data/lib/webgen/path_handler/virtual.rb +85 -0
  93. data/lib/webgen/{webgentask.rb → rake_task.rb} +31 -27
  94. data/lib/webgen/source.rb +106 -24
  95. data/lib/webgen/source/file_system.rb +41 -0
  96. data/lib/webgen/source/stacked.rb +49 -53
  97. data/lib/webgen/source/tar_archive.rb +59 -0
  98. data/lib/webgen/tag.rb +250 -19
  99. data/lib/webgen/tag/breadcrumb_trail.rb +65 -0
  100. data/lib/webgen/tag/coderay.rb +32 -35
  101. data/lib/webgen/tag/date.rb +9 -9
  102. data/lib/webgen/tag/execute_command.rb +31 -0
  103. data/lib/webgen/tag/include_file.rb +32 -0
  104. data/lib/webgen/tag/langbar.rb +31 -47
  105. data/lib/webgen/tag/link.rb +17 -18
  106. data/lib/webgen/tag/menu.rb +27 -189
  107. data/lib/webgen/tag/meta_info.rb +31 -0
  108. data/lib/webgen/tag/relocatable.rb +48 -39
  109. data/lib/webgen/tag/tikz.rb +24 -100
  110. data/lib/webgen/task.rb +99 -0
  111. data/lib/webgen/task/create_bundle.rb +73 -0
  112. data/lib/webgen/task/create_website.rb +94 -0
  113. data/lib/webgen/task/generate_website.rb +47 -0
  114. data/lib/webgen/test_helper.rb +183 -0
  115. data/lib/webgen/tree.rb +95 -46
  116. data/lib/webgen/utils.rb +39 -0
  117. data/lib/webgen/utils/external_command.rb +27 -0
  118. data/lib/webgen/utils/tag_parser.rb +124 -0
  119. data/lib/webgen/version.rb +1 -1
  120. data/lib/webgen/website.rb +134 -296
  121. data/setup.rb +1 -1
  122. data/test/test_documentation.rb +43 -0
  123. data/test/webgen/cli/test_logger.rb +41 -0
  124. data/test/{test_contentprocessor_blocks.rb → webgen/content_processor/test_blocks.rb} +30 -28
  125. data/test/webgen/content_processor/test_builder.rb +25 -0
  126. data/test/webgen/content_processor/test_erb.rb +21 -0
  127. data/test/webgen/content_processor/test_erubis.rb +33 -0
  128. data/test/webgen/content_processor/test_fragments.rb +96 -0
  129. data/test/webgen/content_processor/test_haml.rb +24 -0
  130. data/test/webgen/content_processor/test_html_head.rb +78 -0
  131. data/test/webgen/content_processor/test_kramdown.rb +49 -0
  132. data/test/webgen/content_processor/test_maruku.rb +30 -0
  133. data/test/webgen/content_processor/test_r_discount.rb +18 -0
  134. data/test/webgen/content_processor/test_rdoc.rb +18 -0
  135. data/test/webgen/content_processor/test_redcloth.rb +23 -0
  136. data/test/webgen/content_processor/test_ruby.rb +24 -0
  137. data/test/webgen/content_processor/test_sass.rb +44 -0
  138. data/test/webgen/content_processor/test_scss.rb +23 -0
  139. data/test/webgen/content_processor/test_tags.rb +44 -0
  140. data/test/webgen/content_processor/test_tidy.rb +31 -0
  141. data/test/webgen/content_processor/test_tikz.rb +33 -0
  142. data/test/webgen/content_processor/test_xmllint.rb +32 -0
  143. data/test/webgen/destination/test_file_system.rb +54 -0
  144. data/test/webgen/item_tracker/test_file.rb +31 -0
  145. data/test/webgen/item_tracker/test_missing_node.rb +70 -0
  146. data/test/webgen/item_tracker/test_node_content.rb +42 -0
  147. data/test/webgen/item_tracker/test_node_meta_info.rb +44 -0
  148. data/test/webgen/item_tracker/test_nodes.rb +61 -0
  149. data/test/webgen/path_handler/test_base.rb +153 -0
  150. data/test/webgen/path_handler/test_copy.rb +56 -0
  151. data/test/webgen/path_handler/test_feed.rb +85 -0
  152. data/test/webgen/path_handler/test_meta_info.rb +98 -0
  153. data/test/webgen/path_handler/test_page.rb +25 -0
  154. data/test/webgen/path_handler/test_page_utils.rb +59 -0
  155. data/test/webgen/path_handler/test_sitemap.rb +95 -0
  156. data/test/webgen/path_handler/test_template.rb +64 -0
  157. data/test/webgen/path_handler/test_virtual.rb +87 -0
  158. data/test/webgen/source/test_file_system.rb +51 -0
  159. data/test/webgen/source/test_stacked.rb +35 -0
  160. data/test/{test_source_tararchive.rb → webgen/source/test_tar_archive.rb} +10 -25
  161. data/test/webgen/tag/test_breadcrumb_trail.rb +66 -0
  162. data/test/webgen/tag/test_coderay.rb +34 -0
  163. data/test/webgen/tag/test_date.rb +18 -0
  164. data/test/webgen/tag/test_execute_command.rb +36 -0
  165. data/test/webgen/tag/test_include_file.rb +35 -0
  166. data/test/webgen/tag/test_langbar.rb +50 -0
  167. data/test/webgen/tag/test_link.rb +40 -0
  168. data/test/webgen/tag/test_menu.rb +61 -0
  169. data/test/webgen/tag/test_meta_info.rb +25 -0
  170. data/test/webgen/tag/test_relocatable.rb +50 -0
  171. data/test/webgen/tag/test_tikz.rb +41 -0
  172. data/test/webgen/task/test_create_website.rb +46 -0
  173. data/test/webgen/test_blackboard.rb +31 -0
  174. data/test/webgen/test_bundle_loader.rb +55 -0
  175. data/test/{test_cache.rb → webgen/test_cache.rb} +3 -15
  176. data/test/webgen/test_cli.rb +41 -0
  177. data/test/webgen/test_configuration.rb +131 -0
  178. data/test/webgen/test_content_processor.rb +86 -0
  179. data/test/webgen/test_context.rb +73 -0
  180. data/test/webgen/test_core_ext.rb +20 -0
  181. data/test/webgen/test_destination.rb +48 -0
  182. data/test/webgen/test_error.rb +121 -0
  183. data/test/webgen/test_extension_manager.rb +70 -0
  184. data/test/webgen/test_item_tracker.rb +106 -0
  185. data/test/{test_languages.rb → webgen/test_languages.rb} +4 -4
  186. data/test/webgen/test_logger.rb +46 -0
  187. data/test/webgen/test_node.rb +178 -0
  188. data/test/webgen/test_node_finder.rb +127 -0
  189. data/test/{test_page.rb → webgen/test_page.rb} +44 -48
  190. data/test/webgen/test_path.rb +271 -0
  191. data/test/{test_webgentask.rb → webgen/test_rake_task.rb} +4 -4
  192. data/test/webgen/test_source.rb +59 -0
  193. data/test/webgen/test_tag.rb +137 -0
  194. data/test/webgen/test_task.rb +40 -0
  195. data/test/webgen/test_tree.rb +147 -0
  196. data/test/webgen/test_utils.rb +16 -0
  197. data/test/webgen/test_website.rb +45 -0
  198. data/test/webgen/utils/test_tag_parser.rb +99 -0
  199. metadata +292 -344
  200. data/data/webgen/passive_sources/templates/atom_feed.template +0 -39
  201. data/data/webgen/passive_sources/templates/rss_feed.template +0 -28
  202. data/data/webgen/resources.yaml +0 -4
  203. data/data/webgen/webgui/app.rb +0 -11
  204. data/data/webgen/webgui/controller/main.rb +0 -135
  205. data/data/webgen/webgui/layout/default.xhtml +0 -40
  206. data/data/webgen/webgui/overrides/win32console.rb +0 -0
  207. data/data/webgen/webgui/public/css/jquery.autocomplete.css +0 -50
  208. data/data/webgen/webgui/public/css/ramaze_error.css +0 -90
  209. data/data/webgen/webgui/public/css/style.css +0 -55
  210. data/data/webgen/webgui/public/img/headerbg.jpg +0 -0
  211. data/data/webgen/webgui/public/img/webgen_logo.png +0 -0
  212. data/data/webgen/webgui/public/js/jquery.autocomplete.js +0 -15
  213. data/data/webgen/webgui/public/js/jquery.js +0 -32
  214. data/data/webgen/webgui/start.rb +0 -9
  215. data/data/webgen/webgui/view/create_website.xhtml +0 -14
  216. data/data/webgen/webgui/view/error.xhtml +0 -64
  217. data/data/webgen/webgui/view/index.xhtml +0 -22
  218. data/data/webgen/webgui/view/manage_website.xhtml +0 -18
  219. data/data/webgen/website_skeleton/README +0 -10
  220. data/data/webgen/website_skeleton/Rakefile +0 -69
  221. data/data/webgen/website_skeleton/config.yaml +0 -35
  222. data/data/webgen/website_skeleton/ext/init.rb +0 -10
  223. data/doc/contentprocessor.template +0 -11
  224. data/doc/contentprocessor/blocks.page +0 -129
  225. data/doc/contentprocessor/builder.page +0 -79
  226. data/doc/contentprocessor/erb.page +0 -60
  227. data/doc/contentprocessor/erubis.page +0 -46
  228. data/doc/contentprocessor/fragments.page +0 -26
  229. data/doc/contentprocessor/haml.page +0 -46
  230. data/doc/contentprocessor/head.page +0 -31
  231. data/doc/contentprocessor/kramdown.page +0 -49
  232. data/doc/contentprocessor/less.page +0 -34
  233. data/doc/contentprocessor/maruku.page +0 -44
  234. data/doc/contentprocessor/rdiscount.page +0 -37
  235. data/doc/contentprocessor/rdoc.page +0 -36
  236. data/doc/contentprocessor/redcloth.page +0 -41
  237. data/doc/contentprocessor/sass.page +0 -31
  238. data/doc/contentprocessor/scss.page +0 -39
  239. data/doc/contentprocessor/tags.page +0 -73
  240. data/doc/contentprocessor/tidy.page +0 -14
  241. data/doc/contentprocessor/xmllint.page +0 -14
  242. data/doc/extensions.metainfo +0 -29
  243. data/doc/extensions.page +0 -15
  244. data/doc/extensions.template +0 -17
  245. data/doc/faq.page +0 -222
  246. data/doc/getting_started.page +0 -135
  247. data/doc/index.page +0 -71
  248. data/doc/manual.page +0 -727
  249. data/doc/reference_configuration.page +0 -1254
  250. data/doc/reference_metainfo.page +0 -265
  251. data/doc/reference_website_styles.page +0 -32
  252. data/doc/source/filesystem.page +0 -41
  253. data/doc/source/tararchive.page +0 -40
  254. data/doc/sourcehandler.template +0 -23
  255. data/doc/sourcehandler/copy.page +0 -19
  256. data/doc/sourcehandler/directory.page +0 -27
  257. data/doc/sourcehandler/feed.page +0 -102
  258. data/doc/sourcehandler/metainfo.page +0 -48
  259. data/doc/sourcehandler/page.page +0 -14
  260. data/doc/sourcehandler/sitemap.page +0 -46
  261. data/doc/sourcehandler/template.page +0 -45
  262. data/doc/sourcehandler/virtual.page +0 -49
  263. data/doc/tag.template +0 -25
  264. data/doc/tag/breadcrumbtrail.page +0 -40
  265. data/doc/tag/coderay.page +0 -53
  266. data/doc/tag/date.page +0 -31
  267. data/doc/tag/executecommand.page +0 -26
  268. data/doc/tag/includefile.page +0 -32
  269. data/doc/tag/langbar.page +0 -47
  270. data/doc/tag/link.page +0 -44
  271. data/doc/tag/menu.page +0 -109
  272. data/doc/tag/metainfo.page +0 -29
  273. data/doc/tag/relocatable.page +0 -38
  274. data/doc/tag/sitemap.page +0 -31
  275. data/doc/tag/tikz.page +0 -159
  276. data/doc/upgrading.page +0 -138
  277. data/doc/webgen_page_format.page +0 -129
  278. data/doc/website_styles.metainfo +0 -8
  279. data/lib/webgen/cli/apply_command.rb +0 -66
  280. data/lib/webgen/cli/run_command.rb +0 -22
  281. data/lib/webgen/cli/webgui_command.rb +0 -68
  282. data/lib/webgen/common.rb +0 -27
  283. data/lib/webgen/common/sitemap.rb +0 -83
  284. data/lib/webgen/contentprocessor.rb +0 -117
  285. data/lib/webgen/contentprocessor/blocks.rb +0 -92
  286. data/lib/webgen/contentprocessor/builder.rb +0 -29
  287. data/lib/webgen/contentprocessor/erb.rb +0 -26
  288. data/lib/webgen/contentprocessor/erubis.rb +0 -39
  289. data/lib/webgen/contentprocessor/fragments.rb +0 -25
  290. data/lib/webgen/contentprocessor/haml.rb +0 -34
  291. data/lib/webgen/contentprocessor/head.rb +0 -128
  292. data/lib/webgen/contentprocessor/kramdown.rb +0 -27
  293. data/lib/webgen/contentprocessor/kramdown/html.rb +0 -36
  294. data/lib/webgen/contentprocessor/less.rb +0 -35
  295. data/lib/webgen/contentprocessor/maruku.rb +0 -36
  296. data/lib/webgen/contentprocessor/rdiscount.rb +0 -19
  297. data/lib/webgen/contentprocessor/rdoc.rb +0 -20
  298. data/lib/webgen/contentprocessor/redcloth.rb +0 -21
  299. data/lib/webgen/contentprocessor/sass.rb +0 -22
  300. data/lib/webgen/contentprocessor/scss.rb +0 -22
  301. data/lib/webgen/contentprocessor/tags.rb +0 -170
  302. data/lib/webgen/contentprocessor/tidy.rb +0 -38
  303. data/lib/webgen/contentprocessor/xmllint.rb +0 -37
  304. data/lib/webgen/context/render.rb +0 -32
  305. data/lib/webgen/context/tags.rb +0 -20
  306. data/lib/webgen/coreext.rb +0 -13
  307. data/lib/webgen/default_config.rb +0 -240
  308. data/lib/webgen/loggable.rb +0 -25
  309. data/lib/webgen/output.rb +0 -86
  310. data/lib/webgen/output/filesystem.rb +0 -69
  311. data/lib/webgen/source/filesystem.rb +0 -61
  312. data/lib/webgen/source/resource.rb +0 -45
  313. data/lib/webgen/source/tararchive.rb +0 -78
  314. data/lib/webgen/sourcehandler.rb +0 -275
  315. data/lib/webgen/sourcehandler/base.rb +0 -281
  316. data/lib/webgen/sourcehandler/copy.rb +0 -44
  317. data/lib/webgen/sourcehandler/directory.rb +0 -30
  318. data/lib/webgen/sourcehandler/feed.rb +0 -92
  319. data/lib/webgen/sourcehandler/fragment.rb +0 -70
  320. data/lib/webgen/sourcehandler/memory.rb +0 -42
  321. data/lib/webgen/sourcehandler/metainfo.rb +0 -128
  322. data/lib/webgen/sourcehandler/page.rb +0 -64
  323. data/lib/webgen/sourcehandler/sitemap.rb +0 -60
  324. data/lib/webgen/sourcehandler/template.rb +0 -66
  325. data/lib/webgen/sourcehandler/virtual.rb +0 -117
  326. data/lib/webgen/tag/base.rb +0 -170
  327. data/lib/webgen/tag/breadcrumbtrail.rb +0 -70
  328. data/lib/webgen/tag/executecommand.rb +0 -31
  329. data/lib/webgen/tag/includefile.rb +0 -42
  330. data/lib/webgen/tag/metainfo.rb +0 -27
  331. data/lib/webgen/tag/sitemap.rb +0 -41
  332. data/lib/webgen/websiteaccess.rb +0 -31
  333. data/lib/webgen/websitemanager.rb +0 -125
  334. data/misc/default.css +0 -403
  335. data/misc/default.template +0 -76
  336. data/misc/htmldoc.metainfo +0 -26
  337. data/misc/htmldoc.virtual +0 -17
  338. data/misc/images/arrow.gif +0 -0
  339. data/misc/images/error.png +0 -0
  340. data/misc/images/headerbg.jpg +0 -0
  341. data/misc/images/important.png +0 -0
  342. data/misc/images/information.png +0 -0
  343. data/misc/images/quote.gif +0 -0
  344. data/misc/images/warning.png +0 -0
  345. data/misc/logo.svg +0 -313
  346. data/misc/style.page +0 -33
  347. data/test/helper.rb +0 -61
  348. data/test/test_blackboard.rb +0 -60
  349. data/test/test_cli.rb +0 -119
  350. data/test/test_common_sitemap.rb +0 -58
  351. data/test/test_configuration.rb +0 -68
  352. data/test/test_contentprocessor.rb +0 -39
  353. data/test/test_contentprocessor_builder.rb +0 -41
  354. data/test/test_contentprocessor_erb.rb +0 -33
  355. data/test/test_contentprocessor_erubis.rb +0 -62
  356. data/test/test_contentprocessor_fragments.rb +0 -43
  357. data/test/test_contentprocessor_haml.rb +0 -39
  358. data/test/test_contentprocessor_head.rb +0 -96
  359. data/test/test_contentprocessor_kramdown.rb +0 -56
  360. data/test/test_contentprocessor_less.rb +0 -40
  361. data/test/test_contentprocessor_maruku.rb +0 -33
  362. data/test/test_contentprocessor_rdiscount.rb +0 -21
  363. data/test/test_contentprocessor_rdoc.rb +0 -22
  364. data/test/test_contentprocessor_redcloth.rb +0 -26
  365. data/test/test_contentprocessor_sass.rb +0 -28
  366. data/test/test_contentprocessor_scss.rb +0 -28
  367. data/test/test_contentprocessor_tags.rb +0 -122
  368. data/test/test_contentprocessor_tidy.rb +0 -34
  369. data/test/test_contentprocessor_xmllint.rb +0 -38
  370. data/test/test_context.rb +0 -81
  371. data/test/test_error.rb +0 -93
  372. data/test/test_loggable.rb +0 -32
  373. data/test/test_logger.rb +0 -94
  374. data/test/test_node.rb +0 -469
  375. data/test/test_output_filesystem.rb +0 -60
  376. data/test/test_path.rb +0 -241
  377. data/test/test_source_filesystem.rb +0 -76
  378. data/test/test_source_resource.rb +0 -28
  379. data/test/test_source_stacked.rb +0 -49
  380. data/test/test_sourcehandler_base.rb +0 -136
  381. data/test/test_sourcehandler_copy.rb +0 -47
  382. data/test/test_sourcehandler_directory.rb +0 -38
  383. data/test/test_sourcehandler_feed.rb +0 -88
  384. data/test/test_sourcehandler_fragment.rb +0 -70
  385. data/test/test_sourcehandler_main.rb +0 -39
  386. data/test/test_sourcehandler_memory.rb +0 -44
  387. data/test/test_sourcehandler_metainfo.rb +0 -127
  388. data/test/test_sourcehandler_page.rb +0 -73
  389. data/test/test_sourcehandler_sitemap.rb +0 -68
  390. data/test/test_sourcehandler_template.rb +0 -68
  391. data/test/test_sourcehandler_virtual.rb +0 -106
  392. data/test/test_tag_base.rb +0 -62
  393. data/test/test_tag_breadcrumbtrail.rb +0 -91
  394. data/test/test_tag_coderay.rb +0 -45
  395. data/test/test_tag_date.rb +0 -18
  396. data/test/test_tag_executecommand.rb +0 -41
  397. data/test/test_tag_includefile.rb +0 -50
  398. data/test/test_tag_langbar.rb +0 -71
  399. data/test/test_tag_link.rb +0 -70
  400. data/test/test_tag_menu.rb +0 -207
  401. data/test/test_tag_metainfo.rb +0 -26
  402. data/test/test_tag_relocatable.rb +0 -60
  403. data/test/test_tag_sitemap.rb +0 -47
  404. data/test/test_tag_tikz.rb +0 -69
  405. data/test/test_tree.rb +0 -70
  406. data/test/test_website.rb +0 -130
  407. data/test/test_websiteaccess.rb +0 -25
  408. data/test/test_websitemanager.rb +0 -65
@@ -1,135 +0,0 @@
1
- ---
2
- title: Getting Started Guide
3
- ---
4
- ## Tutorial: Creating a Basic Website
5
-
6
-
7
- ### Creating the Basic Directories
8
-
9
- webgen needs a special directory structure so that it works out of the box. Basically, you have a
10
- website directory under which the following directories are located:
11
-
12
- * `src`: The source directory in which all the source files for the website are.
13
-
14
- * `out`: This directory is created, if it does not exist, when webgen generates the HTML files. All
15
- the output files are put into this directory.
16
-
17
- * `ext`: The extension directory (optional). You can put self-written extensions into this directory
18
- so that they are used by webgen.
19
-
20
- The directory in which these directories are in is called the *website directory*.
21
-
22
- Don't worry too much about these directories since webgen is able to create the correct directory
23
- structure for you. By running the command `webgen create sample_site`, the website directory
24
- `sample_site` is created with the default website bundles applied. You can naturally use any
25
- available bundles by passing their names to the `-b` option of the `create` command.
26
-
27
- > A *website bundle* defines some starting content for a website. The `default` bundle defines just
28
- > a sample content file sothat some output can be viewed after webgen is run. All other bundles are
29
- > style bundles which define the look and feel of your website. webgen comes with many predefined
30
- > style bundles and nearly all of them are converted open source web design styles.
31
- {:.information}
32
-
33
- Don't worry if you don't like the used website style - you can easily change it later using the
34
- `webgen apply` command. Have a look at the [Website Styles Reference](reference_website_styles.html)
35
- to see demonstrations for all shipped website templates and styles!
36
-
37
- Since the basic parts are now in place, you can generate the HTML files. There are two
38
- possibilities:
39
-
40
- * Either you change into the `sample_site` directory and run the command `webgen`.
41
-
42
- * Or you run webgen from any directory and specify the website directory using the `-d` option, for
43
- example `webgen -d sample_site`.
44
-
45
- Easy! webgen has used all files in the `src` directory and created the HTML output in the directory
46
- `out`. Now you just need to open the `out/index.html` file to view your website! However, as we did
47
- not write any content yet, there is not much to see (only the default page). So let's do that now!
48
-
49
- > If you run webgen in verbose mode, it prints out information about the written files. Note,
50
- > however, that the shown paths are the **internal** path names which may be different from the
51
- > actual output path names!
52
- {:.information}
53
-
54
- > Since webgen automatically creates relative links, you will have a fully functional website
55
- > without needing a web server! This also implies that you can deploy your website to any directory
56
- > on your web server and it will *just work*!
57
- {:.information}
58
-
59
-
60
- ### Adding Content
61
-
62
- When using the `create` command, webgen does not only create the needed directories but it also
63
- provides you with some default files, you will normally have at least the following ones:
64
-
65
- * `src/default.template`: The default template for the new website.
66
- * `src/default.css`: The default css file for the new website.
67
- * `src/index.page`: The index file for the root directory of the website.
68
- * `config.yaml`: The configuration file for setting configuration options.
69
-
70
- > *Template files* and *page files* are the heart of webgen. Template files are used to define a
71
- > general layout for web pages and page files define the real content. Both file types are written
72
- > in [Webgen Page Format](webgen_page_format.html). Page files are normally written in a markup
73
- > language like Markdown or Textile which is easier to learn and edit for non-technical persons.
74
- {:.information}
75
-
76
- The basic scaffolding is already in place. Now we only have to adapt the page file `index.page` and
77
- add other page files.
78
-
79
- All page files are written using the Webgen Page Format. Basically, you have an optional meta
80
- information block at the beginning of the file and one or more content blocks. Blocks are separated
81
- by three dashes (ie. `---`) on a separate line and if you want to have a meta information block you
82
- need to have a block separator line at the beginning of your file.
83
-
84
- Open the file `index.page` in your favorite text editor and change its content (ie. the first
85
- content block). After that create a new file, `hello.page`, in the source directory with the
86
- following content:
87
-
88
- ---
89
- title: Sample hello page
90
- in_menu: true
91
- ---
92
- This is a sample page with the title "\{title:}" and it is in the menu!!!
93
-
94
- We define two meta information items (namely `title` and `in_menu`) and added some content to the
95
- first content block. Run webgen again and open `out/index.html` to view your changes. Add
96
- page files and other content to your website and let it grow!
97
-
98
-
99
- ### Adding Dynamic Content
100
-
101
- A static website is, as the name implies, static. However, since we generate the website it is
102
- possible to add some dynamicity to it. For example, it gets very tedious to update menu links every
103
- time we add a file that should be in the menu.
104
-
105
- Therefore webgen provides two ways to add dynamic content out of the box:
106
-
107
- * *ERB*: This term stands for "embedded ruby". It means that you can embed ruby statements in page
108
- and templates files that get evaluated when the files are rendered.
109
-
110
- * *webgen tags*: These are a way to add dynamic content without knowing a programming language
111
- (although limiting you to the existing tags). You just state what tag you want to use and it does
112
- its job. For example, there exists a very flexible menu generation tag.
113
-
114
- You have already encountered a webgen tag in the last section when you created the `hello.page`
115
- file: the `\{title:}` part. webgen tags can generally be specified like this: `\{tagname: {param:
116
- value, param2: value2}}`. For detailed information on tags have a look at the
117
- [Webgen::ContentProcessor::Tags](contentprocessor/tags.html) documentation.
118
-
119
-
120
- ### Setting configuration options
121
-
122
- webgen provides a default configuration out of the box. If you can live with that, you do not need
123
- to change any configuration option. However, most users need to change some configuration option
124
- sometime. The configuration file is called `config.yaml` and has to be placed directly under the
125
- website directory. It uses YAML as file format.
126
-
127
- > Have a look at the [Configuration Options Reference](reference_configuration.html) to get an
128
- > overview over all available configuration options.
129
- {:.information}
130
-
131
- Each configuration option can be set in the configuration file by specifing the configuration option
132
- name and the new value as a key/value pair. A sample configuration file looks like this:
133
-
134
- website.lang: de
135
- website.link_to_current_page: true
data/doc/index.page DELETED
@@ -1,71 +0,0 @@
1
- ---
2
- title: Overview
3
- in_menu: false
4
- ---
5
-
6
- This documentation is for the *repository version*{: style='color: red; font-weight: bold'} of
7
- webgen and therefore may state features that are not available in the latest released version.
8
-
9
- * The documentation for the *latest released 0.5.x*{: style='color: red; font-weight: bold'} version
10
- can be found [here](http://webgen.rubyforge.org/documentation/0.5.x/index.html). This
11
- documentation can also be generated locally by running `rake htmldoc` in the root directory of the
12
- weben distribution.
13
-
14
- * If you are looking for the documentation of the *0.4.x*{: style='color: red; font-weight: bold'}
15
- series, it can be found [here](http://webgen.rubyforge.org/documentation/0.4.x/index.html).
16
-
17
- If you don't find an answer to your questions in the documentation, there are also:
18
-
19
- * [forums][forum] hosted on Rubyforge
20
- * [mailing lists][ml] hosted on Rubyforge (the `webgen-users` mailing list is mirrored to the
21
- [webgen-users google group][google-group])
22
- * the IRC channel `#webgen` on Freenode where I can be found whenever I'm online.
23
-
24
- [forum]: http://rubyforge.org/forum/?group_id=296
25
- [ml]: http://rubyforge.org/mail/?group_id=296
26
- [google-group]: http://groups.google.com/group/webgen-users/
27
-
28
- # User Documentation
29
-
30
- Depending on whether you are new to webgen, you want more information about a specific topic or read
31
- a reference, go to one of the following pages:
32
-
33
- * [**Getting Started Guide**](getting_started.html): If you are new to webgen, this should be your
34
- first read. It explains the usage of the CLI command and how to create your first website with
35
- webgen.
36
-
37
- * [**Manual**](manual.html): Detailed information about how webgen works can be found here. After
38
- reading the Getting Started Guide, this should be the next read. Have a look at the section
39
- headers to get a quick overview of what can be found here.
40
-
41
- * [**FAQ**](faq.html): If you want to do something with webgen, but you don't know how, this page is
42
- exactly for you. It provides answers to frequently asked questions and HowTos. If you have a
43
- question which you think should be added, just mail me.
44
-
45
- * [**Upgrade information**](upgrading.html): This document provides some information on upgrading a
46
- website from the 0.4.x to the 0.5.x series.
47
-
48
-
49
- Following is a list of all the reference documentation of webgen:
50
-
51
- * [**Extensions Documentation**](extensions.html): Detailed information on every usage related
52
- extension class (**source handlers, tags, content processors**, ...)
53
-
54
- * [**Webgen Page Format**](webgen_page_format.html): Information about/Specification of the format
55
- used, for example, by page and template files
56
-
57
- * [**Meta Information Reference**](reference_metainfo.html): Descriptions for every meta information
58
- key that is used by webgen.
59
-
60
- * [**Configuration Options Reference**](reference_configuration.html): Overview of all configuration
61
- options.
62
-
63
- * [**Website Styles Reference**](reference_website_styles.html): Previews of all website styles that
64
- ship with webgen.
65
-
66
-
67
- # Developer Documentation
68
-
69
- webgen makes it easy to extend its functionality by writing simple extension classes. All
70
- information about how to do this is provided in the [API documentation](rdoc/index.html). You will
71
- also find examples for all existing extension types there.
data/doc/manual.page DELETED
@@ -1,727 +0,0 @@
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] (BUNDLE_NAME|BUNDLE_URL)`
40
-
41
- The argument may either be a valid bundle name or an URL (in this case you will need to have all
42
- dependencies for [Source::TarArchive](source/tararchive.html) installed) to a bundle archive (a
43
- (gzipped) tar archive). The command applies the bundle to the given webgen website. The files
44
- that will be written to website directory are shown and the user is asked to confirm that the
45
- shown files should indeed be written (and sometimes overwritten). If the `-f` option is used,
46
- the files are always written.
47
-
48
- You can get the full list of available bundle names by running `webgen help apply`!
49
-
50
- * `create [-b BUNDLE] SITE_DIR`
51
-
52
- Creates a basic webgen website in `SITE_DIR` using the optionally specified bundles. The option
53
- `-b` can be used more than once to specify more than one bundle - the bundles are applied in the
54
- order they are specified. As with the `apply` command, `BUNDLE` may either be a valid bundle
55
- name or a bundle URL.
56
-
57
- > If you don't specify the `-b` option, the default value is used which applies the `default`
58
- > and the `style-andreas07` bundles. The former only creates a simple `src/index.page` sothat
59
- > some output can be seen and the latter applies a nice layout.
60
- {:.information}
61
-
62
- All available bundles are listed in the help output for the command.
63
-
64
- * `help`
65
-
66
- Displays usage information. Can be used to show information about a command by using the command
67
- name as argument, eg. `webgen help create`.
68
-
69
- * `render`
70
-
71
- Renders the given webgen website.
72
-
73
- > If you run webgen in verbose mode using the global `-v` option, it prints out information
74
- > about the written files. Note, however, that the shown paths are the **internally used** path
75
- > names which may be different from the actual output path names! For more information on this
76
- > have a look at the [canonical path name](#source-cn) section!
77
- {:.information}
78
-
79
- * `version`
80
-
81
- Displays the version of webgen.
82
-
83
- * `webgui`
84
-
85
- Starts the webgen webgui, a browser based graphical user interface for managing webgen
86
- websites. First the webgui web application is started and then the webgui is opened in the
87
- default browser.
88
-
89
- [cmdparse]: http://cmdparse.rubyforge.org
90
-
91
-
92
-
93
- # A webgen Website {#website}
94
-
95
- webgen needs a special directory structure so that it works out of the box. This directory structure
96
- is automatically created by the `webgen create` command. You can alternatively use the webgui to
97
- create the website directory.
98
-
99
- The root directory of webgen website is called the website directory. You can have the following
100
- files and directories under this directory:
101
-
102
- * `src`: The source directory in which all the source files for the website are. If this directory
103
- should not be called `src` or you want to include additional source directories, you need to
104
- change the [`sources` configuration option](reference_configuration.html#sources).
105
-
106
- * `out`: This directory is created, if it does not exist, when webgen generates the HTML files. All
107
- the output files are put into this directory. The name of this directory can be changed by setting
108
- the [`output` configuration option](reference_configuration.html#output).
109
-
110
- * `ext`: The extension directory (optional). You can put self-written extensions into this directory
111
- so that they are used by webgen. See the [extension directory](#website-ext) section for more
112
- information.
113
-
114
- * `config.yaml`: This file can be used to set configuration options for the website. See the
115
- [Configuration File](#website-configfile) section for more information.
116
-
117
- * `Rakefile`: This file is provided for your convenience to execute tasks via `rake` and provides
118
- some useful tasks out of the box. See the [Rakefile](#website-rakefile) section for more
119
- information.
120
-
121
- ## Extension Directory {#website-ext}
122
-
123
- The extension directory is used for modifying core behaviour of webgen or adding extensions. It is
124
- called `ext` and has to reside directly under the website directory. All files called `init.rb` in
125
- this directory or any of its subdirectories are loaded when webgen renders the website. So you need
126
- to make sure to either place all extensions in `init.rb` or load them from this file. The latter
127
- approach is better since you can use the lazy loading feature that webgen uses internally,
128
- ie. extensions are loaded only when they are needed.
129
-
130
- ## Configuration File {#website-configfile}
131
-
132
- Many user will want to change some configuration options, for example, the default language of the
133
- website since not all people will want to write websites in English. This is primarily done via the
134
- configuration file.
135
-
136
- The configuration file is called `config.yaml` and has to be placed directly under the website
137
- directory. It uses [YAML](http://www.yaml.org) as file format. You can find a list of all available
138
- configuration options that can be set in the [Configuration Options
139
- Reference](reference_configuration.html).
140
-
141
- Each configuration option can be set in the configuration file by specifing the configuration option
142
- name and the new value as a key/value pair. A sample configuration file looks like this:
143
-
144
- website.lang: de
145
- website.link_to_current_page: true
146
-
147
- Since some configuration options have a complex structure, there exist several special configuration
148
- keys to help setting these configuration options:
149
-
150
- * `default_meta_info`: Set the default meta information for one or more source handlers.
151
-
152
- This key needs needs a Hash as value which should be of the following form:
153
-
154
- SOURCE_HANDLER_NAME:
155
- mi_key: mi_value
156
- other_key: other_value
157
- :action: replace
158
-
159
- So each entry has to specify the name of a source handler (or the special value `:all` which
160
- sets the default meta information for all source handlers) and the meta information items that
161
- should be set or modified. If you don't want to update the meta information hash but want to
162
- replace it, you need to add `:action: replace` as meta information entry.
163
-
164
- If a source handler called `Webgen::SourceHandler::SOURCE_HANDLER_NAME` exists, the meta
165
- information is set for this source handler instead.
166
-
167
- For example, the following snippet of a configuration file sets the meta information item
168
- `in_menu` to `true` for `Webgen::SourceHandler::Page`:
169
-
170
- default_meta_info:
171
- Page:
172
- in_menu: true
173
-
174
- * `default_processing_pipeline`: Set the default processing pipeline for one or more source
175
- handlers.
176
-
177
- This key needs a Hash as value which should be of the following form:
178
-
179
- SOURCE_HANDLER_NAME: PIPELINE
180
-
181
- Each key-value pair specifies the name of a source handler and the new default processing
182
- pipeline. The value for the processing pipeline has to consist of the short names of content
183
- processors separated by commas and normally includes `erb`, `tags`, `blocks` and the name of a
184
- content processor for a markup language. The short name(s) of a content processor is (are)
185
- stated on its documentation page. Be aware that the content processors are executed in the order
186
- in which they are specified!
187
-
188
- If a source handler called `Webgen::SourceHandler::SOURCE_HANDLER_NAME` exists, the meta
189
- information is set for this source handler instead.
190
-
191
- For example, the following snippet of a configuration file sets the default processing pipeline
192
- for 'Webgen::SourceHandler::Page':
193
-
194
- default_processing_pipeline:
195
- Page: erb,tags,textile,blocks
196
-
197
- * `patterns`: Set the used path patterns for one or more source handlers.
198
-
199
- This key needs a Hash value and provides two different ways of setting the path patterns:
200
-
201
- SOURCE_HANDLER_NAME: [**/*.jpg, **/*.css]
202
-
203
- SOURCE_HANDLER_NAME:
204
- add: [**/*.jpg]
205
- del: [**/*.js]
206
-
207
- The first form replaces the path patterns for the source handler with the given patterns. The
208
- second form allows to add or delete individual patterns.
209
-
210
- If a source handler called `Webgen::SourceHandler::SOURCE_HANDLER_NAME` exists, the meta
211
- information is set for this source handler instead.
212
-
213
- For example, the following snippet of a configuration file adds the pattern `**/*.pdf` to the
214
- patterns of `Webgen::SourceHandler::Copy`:
215
-
216
- patterns:
217
- Copy:
218
- add: [**/*.pdf]
219
-
220
- ## Rakefile {#website-rakefile}
221
-
222
- The Rakefile that is automatically created upon website creation provides a place to specify
223
- recurring task for your website, for example, for deploying the website to a server. It contains
224
- some useful tasks out of the box:
225
-
226
- * `webgen`: Renders the webgen website once.
227
- * `auto_webgen`: Automatically renders the website when a source file has changed. This is very
228
- useful when developing a website because you don't need to change back and forth between your
229
- website code and the command line to rebuild the site.
230
- * `clobber_webgen`: Removes all webgen generated products (the output files and the cache file).
231
-
232
-
233
-
234
- # All About Paths and Sources {#source}
235
-
236
- A source provides paths that identity files or directories. webgen can use paths from many sources.
237
- The most commonly used source is the file system source which provides paths and information on them
238
- from the file system.
239
-
240
-
241
- ## Path Types {#source-types}
242
-
243
- webgen can handle many different types of files through the different source handler classes.
244
-
245
- The most important files are the page and template files as they are used to define the content and
246
- the layout of a website. Have a look at the [Webgen Page Format
247
- documentation](webgen_page_format.html) to see how these files look like and how they are
248
- structured. After that have a look at the documentation of the source handler class
249
- SourceHandler::Page and SourceHandler::Template as they are responsible for handling these page and
250
- template files!
251
-
252
- You can naturally use any other type of file. However, be aware that some files may not be processed
253
- by webgen when no source handler class for them exists. For example, there is currently no source
254
- handler class for `.svg` files, so those files would be ignored. If you just want to have files
255
- copied from a source to the output directory (like images or CSS files), the
256
- [SourceHandler::Copy](sourcehandler/copy.html) class is what you need! Look through the
257
- documentation of the [availabe source handler classes](extensions.html) to get a feeling of what
258
- files are handled by webgen.
259
-
260
-
261
- ## Source Paths Naming Convention {#source-naming}
262
-
263
- webgen assumes that the paths provided by the sources follow a special naming convention sothat meta
264
- information can be extracted correctly from the path names. There are three different cases
265
- depending on the type of path (the individual parts of a path are explained below):
266
-
267
- * The path specifies a directory. It must end with a slash character and must not contain any hash
268
- characters. A directory path has to follow the scheme:
269
-
270
- /parent_path/basename/
271
-
272
- * The path specifies a file. It must not end with a slash character and must not contain any hash
273
- characters. A file path has to follow the scheme:
274
-
275
- /parent_path/[sort_info.]basename[.lang][.extension]
276
-
277
- There is one special case: if the file path has only one dot and only numbers are before the
278
- dot, then the first part is considered to be the basename and the second part the extension (eg.
279
- `53.png`)!
280
-
281
- * The path specifies a fragment (e.g. part of a file). It must contain exactly one hash character
282
- and it has to follow the scheme (where `/parent_path` needs to be a file path):
283
-
284
- /parent_path#basename
285
-
286
- Following is the explanation of the parts of the path names:
287
-
288
- * `/parent_path`
289
-
290
- This part specifies the path of the parent of this path and is used internally to create a
291
- hierarchy of paths. Although the leading slash is explicitly written here, it is part of the
292
- parent path, i.e. each parent path begins with a slash. Also note that the parent path will end
293
- with a slash if it is a directory!
294
-
295
- * `sort_info`
296
-
297
- This part is optional and has to consist of the digits 0 to 9. Its value is used for the meta
298
- information `sort_info`. If not specified, it defaults to the value zero.
299
-
300
- * `basename`
301
-
302
- This part is used on the one hand to generate the `title` meta information (but with `_` and `-`
303
- replaced by spaces). And on the other hand, the [canonical name](#source-cn) is derived from
304
- it. `basename` must not contain any dots, spaces or any character from the following list: ``; ?
305
- * : ` & = + $ ,``. If you do use one of them, webgen may not work correctly!
306
-
307
- > If two file paths have the same `basename` and `extension` part, they should define the same
308
- > content but for different languages. This allows webgen to automatically deliver the right
309
- > language version of the content.
310
- {:.important}
311
-
312
- * `lang`
313
-
314
- This part is optional and has to be an [ISO-639-1/2](http://www.loc.gov/standards/iso639-2/)
315
- language identifier (two or three characters (a-z) long). It can only be specified if an
316
- extension is also specified. If the file path should not have an extension, then just add a
317
- trailing dot, e.g. `/dir/file.de.` - the trailing dot is ignored by webgen.
318
-
319
- If the language part is not specified, it is assumed that the path is language independent (for
320
- example, images are normally not specific for a specific language). However, this behaviour may
321
- be different for some source handler classes (for example, all paths handled by
322
- SourceHandler::Page are assigned the default language if none is set).
323
-
324
- If the language identifier can't be matched to a valid language, it is assumed that this part
325
- isn't actually a language identifier but a part of the extension. This also means that in the
326
- special case where the first part of an extension is also a valid language identifier, the first
327
- part is interpreted as language identifier and not as part of the extension!
328
-
329
- * `extension`
330
-
331
- The file extension can be anything and can include dots.
332
-
333
- Following are some examples of source path names (the acn and alcn parts are explained
334
- [below](#source-cn)):
335
-
336
- | Path | Basename | Language | `title` | `sort_info` | acn | alcn |
337
- |----------------------------|--------------|----------|--------------|-------------|------------------------|-------------------------|
338
- | `/directory/` | directory | -none- | Directory | -none- | `/directory/` | `/directory/` |
339
- | `/image.png` | image | -none- | Image | 0 | `/image.png` | `/image.png` |
340
- | `/image.de.png` | image | de | Image | 0 | `/image.png` | `/image.de.png` |
341
- | `/01.name_of-file.eo.page` | name_of-file | eo | Name of file | 1 | `/name_of-file.page` | `/name_of-file.eo.page` |
342
- | `/53.png` | 53 | -none- | 53 | 0 | `/53.png` | `/53.png` |
343
- | `/archive.tar.bz2` | archive | -none- | Archive | 0 | `/archive.tar.bz2` | `/archive.tar.bz2` |
344
- | `/archive.de.tar.bz2` | archive | de | Archive | 0 | `/archive.tar.bz2` | `/archive.de.tar.bz2` |
345
- | `/manual.html#sources` | manual | -none- | Manual | -none- | `/manual.html#sources` | `/manual.html#sources` |
346
- {:#source-path-example-table style="border: 1px solid black; width: 100%"}
347
-
348
- Notice: The first two file path and the last two file path examples define the same content for two
349
- different languages (or more exactly: the first one is unlocalized in both cases and the second one
350
- localized to German) as they have the same canonical name.
351
-
352
-
353
- ## Canonical Name (CN) of a File {#source-cn}
354
-
355
- webgen provides the functionality to define the same content in more than one language, ie. to
356
- localize content. This is achieved with the _canonical name_ of a path, short CN.
357
-
358
- The canonical name as well as all the other variants (\[absolute] \[localized] canonical name, all
359
- described below) are created directly from the source paths sothat one can easily derive the
360
- canonical name onself. Here are some examples:
361
-
362
- | Source path | CN | ACN | LCN | ALCN |
363
- |-----------------------|------------|--------------------|---------------|-----------------------|
364
- | `/images/test/` | `test/` | `/images/test/` | `test/` | `/images/test/` |
365
- | `/images/logo.png` | `logo.png` | `/images/logo.png` | `logo.png` | `/images/logo.png` |
366
- | `/images/logo.de.png` | `logo.png` | `/images/logo.png` | `logo.de.png` | `/images/logo.de.png` |
367
- | `/test.de.html#frag` | `#frag` | `/test.html#frag` | `#frag` | `/test.de.html#frag` |
368
- {:#cn-example-table style="border: 1px solid black; width: 100%"}
369
-
370
- What one can immediately see is that if a source path is unlocalized, the CN is the same as the LCN
371
- and the ACN is the same as the ALCN. This is always true for directory and fragment paths since they
372
- are always unlocalized! The first example shows a directory path - note the trailing slash! And the
373
- last example shows a fragment path - note the difference in the ACN and the ALCN! Another
374
- good-to-know fact is that an LCN is unique within its hierarchy level and that an ALCN is globally
375
- unique!
376
-
377
- > Source handlers can change some parts of a source path. For example, the page source handler
378
- > changes the extension from `page` to `html`. This has to be taken into account when specifying
379
- > canonical names! These changes are documented on the documentation pages for the source handlers!
380
- {:.information}
381
-
382
- When multiple paths share the same canonical name, webgen assumes that they have the same content
383
- but in different languages. It is also possible to specify a _language independent_ path (i.e. one
384
- without a language) which is used as a fallback. Therefore when a path should be resolved using a
385
- canonical name and a given language, it is first tried to get the path in the requested language. If
386
- this is not possible (ie. no such localization exists), the unlocalized path is returned if it
387
- exists.
388
-
389
- For example, assume that we have the following `src` directory:
390
-
391
- /test.jpg
392
- /images/my.jpg
393
- /images/my.de.jpg
394
- /index.page
395
- /index.fr.page
396
- /index.de.page
397
-
398
- Since the path `images/my.jpg` has no language part, it is assumed to be unlocalized. In contrast,
399
- `images/my.de.jpg` has the "same" picture but in a German version. So, when specifying
400
- `images/my.jpg` in `index.de.page`, the correct localized version will be returned, i.e.
401
- `images/my.de.jpg`. When specifying `images/my.jpg` in `index.page` or in `index.fr.page`, the
402
- unlocalized version will be returned since no localized version exists.
403
-
404
- > Directories and fragments are never localized, only files are!
405
- {:.important}
406
-
407
- It is also possible to use the _localized canonical name_ of a path (short: LCN) to resolve it. The
408
- localized canonical name is the same as the canonical name but with a language code inserted before
409
- the extension. If the localized canonical name is used to resolve a path, a possibly additionally
410
- specified language is ignored as it is assumed that the user really only wants the path in the
411
- specified language!
412
-
413
- Continuing the above example, this means that `images/my.de.jpg` is always returned when one
414
- specifies `images/my.de.jpg` in any of the index page files, e.g. even in `index.fr.page`.
415
-
416
- Both canonical and localized canonical names can be absolute (ACN and ALCN) which is done by using
417
- the full path starting with a slash. This is especially useful when you don't exactly know in which
418
- hierarchy level a certain canoncial name gets evaluated.
419
-
420
- Everything said above also means that all paths are not resolved using their real source or output
421
- names but using the (localized) canonical name! So when specifying paths for extensions, for example
422
- when using the [relocatable tag](tag/relocatable.html), you always have to use the (absolute)
423
- (localized) canonical names. This is different from previous webgen versions! However, it allows for
424
- using a naming scheme based on the source paths to be used independently from the output paths and
425
- therefore the output paths may change but no changes in the files themselves are needed.
426
-
427
-
428
- ## Output Path Name Construction {#source-output}
429
-
430
- There is currently only one method, called `standard`, for creating output path names which is
431
- described here. However, webgen allows developers to create other output path name creation methods.
432
- More information on this can be found in the [API documentation](api.html).
433
-
434
- The output path for a given source path is constructed using the meta information
435
- `output_path_style`. This meta information is set to a default value and can be overwritten by
436
- setting it for a specific source handler or for a path individually. The value for this meta
437
- information key is an array which can have the following values:
438
-
439
- * strings (for inserting arbitrary text into output names)
440
- * arrays (for grouping values - only interesting for the language part)
441
- * symbols for inserting special values:
442
- * `:basename`: The basename of the path.
443
- * `:parent`: The parent path.
444
- * `:lang`: The language.
445
- * `:ext`: The file extension including the leading dot.
446
- * `:year`, `:month`, `:day`: The creation year, month and day, respectively, of the source path.
447
- An error is raised if the needed meta information `created_at` is not set on the path.
448
-
449
- > The constructed output path must always be an absolute one, ie. it has to start at the root of the
450
- > output directory. Therefore, the `:parent` part should always be included!
451
- {:.important}
452
-
453
- Following are some examples of output path names for given source path names (assuming that `en` is
454
- the default language and that the path is under a directory called `/img/`):
455
-
456
- * `output_path_style=[:parent, :basename, [., :lang], :ext]` (the default)
457
-
458
- * `index.jpg` --> `/img/index.jpg`
459
-
460
- Since the source path is unlocalized, no language part is used and the whole sub array with
461
- the `:lang` symbol is dropped.
462
-
463
- * `index.en.jpg` --> `/img/index.jpg`
464
-
465
- This happens if the configuration option `sourcehandler.default_lang_in_output_path` is
466
- `false` and no unlocalized version of this path exists.
467
-
468
- * `index.en.jpg` --> `/img/index.en.jpg`
469
-
470
- Similar to the last example but this result occurs when there is an unlocalized version of
471
- the path which is naturally named `index.jpg`!
472
-
473
- * `index.de.jpg` --> `/img/index.de.jpg`
474
-
475
- Since `de` is not the default language, the language part is always used!
476
-
477
- * `output_path_style=[:parent, :basename, :ext, ., :lang]`
478
-
479
- * `index.jpg` --> `/img/index.jpg.`
480
-
481
- Be aware of the trailing dot since the `:lang` value is not defined in a sub array!
482
-
483
- * `output_path_style=[:parent, :year, /, :month, /, :basename, [., :lang], :ext]`
484
-
485
- * `index.jpg` --> `/img/2008/09/index.jpg`
486
-
487
- This output path style can be used to create blog archive style output names.
488
-
489
-
490
- ## Path Patterns {#source-pathpattern}
491
-
492
- Each source handler specifies path patterns which are used to locate the files that the class can
493
- handle. Normally these patterns are used to match file extensions, however, they are much more
494
- powerful. For detailed information on the structure of path patterns have a look at the
495
- [Dir.glob](http://ruby-doc.org/core/classes/Dir.html#M002375) API documentation.
496
-
497
- The path patterns that are handled by a particular source handler are stated on its documentation
498
- page. These patterns can be changed by modfying the configuration option `sourcehandler.patterns`
499
- although that is not recommended except in some few cases (for example, it is useful to add some
500
- patterns for SourceHandler::Copy). The information about how these path patterns work are useful for
501
- the usage of webgen because of two reasons:
502
-
503
- * so that you know which files will be processed by a specific source handler class
504
-
505
- * so that you can specify additional path patterns for some source handlers like the
506
- SourceHandler::Copy
507
-
508
- Here are some example path patterns:
509
-
510
- <table class="examples">
511
- <tr><th>Path Pattern</th><th>Result</th></tr>
512
- <tr>
513
- <td>`*/*.html`</td>
514
- <td>All files with the extension `html` in the subdirectories of the source directory</td>
515
- </tr>
516
- <tr>
517
- <td>`**/*.html`</td>
518
- <td>All files with the extension `html` in all directories</td>
519
- </tr>
520
- <tr>
521
- <td>`**/{foo,bar}*`</td>
522
- <td>All files in all directories which start with `foo` or `bar`</td>
523
- </tr>
524
- <tr>
525
- <td>`**/???`</td>
526
- <td>All files in all directories whose file name is exactly three characters long</td>
527
- </tr>
528
- </table>
529
-
530
-
531
- ## Handling of files in the source directory {#source-handling}
532
-
533
- Following is the list of rules how source files are handled by webgen:
534
-
535
- * All path names of all sources specified in the configuration option
536
- [`sources`](reference_configuration.html#sources) are fetched. Prior listed sources have priority
537
- over later listed sources if both specify the same path.
538
-
539
- * Those paths which match a pattern of the configuration option
540
- [`sourcehandler.ignore`](reference_configuration.html#sourcehandlerignore) are excluded.
541
-
542
- * The source handler classes are invoked according to the invocation order specified in
543
- [`sourcehandler.invoke`](reference_configuration.html#sourcehandlerinvoke) and they use only those
544
- paths that match one of their path patterns specified in
545
- [`sourcehandler.patterns`](reference_configuration.html#sourcehandlerpatterns).
546
-
547
- As you might have deduced from the processing list above, it is possible that one path is handled by
548
- multiple source handlers. This can be used, for example, to render an XML file as HTML and copy it
549
- verbatim.
550
-
551
-
552
- ## Path Meta Information {#source-metainfo}
553
-
554
- Each path can have meta information, i.e. information about the path itself, associated with it, for
555
- example the title of the path, if it should appear in a menu and so on. This meta information can be
556
- specified in several ways, including:
557
-
558
- * Source handlers can provide default meta information for their handled paths (set using the
559
- configuration option
560
- [`sourcehandler.default_meta_info`](reference_configuration.html#sourcehandlerdefaultmetainfo).
561
-
562
- * Some file types allow meta information to be specified directly in the file, for example page
563
- files in [Webgen Page Format](webgen_page_format.html).
564
-
565
- * Meta information can also be specified in special meta information backing files. These files are
566
- handled by the source handler [SourceHandler::Metainfo](sourcehandler/metainfo.html).
567
-
568
- There is clearly defined order in which meta information is applied to a node for a path:
569
-
570
- 1. The path gets read by a source and some meta information is extracted from the path name.
571
-
572
- 2. This meta information is overwritten with meta information specified for all source handlers and
573
- then with meta information specified for the source handler that handles the path.
574
-
575
- 3. Extensions can now overwrite meta information before the path gets handled by a source
576
- handler. For example, the SourceHandler::Metainfo assigns meta information specified for paths at
577
- this stage.
578
-
579
- 4. Before the node for the path gets created, meta information from the content of the path itself
580
- may overwrite the current meta information (this is the case, for example, with files in Webgen
581
- Page Format).
582
-
583
- 5. The node gets created with the provided meta information.
584
-
585
- 6. After the node has been created, extensions may overwrite meta information again. For example,
586
- the SourceHandler::Metainfo assigns meta information specified for nodes at this stage.
587
-
588
-
589
-
590
- # webgen Extensions
591
-
592
- webgen comes with many extensions that allow for rapid creation of static websites. The variety of
593
- the extensions allows you to use your tools of choice, for example, your preferred markup
594
- language. And if your choice is not available, you can write the extension for it yourself or make a
595
- feature request!
596
-
597
- Extensions are only loaded when they are needed. For example, if you don't use `.feed` files for
598
- automatically generating atom/RSS feeds for your website, the source handler that handles these
599
- files will never be loaded. Therefore you don't need to explicitly enable extensions, they just sit
600
- in the background and wait till the webgen core needs them.
601
-
602
- There are several types of extensions:
603
-
604
- * **Content Processors**: These extensions process content, for example, the content of files in
605
- Webgen Page Format. It is not specified how they have to process the content but this type of
606
- extension can basically be divided into two groups:
607
-
608
- * Text content processors: These processors are used to process textual content like files in
609
- Webgen Page Format. This group can furthe be divided:
610
-
611
- * Markup processors: Processors like kramdown or RedCloth belong to this group and they
612
- convert markup text that is easy to read and write to a more structure format like HTML.
613
- This allows you to write an HTML page without knowing HTML.
614
-
615
- * String replacers: These processors normally process special strings and substitute them
616
- with other content. For example, the `erb` processors replaces delimited strings
617
- interpreted as Ruby code with the interpreted value. Another example would be webgen's
618
- `tags` processor which replaces strings like `\{relocatable: ../index.html}` with a
619
- processed value.
620
-
621
- * Binary content processors: These processors are used to process binary data. For example, one
622
- might want to process an image to produce a thumbnailed version of it.
623
-
624
- * **Source Handler**: These extensions are used for handling source paths. They read the content of
625
- a path and produce one or more nodes (the internal representation of an output path, see [source
626
- handling](#source-handling) for more information on nodes). So a source handler can do something
627
- simple like just copying a source path to the output directory but they can also do complex
628
- things like creating a whole image gallery from just one source path.
629
-
630
- * **Tags**: This type of extension allows the easy inclusion of dynamic content in, for example,
631
- page and template files. Each tag extension is used for a specific task like creating a menu or
632
- a breadcrumb trail.
633
-
634
-
635
-
636
- # A webgen Run
637
-
638
- When webgen is started, it first looks for a cache file and uses it if it exists. The cache file
639
- provides information on the previous run and allows webgen to render only those paths that have
640
- changed since the last time.
641
-
642
- Each webgen run consists of one or more update/write cycles. During the update phase the internal
643
- tree structure is updated to reflect the current situation:
644
-
645
- * Nodes are created from newly found source paths.
646
- * If a source path was deleted since the last webgen run, the nodes created from it will be deleted.
647
- * All nodes in the tree are checked if they have changed and, if so, are marked for regeneration.
648
-
649
- > The name used for describing a directory or file once it is placed in the internal tree structure
650
- > is 'node'.
651
- {:.information}
652
-
653
- After the update cycle has finished, the internal tree representation is up-to-date and contains all
654
- necessary information to write its nodes. This is done in the write phase which writes out all
655
- changed nodes.
656
-
657
- It is possible that the internal tree structure changes during the write phase. For example, after
658
- writing a page file fragments node for it may have been generated. After the write phase it is
659
- checked if something like this has happened. If webgen finds such a condition, a new update/write
660
- cycle is initiated. This is done as long as needed.
661
-
662
- Since it is possible that multiple update/write cycles are used in one webgen run, it is shown in
663
- the log messages when a new cycle started. This is necessary because sometimes some warning or error
664
- log messages may be generated during an earlier cycle but the error conditions are automatically
665
- solved in later cycles. By marking where the cycles start a user can compare the log messages of the
666
- different cycles and see what he needs to solve himself.
667
-
668
-
669
- # Extending webgen
670
-
671
- If you know the programming language Ruby a little bit, you can easily extend webgen and add new
672
- features that you need. All the needed developer documentation is available in the [API
673
- documentation](rdoc/index.html), along with sample implementations for all major types of extensions
674
- (source class, output classes, source handler class, content processors classes, tag classes, ...)
675
- and detailed information about the inner workings of webgen. Have a look at the [extension
676
- directory](#website-ext) section for more information on naming files and where to put the
677
- extensions.
678
-
679
-
680
- # Creating a Website Style Bundle {#create-website-style}
681
-
682
- webgen ships some style bundles sothat one can create a basic website out of the box. However, if
683
- you want to create a website style bundle yourself, it is easy.
684
-
685
- The following assumes that you already have a website template, i.e. an HTML file with your layout,
686
- the accompanying CSS file and the needed images. The example below assume you have one downloaded
687
- from <http://www.openwebdesign.org/>.
688
-
689
- * First create the needed directories and the README file:
690
-
691
- * The bundle directory: `BUNDLE`
692
- * The source directory: `BUNDLE/src`
693
- * The README file: `BUNDLE/README`
694
-
695
- The README file contains information about your style bundle in YAML format. You should include at
696
- least the `description` and `author` keys:
697
-
698
- description: Website template based on the OSWD template BUNDLE
699
- author: Me Myself
700
-
701
- * Unzip the the archive from OSWD and move the extracted files into the `BUNDLE/src` directory.
702
-
703
- * Rename the file `BUNDLE/src/index.html` (or whatever the main HTML file is called) to
704
- `default.template`. Now go through this file and augment relative URLs to style sheets, images and
705
- other files with [relocatable tags](tag/relocatable.html).
706
-
707
- * Identify the location of the main menu items, remove them and and use a [menu tag](tag/menu.html)
708
- instead. You may need to restrict the shown menu levels to a single level if the template is built
709
- for only one main menu level. Then adjust the CSS used to style the menu to include the webgen
710
- specific CSS classes for showing the currently selected link. Remember that you need to take care
711
- of styling not only `<a>` tags but also `<span>` tags. See the [menu tag
712
- documentation](tag/menu.html) for more information on how the menu is output by webgen and what
713
- CSS classes can be used!
714
-
715
- * Adjust the `<title>` tag in the `<head>` section of the `default.template` file -- you can use the
716
- `\{title:}` to insert the title of the processed page file.
717
-
718
- * Identify the location where the page content should go and put `<webgen:block name="content' />`
719
- there. This tells webgen to insert the block named `content` of the page file that uses the
720
- template at this location.
721
-
722
- * If the template features a breadcrumb trail area, use the [breadcrumb trail
723
- tag](tag/breadcrumbtrail.html) so that the breadcrumb trail gets created automatically.
724
-
725
- The BUNDLE directory can now be directly used since it is a valid webgen website directory. If you
726
- want to publish your style bundle, just create a (gzipped) tar archive from the contents of the
727
- BUNDLE directory.