webgen 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. data/ChangeLog +1523 -97
  2. data/Rakefile +11 -24
  3. data/TODO +22 -9
  4. data/VERSION +1 -1
  5. data/bin/webgen +2 -2
  6. data/bin/webgen-gallery-editor +654 -0
  7. data/bin/webgen-gui +10 -0
  8. data/data/webgen/data/ISO-639-2_values_8bits.txt +492 -0
  9. data/data/webgen/gallery-creator/default.png +0 -0
  10. data/data/webgen/icon_mapping.yaml +27 -0
  11. data/data/webgen/resources/emoticons/bigeyes/angry.png +0 -0
  12. data/data/webgen/resources/emoticons/bigeyes/cool.png +0 -0
  13. data/data/webgen/resources/emoticons/bigeyes/cry.png +0 -0
  14. data/data/webgen/resources/emoticons/bigeyes/drunk.png +0 -0
  15. data/data/webgen/resources/emoticons/bigeyes/lol.png +0 -0
  16. data/data/webgen/resources/emoticons/bigeyes/oops.png +0 -0
  17. data/data/webgen/resources/emoticons/bigeyes/sad.png +0 -0
  18. data/data/webgen/resources/emoticons/bigeyes/sleep.png +0 -0
  19. data/data/webgen/resources/emoticons/bigeyes/smile.png +0 -0
  20. data/data/webgen/resources/emoticons/bigeyes/tongue.png +0 -0
  21. data/data/webgen/resources/emoticons/bigeyes/wink.png +0 -0
  22. data/data/webgen/resources/emoticons/crystal/angry.png +0 -0
  23. data/data/webgen/resources/emoticons/crystal/cool.png +0 -0
  24. data/data/webgen/resources/emoticons/crystal/cry.png +0 -0
  25. data/data/webgen/resources/emoticons/crystal/drunk.png +0 -0
  26. data/data/webgen/resources/emoticons/crystal/lol.png +0 -0
  27. data/data/webgen/resources/emoticons/crystal/oops.png +0 -0
  28. data/data/webgen/resources/emoticons/crystal/sad.png +0 -0
  29. data/data/webgen/resources/emoticons/crystal/sleep.png +0 -0
  30. data/data/webgen/resources/emoticons/crystal/smile.png +0 -0
  31. data/data/webgen/resources/emoticons/crystal/tongue.png +0 -0
  32. data/data/webgen/resources/emoticons/crystal/wink.png +0 -0
  33. data/data/webgen/resources/emoticons/cyclops/angry.png +0 -0
  34. data/data/webgen/resources/emoticons/cyclops/cool.png +0 -0
  35. data/data/webgen/resources/emoticons/cyclops/cry.png +0 -0
  36. data/data/webgen/resources/emoticons/cyclops/drunk.png +0 -0
  37. data/data/webgen/resources/emoticons/cyclops/lol.png +0 -0
  38. data/data/webgen/resources/emoticons/cyclops/oops.png +0 -0
  39. data/data/webgen/resources/emoticons/cyclops/sad.png +0 -0
  40. data/data/webgen/resources/emoticons/cyclops/sleep.png +0 -0
  41. data/data/webgen/resources/emoticons/cyclops/smile.png +0 -0
  42. data/data/webgen/resources/emoticons/cyclops/tongue.png +0 -0
  43. data/data/webgen/resources/emoticons/cyclops/wink.png +0 -0
  44. data/data/webgen/resources/emoticons/glass/angry.png +0 -0
  45. data/data/webgen/resources/emoticons/glass/cool.png +0 -0
  46. data/data/webgen/resources/emoticons/glass/cry.png +0 -0
  47. data/data/webgen/resources/emoticons/glass/drunk.png +0 -0
  48. data/data/webgen/resources/emoticons/glass/lol.png +0 -0
  49. data/data/webgen/resources/emoticons/glass/oops.png +0 -0
  50. data/data/webgen/resources/emoticons/glass/sad.png +0 -0
  51. data/data/webgen/resources/emoticons/glass/sleep.png +0 -0
  52. data/data/webgen/resources/emoticons/glass/smile.png +0 -0
  53. data/data/webgen/resources/emoticons/glass/tongue.png +0 -0
  54. data/data/webgen/resources/emoticons/glass/wink.png +0 -0
  55. data/data/webgen/resources/emoticons/icqstyle/angry.png +0 -0
  56. data/data/webgen/resources/emoticons/icqstyle/cool.png +0 -0
  57. data/data/webgen/resources/emoticons/icqstyle/cry.png +0 -0
  58. data/data/webgen/resources/emoticons/icqstyle/drunk.png +0 -0
  59. data/data/webgen/resources/emoticons/icqstyle/lol.png +0 -0
  60. data/data/webgen/resources/emoticons/icqstyle/oops.png +0 -0
  61. data/data/webgen/resources/emoticons/icqstyle/sad.png +0 -0
  62. data/data/webgen/resources/emoticons/icqstyle/sleep.png +0 -0
  63. data/data/webgen/resources/emoticons/icqstyle/smile.png +0 -0
  64. data/data/webgen/resources/emoticons/icqstyle/tongue.png +0 -0
  65. data/data/webgen/resources/emoticons/icqstyle/wink.png +0 -0
  66. data/data/webgen/resources/emoticons/matrix/angry.gif +0 -0
  67. data/data/webgen/resources/emoticons/matrix/cool.gif +0 -0
  68. data/data/webgen/resources/emoticons/matrix/cry.gif +0 -0
  69. data/data/webgen/resources/emoticons/matrix/drunk.gif +0 -0
  70. data/data/webgen/resources/emoticons/matrix/lol.gif +0 -0
  71. data/data/webgen/resources/emoticons/matrix/oops.gif +0 -0
  72. data/data/webgen/resources/emoticons/matrix/sad.gif +0 -0
  73. data/data/webgen/resources/emoticons/matrix/sleep.gif +0 -0
  74. data/data/webgen/resources/emoticons/matrix/smile.gif +0 -0
  75. data/data/webgen/resources/emoticons/matrix/tongue.gif +0 -0
  76. data/data/webgen/resources/emoticons/matrix/wink.gif +0 -0
  77. data/data/webgen/resources/emoticons/smellies/angry.gif +0 -0
  78. data/data/webgen/resources/emoticons/smellies/cool.gif +0 -0
  79. data/data/webgen/resources/emoticons/smellies/cry.gif +0 -0
  80. data/data/webgen/resources/emoticons/smellies/drunk.gif +0 -0
  81. data/data/webgen/resources/emoticons/smellies/lol.gif +0 -0
  82. data/data/webgen/resources/emoticons/smellies/oops.gif +0 -0
  83. data/data/webgen/resources/emoticons/smellies/sad.gif +0 -0
  84. data/data/webgen/resources/emoticons/smellies/sleep.gif +0 -0
  85. data/data/webgen/resources/emoticons/smellies/smile.gif +0 -0
  86. data/data/webgen/resources/emoticons/smellies/tongue.gif +0 -0
  87. data/data/webgen/resources/emoticons/smellies/wink.gif +0 -0
  88. data/data/webgen/resources/icons/compressed.png +0 -0
  89. data/data/webgen/resources/icons/document.png +0 -0
  90. data/data/webgen/resources/icons/download.png +0 -0
  91. data/data/webgen/resources/icons/image.png +0 -0
  92. data/data/webgen/resources/icons/linux.png +0 -0
  93. data/data/webgen/resources/icons/mac.png +0 -0
  94. data/data/webgen/resources/icons/pdf.png +0 -0
  95. data/data/webgen/resources/icons/penguin.png +0 -0
  96. data/data/webgen/resources/icons/quicktime.png +0 -0
  97. data/data/webgen/resources/icons/real.png +0 -0
  98. data/data/webgen/resources/icons/rpm.png +0 -0
  99. data/data/webgen/resources/icons/sound.png +0 -0
  100. data/data/webgen/resources/icons/source.png +0 -0
  101. data/data/webgen/resources/icons/spreadsheet.png +0 -0
  102. data/data/webgen/resources/icons/text.png +0 -0
  103. data/data/webgen/resources/icons/vcard.png +0 -0
  104. data/data/webgen/resources/icons/video.png +0 -0
  105. data/data/webgen/resources/icons/win.png +0 -0
  106. data/data/webgen/{images → resources/images}/generated_by_webgen.png +0 -0
  107. data/data/webgen/{images → resources/images}/valid-css.gif +0 -0
  108. data/data/webgen/{images → resources/images}/valid-xhtml11.png +0 -0
  109. data/data/webgen/{images → resources/images}/webgen_logo.png +0 -0
  110. data/data/webgen/{example/src → website_styles/default}/default.css +0 -0
  111. data/data/webgen/{example/src → website_styles/default}/default.template +2 -2
  112. data/data/webgen/website_templates/default/README +6 -0
  113. data/data/webgen/{example → website_templates/default}/config.yaml +0 -0
  114. data/data/webgen/{example → website_templates/default}/src/index.page +0 -0
  115. data/data/webgen/website_templates/personal_hp/README +6 -0
  116. data/data/webgen/website_templates/personal_hp/src/about.page +12 -0
  117. data/data/webgen/website_templates/personal_hp/src/index.page +9 -0
  118. data/data/webgen/website_templates/personal_hp/src/links.page +22 -0
  119. data/data/webgen/website_templates/personal_hp/src/projects.page +20 -0
  120. data/data/webgen/website_templates/project/README +7 -0
  121. data/data/webgen/website_templates/project/src/about.page +12 -0
  122. data/data/webgen/website_templates/project/src/download.page +15 -0
  123. data/data/webgen/website_templates/project/src/features.page +8 -0
  124. data/data/webgen/website_templates/project/src/index.page +9 -0
  125. data/data/webgen/website_templates/project/src/screenshots.page +18 -0
  126. data/doc/config.yaml +3 -0
  127. data/doc/plugin/clidesc.rb +18 -7
  128. data/doc/plugin/emoticon.rb +29 -0
  129. data/doc/plugin/extension.rb +15 -16
  130. data/doc/plugin/listpluginparameters.rb +39 -0
  131. data/doc/plugin/resources.rb +4 -4
  132. data/doc/plugin/source.rb +21 -0
  133. data/doc/src/default.css +7 -4
  134. data/doc/src/default.template +4 -2
  135. data/doc/src/documentation/cli.page +1 -1
  136. data/doc/src/documentation/extending_webgen.page +102 -0
  137. data/doc/src/documentation/gettingstarted.page +3 -6
  138. data/doc/src/documentation/index.page +1 -1
  139. data/doc/src/documentation/plugins/{contenthandler → contenthandlers}/html.page +0 -0
  140. data/doc/src/documentation/plugins/{contenthandler → contenthandlers}/index.page +0 -0
  141. data/doc/src/documentation/plugins/{contenthandler → contenthandlers}/markdown.page +0 -0
  142. data/doc/src/documentation/plugins/{contenthandler → contenthandlers}/rdoc.page +0 -0
  143. data/doc/src/documentation/plugins/{contenthandler → contenthandlers}/textile.page +0 -0
  144. data/doc/src/documentation/plugins/{system → coreplugins}/configuration.page +0 -0
  145. data/doc/src/documentation/plugins/coreplugins/index.page +7 -0
  146. data/doc/src/documentation/plugins/{system → coreplugins}/logging.page +0 -0
  147. data/doc/src/documentation/plugins/{resourcemanager.page → coreplugins/resourcemanager.page} +5 -1
  148. data/doc/src/documentation/plugins/{filehandler → filehandlers}/backing.page +1 -1
  149. data/doc/src/documentation/plugins/{filehandler → filehandlers}/copy.page +1 -1
  150. data/doc/src/documentation/plugins/{filehandler/directory.page → filehandlers/directoryhandler.page} +11 -2
  151. data/doc/src/documentation/plugins/{filehandler/galleryhandler.page → filehandlers/gallery.page} +20 -13
  152. data/doc/src/documentation/plugins/{filehandler → filehandlers}/index.page +0 -0
  153. data/doc/src/documentation/plugins/{filehandler/pagehandler.page → filehandlers/page.page} +6 -4
  154. data/doc/src/documentation/plugins/{filehandler → filehandlers}/template.page +0 -0
  155. data/doc/src/documentation/plugins/{gallerylayouter → gallerylayouters}/index.page +7 -3
  156. data/doc/src/documentation/plugins/{htmlvalidator → htmlvalidators}/index.page +0 -0
  157. data/doc/src/documentation/plugins/{htmlvalidator → htmlvalidators}/xmllint.page +0 -0
  158. data/doc/src/documentation/plugins/index.page +4 -0
  159. data/doc/src/documentation/plugins/menustyles/{horizontal-dropdown.page → horizontaldropdown.page} +0 -0
  160. data/doc/src/documentation/plugins/menustyles/{vertical-dropdown.page → verticaldropdown.page} +1 -1
  161. data/doc/src/documentation/plugins/miscplugins/index.page +7 -0
  162. data/doc/src/documentation/plugins/miscplugins/smileyreplacer.page +38 -0
  163. data/doc/src/documentation/plugins/tags/breadcrumbtrail.page +20 -0
  164. data/doc/src/documentation/plugins/tags/download.page +23 -0
  165. data/doc/src/documentation/plugins/tags/resource.page +1 -1
  166. data/doc/src/documentation/plugins/tags/sitemap.page +1 -2
  167. data/doc/src/documentation/references/index.page +8 -0
  168. data/doc/src/documentation/{meta_info_reference.page → references/meta_info_reference.page} +1 -0
  169. data/doc/src/documentation/references/parameter_reference.page +12 -0
  170. data/doc/src/documentation/webgen_gallery_editor.page +82 -0
  171. data/doc/src/download.page +2 -2
  172. data/doc/src/features.page +3 -2
  173. data/doc/src/images/screenshots/wge-image.png +0 -0
  174. data/doc/src/images/screenshots/wge-layout-preview.png +0 -0
  175. data/doc/src/images/screenshots/wge-main-disabled.png +0 -0
  176. data/doc/src/images/screenshots/wge-main.png +0 -0
  177. data/doc/src/index.page +30 -11
  178. data/doc/src/meta.info +7 -7
  179. data/doc/src/screenshots.gallery +33 -0
  180. data/install.rb +1 -1
  181. data/lib/webgen.rb +275 -0
  182. data/lib/webgen/composite.rb +1 -1
  183. data/lib/webgen/gui/common.rb +38 -0
  184. data/lib/webgen/gui/main.rb +219 -0
  185. data/lib/webgen/gui/new_website_dlg.rb +125 -0
  186. data/lib/webgen/listener.rb +1 -1
  187. data/lib/webgen/node.rb +4 -2
  188. data/lib/webgen/plugin.rb +167 -100
  189. data/lib/webgen/plugins/{contenthandler/defaultcontenthandler.rb → contenthandlers/default.rb} +1 -1
  190. data/lib/webgen/plugins/{contenthandler → contenthandlers}/html.rb +2 -2
  191. data/lib/webgen/plugins/{contenthandler → contenthandlers}/markdown.rb +2 -2
  192. data/lib/webgen/plugins/{contenthandler → contenthandlers}/rdoc.rb +2 -2
  193. data/lib/webgen/plugins/{contenthandler → contenthandlers}/textile.rb +2 -2
  194. data/lib/webgen/{configuration.rb → plugins/coreplugins/configuration.rb} +34 -14
  195. data/lib/webgen/{logging.rb → plugins/coreplugins/logging.rb} +4 -4
  196. data/lib/webgen/plugins/{resourcemanager.rb → coreplugins/resourcemanager.rb} +44 -22
  197. data/lib/webgen/plugins/{filehandler → filehandlers}/backing.rb +11 -11
  198. data/lib/webgen/plugins/{filehandler/filecopy.rb → filehandlers/copy.rb} +3 -3
  199. data/lib/webgen/plugins/{filehandler → filehandlers}/directory.rb +15 -10
  200. data/lib/webgen/plugins/{filehandler → filehandlers}/filehandler.rb +9 -7
  201. data/lib/webgen/plugins/{filehandler/picturegallery.rb → filehandlers/gallery.rb} +35 -28
  202. data/lib/webgen/plugins/{filehandler → filehandlers}/page.rb +30 -15
  203. data/lib/webgen/plugins/{filehandler → filehandlers}/template.rb +3 -3
  204. data/lib/webgen/plugins/{gallerylayouter/defaultgallerylayouter.rb → gallerylayouters/default.rb} +11 -11
  205. data/lib/webgen/plugins/{htmlvalidator/defaulthtmlvalidator.rb → htmlvalidators/default.rb} +1 -1
  206. data/lib/webgen/plugins/{htmlvalidator → htmlvalidators}/xmllint.rb +2 -2
  207. data/lib/webgen/plugins/menustyles/{defaultmenustyle.rb → default.rb} +2 -2
  208. data/lib/webgen/plugins/menustyles/horizontal.rb +2 -2
  209. data/lib/webgen/plugins/menustyles/horizontal_dropdown.rb +2 -2
  210. data/lib/webgen/plugins/menustyles/partial.rb +2 -2
  211. data/lib/webgen/plugins/menustyles/vertical.rb +2 -2
  212. data/lib/webgen/plugins/menustyles/vertical_dropdown.rb +2 -2
  213. data/lib/webgen/plugins/miscplugins/smileyreplacer.rb +84 -0
  214. data/lib/webgen/plugins/{treewalker.rb → miscplugins/treewalker.rb} +1 -1
  215. data/lib/webgen/plugins/tags/{navbar.rb → breadcrumbtrail.rb} +5 -9
  216. data/lib/webgen/plugins/tags/date.rb +2 -6
  217. data/lib/webgen/plugins/tags/download.rb +155 -0
  218. data/lib/webgen/plugins/tags/executecommand.rb +2 -6
  219. data/lib/webgen/plugins/tags/includefile.rb +4 -8
  220. data/lib/webgen/plugins/tags/langbar.rb +2 -6
  221. data/lib/webgen/plugins/tags/menu.rb +2 -7
  222. data/lib/webgen/plugins/tags/meta.rb +2 -6
  223. data/lib/webgen/plugins/tags/relocatable.rb +2 -6
  224. data/lib/webgen/plugins/tags/sitemap.rb +14 -10
  225. data/lib/webgen/plugins/tags/tags.rb +25 -18
  226. data/lib/webgen/plugins/tags/wikilink.rb +2 -6
  227. metadata +311 -195
  228. data/doc/src/design.gallery +0 -18
  229. data/doc/src/designs/curdesign.png +0 -0
  230. data/doc/src/designs/nostyle.png +0 -0
  231. data/doc/src/designs/old.png +0 -0
  232. data/doc/src/documentation/plugins/gallerylayouter/defaultlayouter.page +0 -12
  233. data/doc/src/documentation/plugins/system/index.page +0 -7
  234. data/doc/src/documentation/plugins/tags/navbar.page +0 -20
  235. data/lib/webgen/webgen.rb +0 -271
  236. data/testsite/config.yaml +0 -7
  237. data/testsite/src/bghack.png +0 -0
  238. data/testsite/src/bluecloth.page +0 -102
  239. data/testsite/src/default.css +0 -146
  240. data/testsite/src/default.template +0 -33
  241. data/testsite/src/home.en.page +0 -22
  242. data/testsite/src/home.page +0 -22
  243. data/testsite/src/images/bghack.png +0 -0
  244. data/testsite/src/index.page +0 -21
  245. data/testsite/src/meta.info +0 -12
  246. data/testsite/src/news.page +0 -20
  247. data/testsite/src/news_are_so-cool.de.page +0 -19
  248. data/testsite/src/noindex/noindex.page +0 -20
  249. data/testsite/src/pictures/index.page +0 -20
  250. data/testsite/src/projects.de.page +0 -11
  251. data/testsite/src/projects.es.page +0 -11
  252. data/testsite/src/projects.page +0 -17
  253. data/testsite/src/projects/00.index.de.page +0 -10
  254. data/testsite/src/projects/01.project2.page +0 -20
  255. data/testsite/src/projects/02.project1.page +0 -20
  256. data/testsite/src/projects/05.project3.page +0 -22
  257. data/testsite/src/projects/index.page +0 -20
  258. data/testsite/src/projects/subproj/index.page +0 -22
  259. data/testsite/src/projects/subproj/project3.page +0 -21
  260. data/testsite/src/rdoc.page +0 -12
  261. data/testsite/src/redcloth.page +0 -106
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: defaultcontenthandler.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: default.rb 349 2005-09-02 09:28:06Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: html.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: html.rb 349 2005-09-02 09:28:06Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -20,7 +20,7 @@
20
20
  #++
