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: horizontal.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: horizontal.rb 348 2005-09-02 08:43:33Z 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/menustyles/defaultmenustyle'
23
+ require 'webgen/plugins/menustyles/default'
24
24
 
25
25
  module MenuStyles
26
26
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: horizontal_dropdown.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: horizontal_dropdown.rb 348 2005-09-02 08:43:33Z 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/menustyles/defaultmenustyle'
23
+ require 'webgen/plugins/menustyles/default'
24
24
 
25
25
  module MenuStyles
26
26
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: partial.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: partial.rb 348 2005-09-02 08:43:33Z 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/menustyles/defaultmenustyle'
23
+ require 'webgen/plugins/menustyles/default'
24
24
 
25
25
  module MenuStyles
26
26
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: vertical.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: vertical.rb 348 2005-09-02 08:43:33Z 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/menustyles/defaultmenustyle'
23
+ require 'webgen/plugins/menustyles/default'
24
24
 
25
25
  module MenuStyles
26
26
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: vertical_dropdown.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: vertical_dropdown.rb 348 2005-09-02 08:43:33Z 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/menustyles/defaultmenustyle'
23
+ require 'webgen/plugins/menustyles/default'
24
24
 
25
25
  module MenuStyles
26
26
 
@@ -0,0 +1,84 @@
1
+ #
2
+ #--
3
+ #
4
+ # $Id: smileyreplacer.rb 350 2005-09-02 09:44:23Z thomas $
5
+ #
6
+ # webgen: template based static website generator
7
+ # Copyright (C) 2004 Thomas Leitner
8
+ #
9
+ # This program is free software; you can redistribute it and/or modify it under the terms of the GNU
10
+ # General Public License as published by the Free Software Foundation; either version 2 of the
11
+ # License, or (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
14
+ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License along with this program; if not,
18
+ # write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ #++
21
+ #
22
+
23
+ require 'webgen/plugins/filehandlers/filehandler'
24
+ require 'webgen/plugins/coreplugins/resourcemanager'
25
+
26
+ module MiscPlugins
27
+
28
+ class SmileyReplacer < Webgen::Plugin
29
+
30
+ summary "Replaces smiley characters with actual smileys"
31
+ depends_on 'FileHandler', 'ResourceManager'
32
+
33
+ add_param 'emoticonPack', nil, 'The name of the emoticon package which should be used. If set to nil, ' \
34
+ 'smileys are not replaced.'
35
+
36
+ used_meta_info 'emoticonPack'
37
+
38
+ SMILEY_MAP = {
39
+ ':-@' => 'angry',
40
+ '8-)' => 'cool',
41
+ ':\'-(' => 'cry',
42
+ ':*)' => 'drunk',
43
+ ':-D' => 'lol',
44
+ ':-O' => 'oops',
45
+ ':-(' => 'sad',
46
+ '|-I' => 'sleep',
47
+ ':-)' => 'smile',
48
+ ':-P' => 'tongue',
49
+ ';-)' => 'wink'
50
+ }
51
+ SMILEY_REGEXP = Regexp.union( *SMILEY_MAP.keys.collect {|t| /#{Regexp.escape(t)}/ } )
52
+
53
+ def initialize
54
+ Webgen::Plugin['PageFileHandler'].add_msg_listener( :AFTER_CONTENT_RENDERED, method( :replace_smileys ) )
55
+ end
56
+
57
+ #######
58
+ private
59
+ #######
60
+
61
+ def replace_smileys( content, node )
62
+ pack = smiley_pack( node )
63
+ return if pack.nil?
64
+
65
+ logger.info { "Replacing smileys in file <#{node.recursive_value('dest')}>..." }
66
+ content.gsub!( SMILEY_REGEXP ) do |match|
67
+ logger.info { "Found smiley #{match}, trying to replace it with emoticon..." }
68
+ if res = Webgen::Plugin['ResourceManager'].get_resource( "webgen-emoticons-#{pack}-#{SMILEY_MAP[match]}" )
69
+ res.referenced!
70
+ "<img src=\"#{res.relpath_from_node( node )}\" alt=\"smiley #{match}\" />"
71
+ else
72
+ logger.warn { "Could not replace smiley '#{match}'(#{SMILEY_MAP[match]}) in <#{node.recursive_value('src')}>: resource not found!" }
73
+ match
74
+ end
75
+ end
76
+ end
77
+
78
+ def smiley_pack( node )
79
+ node.metainfo.has_key?( 'emoticonPack' ) && node['emoticonPack'].nil? ? nil : node['emoticonPack'] || get_param( 'emoticonPack' )
80
+ end
81
+
82
+ end
83
+
84
+ end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: treewalker.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: treewalker.rb 348 2005-09-02 08:43:33Z 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: navbar.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: breadcrumbtrail.rb 355 2005-09-05 18:04:17Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -24,7 +24,7 @@ require 'webgen/plugins/tags/tags'
24
24
 
25
25
  module Tags
26
26
 
27
- # Generates a navigation bar. A navigation bar consists of all pages in the hierarchy of the
27
+ # Generates a breadcrumb trail. It consists of all pages in the hierarchy of the
28
28
  # current page.
29
29
  #
30
30
  # For example, assuming we have the following branch
@@ -32,16 +32,12 @@ module Tags
32
32
  # this plugin will generate something like this:
33
33
  # root / directory1 / directory2 / currentFile
34
34
  # where each listed name is linked to the corresponding file.
35
- class NavbarTag < DefaultTag
35
+ class BreadcrumbTrailTag < DefaultTag
36
36
 
37
37
  summary 'Shows the hierarchy of current page'
38
38
  add_param 'separator', ' / ', 'Separates the hierachy entries from each other.'
39
- depends_on 'Tags'
40
39
 
41
- def initialize
42
- super
43
- register_tag( 'navbar' )
44
- end
40
+ tag 'breadcrumbTrail'
45
41
 
46
42
  def process_tag( tag, srcNode, refNode )
47
43
  out = []
@@ -53,7 +49,7 @@ module Tags
53
49
  end
54
50
 
55
51
  out = out.reverse.join( get_param( 'separator' ) )
56
- self.logger.debug { "Navbar for #{srcNode.recursive_value( 'src' )}: #{out}" }
52
+ self.logger.debug { "Breadcrumb trail for <#{srcNode.recursive_value( 'src' )}>: #{out}" }
57
53
  out
58
54
  end
59
55
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: date.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: date.rb 324 2005-07-04 12:54:25Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -30,12 +30,8 @@ module Tags
30
30
 
31
31
  summary "Prints out the date"
32
32
  add_param 'format', '%A, %B %d %H:%M:%S %Z %Y', 'The format of the date (same options as Time#strftime).'
33
- depends_on 'Tags'
34
33
 
35
- def initialize
36
- super
37
- register_tag( 'date' )
38
- end
34
+ tag 'date'
39
35
 
40
36
  def process_tag( tag, node, refNode )
41
37
  Time.now.strftime( get_param( 'format' ) )
@@ -0,0 +1,155 @@
1
+ #
2
+ #--
3
+ #
4
+ # $Id: download.rb 349 2005-09-02 09:28:06Z thomas $
5
+ #
6
+ # webgen: template based static website generator
7
+ # Copyright (C) 2004 Thomas Leitner
8
+ #
9
+ # This program is free software; you can redistribute it and/or modify it under the terms of the GNU
10
+ # General Public License as published by the Free Software Foundation; either version 2 of the
11
+ # License, or (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
14
+ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License along with this program; if not,
18
+ # write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ #++
21
+ #
22
+
23
+ require 'webgen/plugins/tags/tags'
24
+ require 'webgen/plugins/coreplugins/resourcemanager'
25
+ require 'yaml'
26
+ require 'uri'
27
+ require 'open-uri'
28
+
29
+ module Tags
30
+
31
+ class DownloadTag < DefaultTag
32
+
33
+ summary "Provides a nice download link and, optional, image "
34
+ add_param 'url', nil, 'The URL to the file. Can be a local file or one referenced via HTTP/FTP.'
35
+ add_param 'icon', nil, 'The URL to an icon which will be shown next to the name.'
36
+ add_param 'alwaysShowDownloadIcon', false, 'Specifies if the download icon should always be shown, or only ' \
37
+ 'when no icon is available for the file type.'
38
+ add_param 'mappingFile', nil, 'An additional mapping file used for mapping extensions to icons.'
39
+ set_mandatory 'url', true
40
+
41
+ depends_on 'ResourceManager'
42
+
43
+ CSS = '
44
+ .webgen-file-icon, .webgen-download-icon {
45
+ vertical-align: middle;
46
+ }
47
+ '
48
+
49
+ tag 'download'
50
+
51
+ def initialize
52
+ super
53
+ Webgen::Plugin['ResourceManager'].append_data( 'webgen-css', CSS )
54
+ @default_mapping = load_mapping( File.join( CorePlugins::Configuration.data_dir, 'icon_mapping.yaml' ) )
55
+ end
56
+
57
+ def process_tag( tag, node, refNode )
58
+ url = get_param( 'url' )
59
+ return '' if url.nil?
60
+
61
+ mapping = @default_mapping.dup
62
+ mapping.update( load_mapping( get_param( 'mappingFile' ) ) ) if File.exists?( get_param( 'mappingFile' ) || '' )
63
+
64
+ icon = file_icon( File.extname( url ), mapping, node )
65
+ output = ''
66
+ output << download_icon if get_param( 'alwaysShowDownloadIcon' ) || icon.nil?
67
+ output << icon unless icon.nil?
68
+ output << file_link( url, node, refNode )
69
+ output << file_size( url, refNode )
70
+ end
71
+
72
+ #######
73
+ private
74
+ #######
75
+
76
+ def download_icon
77
+ "<img class=\"webgen-download-icon\" src=\"{resource: webgen-icons-download}\" alt=\"Download icon\" />"
78
+ end
79
+
80
+ def file_icon( ext, mapping, node )
81
+ data = mapping[ext]
82
+ src = get_param( 'icon' )
83
+ if src.nil? && !data.nil?
84
+ if data[0] == :resource
85
+ src = "{resource: #{data[1]}}"
86
+ else
87
+ icon_node = Node.root( node ).node_for_string( data[1] )
88
+ unless icon_node.nil?
89
+ src = node.relpath_to_node( icon_node )
90
+ end
91
+ end
92
+ end
93
+ (src.nil? ? nil : "<img class=\"webgen-file-icon\" src=\"#{src}\" alt=\"File icon\" />")
94
+ end
95
+
96
+ def file_link( url, node, refNode )
97
+ link = if URI.parse( url ).absolute?
98
+ url
99
+ else
100
+ fileNode = refNode.node_for_string( url )
101
+ (fileNode.nil? ? '' : node.relpath_to_node( fileNode ))
102
+ end
103
+ "<a href=\"#{link}\">#{File.basename( url )}</a>"
104
+ end
105
+
106
+ UNIT_NAMES = ['Byte', 'KiB', 'MiB', 'GiB', 'TiB']
107
+
108
+ def file_size( url, refNode )
109
+ size = nil
110
+ catch :size do
111
+ begin
112
+ if URI.parse( url ).absolute?
113
+ open( url, :content_length_proc => proc {|size| throw :size} ) {|f| }
114
+ else
115
+ fileNode = refNode.node_for_string( url )
116
+ size = File.size( fileNode.recursive_value( 'src' ) )
117
+ end
118
+ rescue
119
+ end
120
+ end
121
+
122
+ if size.nil?
123
+ logger.warn { "Could not get file size information for file <#{url}>" }
124
+ ''
125
+ else
126
+ size, unit = [size.to_f, 0]
127
+ size, unit = [size / 1024, unit + 1] while size > 1024
128
+ format_str = if unit == 0
129
+ " (%d %s)"
130
+ else
131
+ " (%.2f %s)"
132
+ end
133
+ format_str % [size, UNIT_NAMES[unit]]
134
+ end
135
+ end
136
+
137
+ def load_mapping( file )
138
+ data = YAML::load( File.read( file ) )
139
+ mapping = {}
140
+ if data['resource-mapping']
141
+ data['resource-mapping'].each do |icon, exts|
142
+ exts.each {|ext| mapping[ext] = [:resource, icon]}
143
+ end
144
+ end
145
+ if data['file-mapping']
146
+ data['file-mapping'].each do |icon, exts|
147
+ exts.each {|ext| mapping[ext] = [:file, icon]}
148
+ end
149
+ end
150
+ mapping
151
+ end
152
+
153
+ end
154
+
155
+ end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: executecommand.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: executecommand.rb 324 2005-07-04 12:54:25Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -30,16 +30,12 @@ module Tags
30
30
  class ExecuteCommandTag < DefaultTag
31
31
 
32
32
  summary "Executes the given command and includes its standard output"
33
- depends_on 'Tags'
34
33
  add_param 'command', nil, 'The command which should be executed'
35
34
  add_param 'processOutput', true, 'The output of the command will be processed if true'
36
35
  add_param 'escapeHTML', true, 'Special HTML characters in the output will be escaped if true'
37
36
  set_mandatory 'command', true
38
37
 
39
- def initialize
40
- super
41
- register_tag( 'execute' )
42
- end
38
+ tag 'execute'
43
39
 
44
40
  def process_tag( tag, node, refNode )
45
41
  @processOutput = get_param( 'processOutput' )
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: includefile.rb 334 2005-08-23 19:11:53Z thomas $
4
+ # $Id: includefile.rb 324 2005-07-04 12:54:25Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -29,22 +29,18 @@ module Tags
29
29
  class IncludeFileTag < DefaultTag
30
30
 
31
31
  summary "Includes a file verbatim"
32
- depends_on 'Tags'
33
32
  add_param 'filename', nil, 'The name of the file which should be included'
34
- add_param 'processOutput', true, 'The file content will be processed if true'
33
+ add_param 'processOutput', true, 'The file content will be scanned for tags if true'
35
34
  add_param 'escapeHTML', true, 'Special HTML characters in the file content will be escaped if true'
36
35
  set_mandatory 'filename', true
37
36
 
38
- def initialize
39
- super
40
- register_tag( 'includeFile' )
41
- end
37
+ tag 'includeFile'
42
38
 
43
39
  def process_tag( tag, node, refNode )
44
40
  @processOutput = get_param( 'processOutput' )
45
41
  content = ''
46
42
  begin
47
- filename = refNode.parent.recursive_value( 'src' ) + get_param( 'filename' )
43
+ filename = refNode.parent_dir.recursive_value( 'src' ) + get_param( 'filename' )
48
44
  self.logger.debug { "File location: <#{filename}>" }
49
45
  content = File.read( filename )
50
46
  rescue