21
21
  #
22
22
 
23
- require 'webgen/plugins/contenthandler/defaultcontenthandler'
23
+ require 'webgen/plugins/contenthandlers/default'
24
24
 
25
25
  module ContentHandlers
26
26
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: markdown.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: markdown.rb 349 2005-09-02 09:28:06Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -23,7 +23,7 @@
23
23
 
24
24
  begin
25
25
  require 'bluecloth'
26
- require 'webgen/plugins/contenthandler/defaultcontenthandler'
26
+ require 'webgen/plugins/contenthandlers/default'
27
27
 
28
28
  module ContentHandlers
29
29
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: rdoc.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: rdoc.rb 349 2005-09-02 09:28:06Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -22,7 +22,7 @@
22
22
 
23
23
  require 'rdoc/markup/simple_markup'
24
24
  require 'rdoc/markup/simple_markup/to_html'
25
- require 'webgen/plugins/contenthandler/defaultcontenthandler'
25
+ require 'webgen/plugins/contenthandlers/default'
26
26
 
27
27
  module ContentHandlers
28
28
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: textile.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: textile.rb 349 2005-09-02 09:28:06Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -22,7 +22,7 @@
22
22
 
23
23
  begin
24
24
  require 'redcloth'
25
- require 'webgen/plugins/contenthandler/defaultcontenthandler'
25
+ require 'webgen/plugins/contenthandlers/default'
26
26
 
27
27
  module ContentHandlers
28
28
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: configuration.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: configuration.rb 349 2005-09-02 09:28:06Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -22,6 +22,7 @@
22
22
 
23
23
  require 'find'
24
24
  require 'tsort'
25
+ require 'cmdparse'
25
26
  require 'webgen/node'
26
27
  require 'webgen/plugin'
27
28
 
@@ -37,14 +38,18 @@ end
37
38
 
38
39
  module Webgen
39
40
 
40
- VERSION = [0, 3, 6]
41
+ VERSION = [0, 3, 7]
41
42
  SUMMARY = "Webgen is a templated based static website generator."
42
43
  DESCRIPTION = "Webgen is a web page generator implemented in Ruby. " \
43
44
  "It is used to generate static web pages from templates and page " \
44
45
  "description files."
45
46
 
47
+ end
48
+
49
+ module CorePlugins
50
+
46
51
  # Responsible for loading the other plugin files and holds the basic configuration options.
47
- class Configuration < Plugin
52
+ class Configuration < Webgen::Plugin
48
53
 
49
54
  summary "Responsible for loading plugins and holding general parameters"
50
55
 
@@ -52,6 +57,10 @@ module Webgen
52
57
  add_param 'outDirectory', 'output', 'The directory to which the output files are written.'
53
58
  add_param 'lang', 'en', 'The default language.'
54
59
 
60
+ # Returns the +CommandParser+ object used for parsing the command line. You can add site
61
+ # specific commands to it by calling the Configuration#add_cmdparser_command method!
62
+ attr_accessor :cmdparser
63
+
55
64
  # Returns the data directory of webgen.
56
65
  def self.data_dir
57
66
  unless defined?( @@data_dir )
@@ -74,9 +83,13 @@ module Webgen
74
83
  @@data_dir
75
84
  end
76
85
 
86
+ def add_cmdparser_command( command )
87
+ @cmdparser.add_command( command ) if @cmdparser
88
+ end
89
+
77
90
  # Does all the initialisation stuff
78
91
  def init_all
79
- load_plugins( File.dirname( __FILE__) + '/plugins', File.dirname( __FILE__).sub(/webgen$/, '') )
92
+ load_plugins( File.dirname( __FILE__).sub( /coreplugins$/,'' ), File.dirname( __FILE__).sub(/webgen\/plugins\/coreplugins$/, '') )
80
93
  load_plugins( 'plugin', '' )
81
94
  init_plugins
82
95
  end
@@ -85,29 +98,36 @@ module Webgen
85
98
  # trimmed: if +trimpath+ matches the beginning of the string, +trimpath+ is deleted from it.
86
99
  def load_plugins( path, trimpath )
87
100
  Find.find( path ) do |file|
88
- Find.prune unless File.directory?( file ) || (/.rb$/ =~ file)
89
- self.logger.debug { "Loading plugin file <#{file}>..." }
90
- require file.gsub(/^#{trimpath}/, '') if File.file?( file )
101
+ trimmedFile = file.gsub(/^#{trimpath}/, '')
102
+ Find.prune unless File.directory?( file ) || ( (/.rb$/ =~ file) && !$".include?( trimmedFile ) )
103
+ if File.file?( file )
104
+ self.logger.debug { "Loading plugin file <#{file}>..." }
105
+ require trimmedFile
106
+ end
91
107
  end
92
108
  end
93
109
 
94
110
  # Instantiate the plugins in the correct order, except the classes which have a constant
95
- # +VIRTUAL+.
111
+ # +VIRTUAL+, and add CommandPlugin instance to the global CommandParser.
96
112
  def init_plugins
97
113
  dep = Dependency.new
98
- Plugin.config.each {|k,data| dep[data.plugin] = data.dependencies || []}
99
- self.logger.debug { "Dependencies: #{dep.inspect}" }
114
+ Webgen::Plugin.config.each {|k,data| dep[data.plugin] = data.dependencies || []}
100
115
  dep.tsort.each do |plugin|
101
- data = Plugin.config.find {|k,v| v.plugin == plugin }[1]
102
- self.logger.debug { "Creating plugin of class #{data.klass.name}" }
103
- data.obj ||= data.klass.new unless data.klass.const_defined?( 'VIRTUAL' )
116
+ data = Webgen::Plugin.config.find {|k,v| v.plugin == plugin }[1]
117
+ unless data.klass.const_defined?( 'VIRTUAL' ) || data.obj
118
+ self.logger.debug { "Creating plugin of class #{data.klass.name}" }
119
+ data.obj ||= data.klass.new
120
+ end
121
+ end
122
+ Webgen::Plugin.config.keys.find_all {|klass| klass.ancestors.include?( Webgen::CommandPlugin )}.each do |cmdKlass|
123
+ add_cmdparser_command( Webgen::Plugin.config[cmdKlass].obj )
104
124
  end
105
125
  end
106
126
 
107
127
  end
108
128
 
109
129
  # Initialize single configuration instance
110
- Plugin.config[Configuration].obj = Configuration.new
130
+ Webgen::Plugin.config[Configuration].obj = Configuration.new
111
131
 
112
132
  end
113
133
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: logging.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: logging.rb 350 2005-09-02 09:44:23Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -73,9 +73,9 @@ class Module
73
73
 
74
74
  end
75
75
 
76
- module Webgen
76
+ module CorePlugins
77
77
 
78
- class Logging < Plugin
78
+ class Logging < Webgen::Plugin
79
79
 
80
80
  summary "Plugin for configuring the logger"
81
81
 
@@ -96,6 +96,6 @@ module Webgen
96
96
  end
97
97
 
98
98
  # Initialize single logging instance
99
- Plugin.config[Logging].obj = Logging.new
99
+ Webgen::Plugin.config[Logging].obj = Logging.new
100
100
 
101
101
  end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: resourcemanager.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: resourcemanager.rb 350 2005-09-02 09:44:23Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -23,11 +23,11 @@
23
23
  require 'rbconfig'
24
24
  require 'fileutils'
25
25
  require 'webgen/plugins/tags/tags'
26
- require 'webgen/plugins/filehandler/filehandler'
26
+ require 'webgen/plugins/filehandlers/filehandler'
27
27
 
28
- module Webgen
28
+ module CorePlugins
29
29
 
30
- class ResourceManager < Plugin
30
+ class ResourceManager < Webgen::Plugin
31
31
 
32
32
  class Resource
33
33
 
@@ -131,9 +131,9 @@ module Webgen
131
131
  attr_reader :data_dir
132
132
 
133
133
  def initialize
134
- Plugin.config[self.class].resources = {}
135
- Plugin['FileHandler'].add_msg_listener( :AFTER_ALL_WRITTEN, method( :write_resources ) )
136
- define_webgen_resources unless Webgen::Configuration.data_dir.empty?
134
+ Webgen::Plugin.config[self.class].resources = {}
135
+ Webgen::Plugin['FileHandler'].add_msg_listener( :AFTER_ALL_WRITTEN, method( :write_resources ) )
136
+ define_webgen_resources unless CorePlugins::Configuration.data_dir.empty?
137
137
  define_user_resources
138
138
  end
139
139
 
@@ -160,7 +160,7 @@ module Webgen
160
160
 
161
161
  # Returns the requested resource.
162
162
  def get_resource( name )
163
- Plugin.config[self.class].resources[name]
163
+ Webgen::Plugin.config[self.class].resources[name]
164
164
  end
165
165
 
166
166
 
@@ -178,28 +178,56 @@ module Webgen
178
178
  #######
179
179
 
180
180
  def define_resource( name, res )
181
- if Plugin.config[self.class].resources.has_key?( name )
181
+ if Webgen::Plugin.config[self.class].resources.has_key?( name )
182
182
  logger.error { "Resource #{name} already defined, not using new definition (#{res.inspect})" }
183
183
  else
184
184
  logger.info { "Adding resource #{name} to pool (#{res.inspect})" }
185
- Plugin.config[self.class].resources[name] = res
185
+ Webgen::Plugin.config[self.class].resources[name] = res
186
186
  end
187
187
  end
188
188
 
189
189
  def define_webgen_resources
190
- define_file_resource( 'webgen-logo', File.join( Webgen::Configuration.data_dir, 'images', 'webgen_logo.png' ),
190
+ define_file_resource( 'webgen-logo', File.join( CorePlugins::Configuration.data_dir, 'resources', 'images', 'webgen_logo.png' ),
191
191
  '/images/webgen-logo.png' ).predefined = "The logo of webgen as seen on the homepage."
192
- define_file_resource( 'webgen-generated', File.join( Webgen::Configuration.data_dir, 'images', 'generated_by_webgen.png' ),
192
+ define_file_resource( 'webgen-generated', File.join( CorePlugins::Configuration.data_dir, 'resources', 'images', 'generated_by_webgen.png' ),
193
193
  '/images/webgen-generated-by.png' ).predefined = "A 88x31 image for use on web sites that were generated by webgen."
194
- define_file_resource( 'w3c-valid-css', File.join( Webgen::Configuration.data_dir, 'images', 'valid-css.gif' ),
194
+ define_file_resource( 'w3c-valid-css', File.join( CorePlugins::Configuration.data_dir, 'resources', 'images', 'valid-css.gif' ),
195
195
  '/images/w3c-valid-css.gif' ).predefined = 'The W3C image for valid css.'
196
- define_file_resource( 'w3c-valid-xhtml11', File.join( Webgen::Configuration.data_dir, 'images', 'valid-xhtml11.png' ),
196
+ define_file_resource( 'w3c-valid-xhtml11', File.join( CorePlugins::Configuration.data_dir, 'resources', 'images', 'valid-xhtml11.png' ),
197
197
  '/images/w3c-valid-xhtml11.png' ).predefined = "The W3C image for valid XHTML1.1"
198
198
 
199
+ define_webgen_emoticons
200
+ define_webgen_icons
201
+
199
202
  define_memory_resource( 'webgen-css', '/css/webgen.css' ).predefined = "Plugins use this resource for their CSS styles."
200
203
  define_memory_resource( 'webgen-javascript', '/css/webgen.js' ).predefined = "Plugins use this resource for their Javascript fragments."
201
204
  end
202
205
 
206
+ def define_webgen_emoticons
207
+ Dir[File.join( CorePlugins::Configuration.data_dir, 'resources', 'emoticons', '*/')].each do |pack_dir|
208
+ pack = File.basename( pack_dir )
209
+ Dir[File.join( pack_dir, '*' )].each do |smiley_file|
210
+ smiley = File.basename( smiley_file, '.*' )
211
+ res = define_file_resource( "webgen-emoticons-#{pack}-#{smiley}",
212
+ smiley_file,
213
+ "/images/emoticons/#{pack}-#{File.basename(smiley_file)}" )
214
+ res.predefined = "Emoticon from pack '#{pack}' for '#{smiley}'"
215
+ end
216
+ end
217
+ end
218
+
219
+ def define_webgen_icons
220
+ base_dir = File.join( CorePlugins::Configuration.data_dir, 'resources', 'icons' )
221
+ Dir[File.join( base_dir, '**/*')].each do |icon|
222
+ dirs = File.dirname( icon ).sub( /^#{base_dir}/, '' ).split( '/' ).join( '-' )
223
+ dirs += '-' if dirs.length > 0
224
+ res = define_file_resource( "webgen-icons-#{dirs}#{File.basename( icon, '.*' )}",
225
+ icon,
226
+ "/images/icons/#{dirs}#{File.basename(icon)}" )
227
+ res.predefined = "Icon named #{File.basename(icon)}"
228
+ end
229
+ end
230
+
203
231
  def define_user_resources
204
232
  p = get_param( 'resources' )
205
233
  if !p.kind_of?( Array ) || p.find {|h| !h.kind_of?( Array ) || h.length != 3}
@@ -211,7 +239,7 @@ module Webgen
211
239
 
212
240
 
213
241
  def write_resources
214
- Plugin.config[self.class].resources.each do |name, res|
242
+ Webgen::Plugin.config[self.class].resources.each do |name, res|
215
243
  if res.write_resource?
216
244
  begin
217
245
  FileUtils.makedirs( File.dirname( res.dest_path ) )
@@ -239,15 +267,9 @@ module Tags
239
267
  add_param 'name', nil, 'The name of the resource'
240
268
  add_param 'insert', :path, 'What should be returned by the tag: the path to the resource (value :path) ' \
241
269
  'or the data (value :data)'
242
-
243
270
  set_mandatory 'name', true
244
271
 
245
- depends_on 'Tags'
246
-
247
- def initialize
248
- super
249
- register_tag( 'resource' )
250
- end
272
+ tag 'resource'
251
273
 
252
274
  def process_tag( tag, node, refNode )
253
275
  result = ''
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: backing.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: backing.rb 350 2005-09-02 09:44:23Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -20,9 +20,9 @@
20
20
  #++
21
21
  #
22
22
 
23
- require 'webgen/plugins/filehandler/filehandler'
24
- require 'webgen/plugins/filehandler/directory'
25
- require 'webgen/plugins/filehandler/page'
23
+ require 'webgen/plugins/filehandlers/filehandler'
24
+ require 'webgen/plugins/filehandlers/directory'
25
+ require 'webgen/plugins/filehandlers/page'
26
26
 
27
27
  module FileHandlers
28
28
 
@@ -94,7 +94,7 @@ module FileHandlers
94
94
  dirNode = create_path( dirname, dirNode )
95
95
 
96
96
  self.logger.debug { "Trying to create virtual node for '#{filename}'..." }
97
- pageNode = Webgen::Plugin['VirtualPageHandler'].create_node_from_data( '', filename, dirNode )
97
+ pageNode = Webgen::Plugin['VirtualPageFileHandler'].create_node_from_data( '', filename, dirNode )
98
98
  dirNode.add_child( pageNode )
99
99
  pageNode.metainfo.update( data )
100
100
  pageNode['int:virtualNode'] = true
@@ -120,8 +120,8 @@ module FileHandlers
120
120
  node = node.find {|child| /^#{element}\/?$/ =~ child['src'] }
121
121
  end
122
122
  if node.nil?
123
- node = FileHandlers::DirHandler::DirNode.new( parent, element )
124
- node['processor'] = Webgen::Plugin['VirtualDirHandler']
123
+ node = FileHandlers::DirectoryHandler::DirNode.new( parent, element )
124
+ node['processor'] = Webgen::Plugin['VirtualDirectoryHandler']
125
125
  parent.add_child( node )
126
126
  self.logger.info { "Created virtual directory <#{node.recursive_value( 'dest' )}>" }
127
127
  end
@@ -135,10 +135,10 @@ module FileHandlers
135
135
 
136
136
 
137
137
  # Handles virtual directories, that is, directories that do not exist in the source tree.
138
- class VirtualDirHandler < DirHandler
138
+ class VirtualDirectoryHandler < DirectoryHandler
139
139
 
140
140
  summary "Handles virtual directories"
141
- depends_on "DirHandler"
141
+ depends_on "DirectoryHandler"
142
142
 
143
143
  def write_node( node )
144
144
  end
@@ -146,10 +146,10 @@ module FileHandlers
146
146
  end
147
147
 
148
148
  # Handles virtual pages, that is, pages that do not exist in the source tree.
149
- class VirtualPageHandler < PageHandler
149
+ class VirtualPageFileHandler < PageFileHandler
150
150
 
151
151
  summary "Handles virtual pages"
152
- depends_on "PageHandler"
152
+ depends_on "PageFileHandler"
153
153
 
154
154
  def write_node( node )
155
155
  end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: filecopy.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: copy.rb 350 2005-09-02 09:44:23Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -21,13 +21,13 @@
21
21
  #
22
22
 
23
23
  require 'fileutils'
24
- require 'webgen/plugins/filehandler/filehandler'
24
+ require 'webgen/plugins/filehandlers/filehandler'
25
25
 
26
26
  module FileHandlers
27
27
 
28
28
  # A simple file handler which copies files with a specific extension from the source to the output
29
29
  # directory. The extensions of the files to copy are customizable.
30
- class FileCopyHandler < DefaultFileHandler
30
+ class CopyFileHandler < DefaultFileHandler
31
31
 
32
32
  summary "Copies files from source to destination without modification"
33
33
  add_param 'paths', ['**/*.css', '**/*.jpg', '**/*.png', '**/*.gif'], \
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: directory.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: directory.rb 349 2005-09-02 09:28:06Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -20,12 +20,12 @@
20
20
  #++
21
21
  #
22
22
 
23
- require 'webgen/plugins/filehandler/filehandler'
23
+ require 'webgen/plugins/filehandlers/filehandler'
24
24
 
25
25
  module FileHandlers
26
26
 
27
27
  # Handles directories.
28
- class DirHandler < DefaultFileHandler
28
+ class DirectoryHandler < DefaultFileHandler
29
29
 
30
30
  # Specialized node describing a directory.
31
31
  class DirNode < Node
@@ -34,7 +34,7 @@ module FileHandlers
34
34
  super( parent )
35
35
  self['title'] = name
36
36
  self['src'] = self['dest'] = name + '/'
37
- self['processor'] = Webgen::Plugin['DirHandler']
37
+ self['processor'] = Webgen::Plugin['DirectoryHandler']
38
38
  self['int:directory?'] = true
39
39
  end
40
40
 
@@ -44,13 +44,18 @@ module FileHandlers
44
44
  end
45
45
 
46
46
  def process_dir_index
47
- node = node_for_string( Webgen::Plugin['DirHandler']['indexFile'] )
48
- if node
49
- self.logger.info { "Directory index file for <#{self.recursive_value( 'src' )}> => <#{node.recursive_value( 'src', false )}>" }
50
- self['indexFile'] = node
51
- else
52
- self.logger.warn { "No directory index file found for directory <#{self.recursive_value( 'src' )}>" }
47
+ indexFile = Webgen::Plugin['DirectoryHandler']['indexFile']
48
+ if indexFile.nil?
53
49
  self['indexFile'] = nil
50
+ else
51
+ node = node_for_string( indexFile )
52
+ if node
53
+ self.logger.info { "Directory index file for <#{self.recursive_value( 'src' )}> => <#{node.recursive_value( 'src', false )}>" }
54
+ self['indexFile'] = node
55
+ else
56
+ self.logger.warn { "No directory index file found for directory <#{self.recursive_value( 'src' )}>" }
57
+ self['indexFile'] = nil
58
+ end
54
59
  end
55
60
  end
56
61