webgen 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. data/ChangeLog +76 -0
  2. data/Rakefile +23 -18
  3. data/TODO +5 -0
  4. data/VERSION +1 -1
  5. data/doc/metainfo.yaml +4 -1
  6. data/doc/src/default.template +5 -1
  7. data/doc/src/documentation/basics.page +148 -0
  8. data/doc/src/documentation/extending_webgen.page +4 -1
  9. data/doc/src/documentation/index.page +6 -3
  10. data/doc/src/documentation/plugins/core/filehandler.page +1 -1
  11. data/doc/src/documentation/plugins/file/directoryhandler.page +1 -1
  12. data/doc/src/documentation/references/index.page +20 -1
  13. data/doc/src/documentation/references/meta_info_reference.page +2 -1
  14. data/doc/src/documentation/{gettingstarted.page → tutorial.page} +6 -103
  15. data/doc/src/news.page +11 -0
  16. data/lib/webgen/config.rb +4 -4
  17. data/lib/webgen/node.rb +4 -2
  18. data/lib/webgen/plugins/filehandlers/template.rb +3 -1
  19. data/lib/webgen/plugins/miscplugins/rendered_files.rb +75 -0
  20. data/lib/webgen/rake/webgentask.rb +161 -0
  21. data/test/fixtures/sample_site/src/index.de.page +1 -0
  22. data/test/unittests/tc_filehandler_template.rb +3 -0
  23. data/test/unittests/tc_node.rb +3 -0
  24. metadata +6 -266
  25. data/doc/examples/website_styles/1024px/README +0 -9
  26. data/doc/examples/website_styles/1024px/config.yaml +0 -2
  27. data/doc/examples/website_styles/1024px/src/about.page +0 -12
  28. data/doc/examples/website_styles/1024px/src/default.css +0 -188
  29. data/doc/examples/website_styles/1024px/src/default.template +0 -62
  30. data/doc/examples/website_styles/1024px/src/download.page +0 -15
  31. data/doc/examples/website_styles/1024px/src/features.page +0 -8
  32. data/doc/examples/website_styles/1024px/src/images/background.gif +0 -0
  33. data/doc/examples/website_styles/1024px/src/index.page +0 -9
  34. data/doc/examples/website_styles/1024px/src/screenshots.page +0 -18
  35. data/doc/examples/website_styles/andreas00/README +0 -9
  36. data/doc/examples/website_styles/andreas00/config.yaml +0 -2
  37. data/doc/examples/website_styles/andreas00/src/about.page +0 -12
  38. data/doc/examples/website_styles/andreas00/src/default.css +0 -290
  39. data/doc/examples/website_styles/andreas00/src/default.template +0 -62
  40. data/doc/examples/website_styles/andreas00/src/download.page +0 -15
  41. data/doc/examples/website_styles/andreas00/src/features.page +0 -8
  42. data/doc/examples/website_styles/andreas00/src/images/bg.gif +0 -0
  43. data/doc/examples/website_styles/andreas00/src/images/front.jpg +0 -0
  44. data/doc/examples/website_styles/andreas00/src/images/menubg.gif +0 -0
  45. data/doc/examples/website_styles/andreas00/src/images/menubg2.gif +0 -0
  46. data/doc/examples/website_styles/andreas00/src/index.page +0 -9
  47. data/doc/examples/website_styles/andreas00/src/screenshots.page +0 -18
  48. data/doc/examples/website_styles/andreas01/README +0 -9
  49. data/doc/examples/website_styles/andreas01/config.yaml +0 -2
  50. data/doc/examples/website_styles/andreas01/src/about.page +0 -12
  51. data/doc/examples/website_styles/andreas01/src/default.css +0 -310
  52. data/doc/examples/website_styles/andreas01/src/default.template +0 -63
  53. data/doc/examples/website_styles/andreas01/src/download.page +0 -15
  54. data/doc/examples/website_styles/andreas01/src/features.page +0 -8
  55. data/doc/examples/website_styles/andreas01/src/images/bg.gif +0 -0
  56. data/doc/examples/website_styles/andreas01/src/images/front.jpg +0 -0
  57. data/doc/examples/website_styles/andreas01/src/index.page +0 -9
  58. data/doc/examples/website_styles/andreas01/src/print.css +0 -35
  59. data/doc/examples/website_styles/andreas01/src/screenshots.page +0 -18
  60. data/doc/examples/website_styles/andreas03/README +0 -9
  61. data/doc/examples/website_styles/andreas03/config.yaml +0 -2
  62. data/doc/examples/website_styles/andreas03/src/about.page +0 -12
  63. data/doc/examples/website_styles/andreas03/src/default.css +0 -223
  64. data/doc/examples/website_styles/andreas03/src/default.template +0 -60
  65. data/doc/examples/website_styles/andreas03/src/download.page +0 -15
  66. data/doc/examples/website_styles/andreas03/src/features.page +0 -8
  67. data/doc/examples/website_styles/andreas03/src/images/bodybg.png +0 -0
  68. data/doc/examples/website_styles/andreas03/src/images/contbg.png +0 -0
  69. data/doc/examples/website_styles/andreas03/src/images/footerbg.png +0 -0
  70. data/doc/examples/website_styles/andreas03/src/images/gradient1.png +0 -0
  71. data/doc/examples/website_styles/andreas03/src/images/gradient2.png +0 -0
  72. data/doc/examples/website_styles/andreas03/src/index.page +0 -9
  73. data/doc/examples/website_styles/andreas03/src/screenshots.page +0 -18
  74. data/doc/examples/website_styles/andreas04/README +0 -9
  75. data/doc/examples/website_styles/andreas04/config.yaml +0 -2
  76. data/doc/examples/website_styles/andreas04/src/about.page +0 -12
  77. data/doc/examples/website_styles/andreas04/src/default.css +0 -290
  78. data/doc/examples/website_styles/andreas04/src/default.template +0 -83
  79. data/doc/examples/website_styles/andreas04/src/download.page +0 -15
  80. data/doc/examples/website_styles/andreas04/src/features.page +0 -8
  81. data/doc/examples/website_styles/andreas04/src/images/blinkarrow.gif +0 -0
  82. data/doc/examples/website_styles/andreas04/src/images/bodybg.png +0 -0
  83. data/doc/examples/website_styles/andreas04/src/images/contentbg.png +0 -0
  84. data/doc/examples/website_styles/andreas04/src/images/entrybg.png +0 -0
  85. data/doc/examples/website_styles/andreas04/src/images/flash.gif +0 -0
  86. data/doc/examples/website_styles/andreas04/src/images/flash2.gif +0 -0
  87. data/doc/examples/website_styles/andreas04/src/images/globe.gif +0 -0
  88. data/doc/examples/website_styles/andreas04/src/images/globebottom.gif +0 -0
  89. data/doc/examples/website_styles/andreas04/src/images/linkarrow.gif +0 -0
  90. data/doc/examples/website_styles/andreas04/src/images/menuhover.png +0 -0
  91. data/doc/examples/website_styles/andreas04/src/index.page +0 -9
  92. data/doc/examples/website_styles/andreas04/src/screenshots.page +0 -18
  93. data/doc/examples/website_styles/andreas05/README +0 -9
  94. data/doc/examples/website_styles/andreas05/config.yaml +0 -2
  95. data/doc/examples/website_styles/andreas05/src/about.page +0 -12
  96. data/doc/examples/website_styles/andreas05/src/default.css +0 -33
  97. data/doc/examples/website_styles/andreas05/src/default.template +0 -42
  98. data/doc/examples/website_styles/andreas05/src/download.page +0 -15
  99. data/doc/examples/website_styles/andreas05/src/features.page +0 -8
  100. data/doc/examples/website_styles/andreas05/src/images/bodybg.gif +0 -0
  101. data/doc/examples/website_styles/andreas05/src/images/front.png +0 -0
  102. data/doc/examples/website_styles/andreas05/src/index.page +0 -9
  103. data/doc/examples/website_styles/andreas05/src/screenshots.page +0 -18
  104. data/doc/examples/website_styles/andreas06/README +0 -9
  105. data/doc/examples/website_styles/andreas06/config.yaml +0 -2
  106. data/doc/examples/website_styles/andreas06/src/about.page +0 -12
  107. data/doc/examples/website_styles/andreas06/src/default.css +0 -353
  108. data/doc/examples/website_styles/andreas06/src/default.template +0 -72
  109. data/doc/examples/website_styles/andreas06/src/download.page +0 -15
  110. data/doc/examples/website_styles/andreas06/src/features.page +0 -8
  111. data/doc/examples/website_styles/andreas06/src/images/bodybg.gif +0 -0
  112. data/doc/examples/website_styles/andreas06/src/images/boxbg.gif +0 -0
  113. data/doc/examples/website_styles/andreas06/src/images/greypx.gif +0 -0
  114. data/doc/examples/website_styles/andreas06/src/images/header.jpg +0 -0
  115. data/doc/examples/website_styles/andreas06/src/images/innerbg.gif +0 -0
  116. data/doc/examples/website_styles/andreas06/src/images/leaves.jpg +0 -0
  117. data/doc/examples/website_styles/andreas06/src/images/tabs.gif +0 -0
  118. data/doc/examples/website_styles/andreas06/src/index.page +0 -9
  119. data/doc/examples/website_styles/andreas06/src/screenshots.page +0 -18
  120. data/doc/examples/website_styles/andreas07/README +0 -9
  121. data/doc/examples/website_styles/andreas07/config.yaml +0 -2
  122. data/doc/examples/website_styles/andreas07/src/about.page +0 -12
  123. data/doc/examples/website_styles/andreas07/src/browserfix.css +0 -7
  124. data/doc/examples/website_styles/andreas07/src/default.css +0 -92
  125. data/doc/examples/website_styles/andreas07/src/default.template +0 -44
  126. data/doc/examples/website_styles/andreas07/src/download.page +0 -15
  127. data/doc/examples/website_styles/andreas07/src/features.page +0 -8
  128. data/doc/examples/website_styles/andreas07/src/images/bodybg.gif +0 -0
  129. data/doc/examples/website_styles/andreas07/src/images/sidebarbg.gif +0 -0
  130. data/doc/examples/website_styles/andreas07/src/index.page +0 -9
  131. data/doc/examples/website_styles/andreas07/src/screenshots.page +0 -18
  132. data/doc/examples/website_styles/andreas08/README +0 -9
  133. data/doc/examples/website_styles/andreas08/config.yaml +0 -2
  134. data/doc/examples/website_styles/andreas08/src/about.page +0 -12
  135. data/doc/examples/website_styles/andreas08/src/default.css +0 -224
  136. data/doc/examples/website_styles/andreas08/src/default.template +0 -53
  137. data/doc/examples/website_styles/andreas08/src/download.page +0 -15
  138. data/doc/examples/website_styles/andreas08/src/features.page +0 -8
  139. data/doc/examples/website_styles/andreas08/src/index.page +0 -9
  140. data/doc/examples/website_styles/andreas08/src/screenshots.page +0 -18
  141. data/doc/examples/website_styles/andreas09/README +0 -9
  142. data/doc/examples/website_styles/andreas09/config.yaml +0 -2
  143. data/doc/examples/website_styles/andreas09/src/about.page +0 -12
  144. data/doc/examples/website_styles/andreas09/src/default.css +0 -308
  145. data/doc/examples/website_styles/andreas09/src/default.template +0 -70
  146. data/doc/examples/website_styles/andreas09/src/download.page +0 -15
  147. data/doc/examples/website_styles/andreas09/src/features.page +0 -8
  148. data/doc/examples/website_styles/andreas09/src/images/bodybg-black.jpg +0 -0
  149. data/doc/examples/website_styles/andreas09/src/images/bodybg-green.jpg +0 -0
  150. data/doc/examples/website_styles/andreas09/src/images/bodybg-orange.jpg +0 -0
  151. data/doc/examples/website_styles/andreas09/src/images/bodybg-purple.jpg +0 -0
  152. data/doc/examples/website_styles/andreas09/src/images/bodybg-red.jpg +0 -0
  153. data/doc/examples/website_styles/andreas09/src/images/bodybg.jpg +0 -0
  154. data/doc/examples/website_styles/andreas09/src/images/footerbg.jpg +0 -0
  155. data/doc/examples/website_styles/andreas09/src/images/menuhover-black.jpg +0 -0
  156. data/doc/examples/website_styles/andreas09/src/images/menuhover-green.jpg +0 -0
  157. data/doc/examples/website_styles/andreas09/src/images/menuhover-orange.jpg +0 -0
  158. data/doc/examples/website_styles/andreas09/src/images/menuhover-purple.jpg +0 -0
  159. data/doc/examples/website_styles/andreas09/src/images/menuhover-red.jpg +0 -0
  160. data/doc/examples/website_styles/andreas09/src/images/menuhover.jpg +0 -0
  161. data/doc/examples/website_styles/andreas09/src/index.page +0 -9
  162. data/doc/examples/website_styles/andreas09/src/screenshots.page +0 -18
  163. data/doc/examples/website_styles/default/README +0 -9
  164. data/doc/examples/website_styles/default/config.yaml +0 -2
  165. data/doc/examples/website_styles/default/src/about.page +0 -12
  166. data/doc/examples/website_styles/default/src/default.css +0 -84
  167. data/doc/examples/website_styles/default/src/default.template +0 -38
  168. data/doc/examples/website_styles/default/src/download.page +0 -15
  169. data/doc/examples/website_styles/default/src/features.page +0 -8
  170. data/doc/examples/website_styles/default/src/index.page +0 -9
  171. data/doc/examples/website_styles/default/src/screenshots.page +0 -18
  172. data/doc/examples/website_styles/plain/README +0 -9
  173. data/doc/examples/website_styles/plain/config.yaml +0 -2
  174. data/doc/examples/website_styles/plain/src/about.page +0 -12
  175. data/doc/examples/website_styles/plain/src/default.css +0 -244
  176. data/doc/examples/website_styles/plain/src/default.template +0 -63
  177. data/doc/examples/website_styles/plain/src/download.page +0 -15
  178. data/doc/examples/website_styles/plain/src/features.page +0 -8
  179. data/doc/examples/website_styles/plain/src/images/a_hover.jpg +0 -0
  180. data/doc/examples/website_styles/plain/src/images/desc.jpg +0 -0
  181. data/doc/examples/website_styles/plain/src/images/li.gif +0 -0
  182. data/doc/examples/website_styles/plain/src/images/mainbar.jpg +0 -0
  183. data/doc/examples/website_styles/plain/src/images/menu.jpg +0 -0
  184. data/doc/examples/website_styles/plain/src/images/submenua.gif +0 -0
  185. data/doc/examples/website_styles/plain/src/images/submenua_hover.jpg +0 -0
  186. data/doc/examples/website_styles/plain/src/index.page +0 -9
  187. data/doc/examples/website_styles/plain/src/screenshots.page +0 -18
  188. data/doc/examples/website_templates/default/README +0 -8
  189. data/doc/examples/website_templates/default/config.yaml +0 -2
  190. data/doc/examples/website_templates/default/src/default.css +0 -84
  191. data/doc/examples/website_templates/default/src/default.template +0 -38
  192. data/doc/examples/website_templates/default/src/index.page +0 -8
  193. data/doc/examples/website_templates/personal_hp/README +0 -8
  194. data/doc/examples/website_templates/personal_hp/config.yaml +0 -2
  195. data/doc/examples/website_templates/personal_hp/src/about.page +0 -12
  196. data/doc/examples/website_templates/personal_hp/src/default.css +0 -84
  197. data/doc/examples/website_templates/personal_hp/src/default.template +0 -38
  198. data/doc/examples/website_templates/personal_hp/src/index.page +0 -9
  199. data/doc/examples/website_templates/personal_hp/src/links.page +0 -22
  200. data/doc/examples/website_templates/personal_hp/src/projects.page +0 -20
  201. data/doc/examples/website_templates/project/README +0 -9
  202. data/doc/examples/website_templates/project/config.yaml +0 -2
  203. data/doc/examples/website_templates/project/src/about.page +0 -12
  204. data/doc/examples/website_templates/project/src/default.css +0 -84
  205. data/doc/examples/website_templates/project/src/default.template +0 -38
  206. data/doc/examples/website_templates/project/src/download.page +0 -15
  207. data/doc/examples/website_templates/project/src/features.page +0 -8
  208. data/doc/examples/website_templates/project/src/index.page +0 -9
  209. data/doc/examples/website_templates/project/src/screenshots.page +0 -18
  210. data/doc/plugin/gallery/slides/collage.rb +0 -334
  211. data/doc/src/examples/gallery_styles/default/default.gallery +0 -78
  212. data/doc/src/examples/gallery_styles/default/gallery_gallery.template +0 -38
  213. data/doc/src/examples/gallery_styles/default/gallery_image.template +0 -30
  214. data/doc/src/examples/gallery_styles/default/gallery_main.template +0 -18
  215. data/doc/src/examples/gallery_styles/index.page +0 -22
  216. data/doc/src/examples/gallery_styles/slides/gallery_gallery.template +0 -62
  217. data/doc/src/examples/gallery_styles/slides/gallery_image.template +0 -53
  218. data/doc/src/examples/gallery_styles/slides/gallery_main.template +0 -32
  219. data/doc/src/examples/gallery_styles/slides/slides.gallery +0 -79
  220. data/doc/src/examples/website_styles/1024px.page +0 -5
  221. data/doc/src/examples/website_styles/andreas00.page +0 -5
  222. data/doc/src/examples/website_styles/andreas01.page +0 -5
  223. data/doc/src/examples/website_styles/andreas03.page +0 -5
  224. data/doc/src/examples/website_styles/andreas04.page +0 -5
  225. data/doc/src/examples/website_styles/andreas05.page +0 -5
  226. data/doc/src/examples/website_styles/andreas06.page +0 -5
  227. data/doc/src/examples/website_styles/andreas07.page +0 -5
  228. data/doc/src/examples/website_styles/andreas08.page +0 -5
  229. data/doc/src/examples/website_styles/andreas09.page +0 -5
  230. data/doc/src/examples/website_styles/default.page +0 -5
  231. data/doc/src/examples/website_styles/index.page +0 -71
  232. data/doc/src/examples/website_styles/plain.page +0 -5
  233. data/doc/src/examples/website_templates/default.page +0 -5
  234. data/doc/src/examples/website_templates/index.page +0 -24
  235. data/doc/src/examples/website_templates/personal_hp.page +0 -5
  236. data/doc/src/examples/website_templates/project.page +0 -5
@@ -1,20 +0,0 @@
1
- ---
2
- title: Projects
3
- inMenu: true
4
- orderInfo: 20
5
- ---
6
- h2. My Projects
7
-
8
- Here comes a list of your software projects if you have any! Another way to do this would be to
9
- create a subdirectory for your projects and use one page file for each project!
10
-
11
- h3. DoItYourself V4.5
12
-
13
- Description of project
14
- Current version
15
- Where to download?
16
- Dependencies
17
-
18
- h3. My other Project V 3.0
19
-
20
- The same information as before
@@ -1,9 +0,0 @@
1
- description:
2
- This template provides the basic files for a website for a software project.
3
- You just need to fill in the correct data in the provided files and there
4
- you go!
5
-
6
- author:
7
- Thomas Leitner
8
- ---
9
- note: This file can be deleted!
@@ -1,2 +0,0 @@
1
- Core/Configuration:
2
- outDir: ../../../output/examples/website_templates/project
@@ -1,12 +0,0 @@
1
- ---
2
- title: About
3
- inMenu: true
4
- orderInfo: 10
5
- ---
6
- h2. About Project XXX
7
-
8
- Description of project!
9
-
10
- h2. About the Author
11
-
12
- bla bla bla
@@ -1,84 +0,0 @@
1
-
2
- #all { background-color: #CCCCCC; }
3
-
4
- #header {
5
- border-bottom: 1px solid black;
6
- padding: 1ex;
7
- background-color: #888888;
8
- }
9
- #header h1 {
10
- margin: 0ex;
11
- font-size: 300%;
12
- font-style: italic;
13
- font-weight: normal;
14
- }
15
-
16
- , #headerbar { border-bottom: 1px solid black; }
17
- #footer { border-top: 1px solid black; }
18
-
19
- #body {
20
- margin-left: 250px;
21
- margin-right: 20px;
22
- padding: 10px;
23
- }
24
-
25
- #menu {
26
- float: left;
27
- width: 230px;
28
- padding: 20px 0px 0px 2px;
29
- }
30
-
31
- .bar {
32
- clear: both;
33
- padding: 3px;
34
- text-align: center;
35
- font-size: 90%;
36
- background-color: #AAAAAA;
37
- }
38
-
39
- .left, .right {
40
- padding: 0px 1em;
41
- }
42
-
43
- .left {
44
- float: left;
45
- text-align: left;
46
- }
47
-
48
- .right {
49
- float: right;
50
- text-align: right;
51
- }
52
-
53
- /* styling the menu */
54
-
55
- #menu a {
56
- text-decoration: none;
57
- font-weight: bold;
58
- font-size: 130%;
59
- }
60
-
61
- #menu a:hover {
62
- text-decoration: underline;
63
- }
64
-
65
- #menu .webgen-menu-item-selected {
66
- border-left: 3px solid black;
67
- }
68
-
69
- #menu ul {
70
- list-style-type: none;
71
- padding: 0px;
72
- margin-left: 10px;
73
- }
74
-
75
- #menu li > ul {
76
- font-size: 95%;
77
- }
78
-
79
- #menu li {
80
- margin: 0.0em 0px;
81
- padding: 2px 0px;
82
- padding-left: 5px;
83
- border-left: 3px solid #CCCCCC;
84
- }
@@ -1,38 +0,0 @@
1
- --- content, html
2
- <?xml version="1.0" encoding="UTF-8"?>
3
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{lang:}">
5
- <head>
6
- <title>{title: }</title>
7
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
- <meta name="description" content="Your description goes here..." />
9
- <meta name="keywords" content="your,keywords,goes,here" />
10
- <meta name="author" content="Your Name" />
11
- <meta name="generator" content="webgen - http://webgen.rubyforge.com/" />
12
- <link href="{relocatable: default.css}" rel="stylesheet" type="text/css" />
13
- <link href="{resource: webgen-css}" rel="stylesheet" type="text/css" />
14
- </head>
15
- <body>
16
- <div id="header">
17
- <h1>{title: }</h1>
18
- </div>
19
-
20
- <div id="headerbar" class="bar">
21
- <span class="left">Location: {breadcrumbTrail: }</span>
22
- <span class="right">Language: {langbar: }</span>
23
- <div style="clear:both"></div>
24
- </div>
25
-
26
- <div id="menu">
27
- {menu: vertical}
28
- </div>
29
-
30
- <div id="body">
31
- {block: }
32
- </div>
33
-
34
- <div id="footer" class="bar">
35
- <a href="http://webgen.rubyforge.org"><img src="{resource: webgen-generated}" alt="Generated by webgen"/></a> on <b>{date: }</b>
36
- </div>
37
- </body>
38
- </html>
@@ -1,15 +0,0 @@
1
- ---
2
- title: Download
3
- inMenu: true
4
- orderInfo: 30
5
- ---
6
- h2. Download
7
-
8
- Download link will be here!
9
-
10
- List of dependencies:
11
-
12
- * Dep One v. 3.3.3
13
- * Dep Two v. 2.5.1 (optional)
14
-
15
-
@@ -1,8 +0,0 @@
1
- ---
2
- title: Features
3
- inMenu: true
4
- orderInfo: 20
5
- ---
6
- h2. Features
7
-
8
- Here is the place where the feature list for your project should go.
@@ -1,9 +0,0 @@
1
- ---
2
- title: Homepage
3
- inMenu: true
4
- orderInfo: 0
5
- directoryName: Project XXX
6
- ---
7
- h2. Project XXX
8
-
9
- This is the first page your viewers will see!
@@ -1,18 +0,0 @@
1
- ---
2
- title: Screenshots
3
- inMenu: true
4
- orderInfo: 40
5
- ---
6
- h2. Screenshots
7
-
8
- h3. Main View
9
-
10
- Image of Main View
11
-
12
- Description of image
13
-
14
- h3. Next image
15
-
16
- Image
17
-
18
- bla bla bla
@@ -1,334 +0,0 @@
1
- load_plugin 'webgen/plugins/filehandlers/filehandler'
2
-
3
- require 'rubygems'
4
- require 'RMagick'
5
-
6
- module Collage
7
-
8
- class Layouter < Webgen::Plugin
9
-
10
- infos( :name => 'GalleryLayouter/slides',
11
- :author => Webgen::AUTHOR,
12
- :summary => 'Handles additional tasks for the gallery layout \'slides\''
13
- )
14
-
15
- depends_on 'Core/ResourceManager'
16
-
17
- def initialize( plugin_manager )
18
- super
19
- @plugin_manager['Core/ResourceManager'].append_data( 'webgen-css', '
20
- .thumb {
21
- display:block;
22
- }
23
- ')
24
- end
25
-
26
- def handle_gallery( ginfo, parent )
27
- # Create collage node
28
- collage_writer = @plugin_manager['File/CollageWriter']
29
- file_handler = @plugin_manager['Core/FileHandler']
30
- node = file_handler.create_node( collage_name( ginfo ), parent, collage_writer ) do |fn, parent, h, mi|
31
- h.create_node( fn, parent, mi, {:parent => parent, :ginfo => ginfo} )
32
- end
33
- ginfo[:collage_node] = node
34
-
35
- # Create collage thumbnail node
36
- collage_thumb_writer = @plugin_manager['File/CollageThumbWriter']
37
- node = file_handler.create_node( collage_thumb_name( ginfo ), parent, collage_thumb_writer ) do |fn, parent, h, mi|
38
- h.create_node( fn, parent, mi, {:parent => parent, :ginfo => ginfo} )
39
- end
40
- ginfo[:collage_thumb_node] = node
41
-
42
- # Create background slide
43
- slide_writer = @plugin_manager['File/SlideWriter']
44
- node = file_handler.create_node( slide_name( ginfo ), parent, slide_writer ) do |fn, parent, h, mi|
45
- h.create_node( fn, parent, mi, {:parent => parent, :ginfo => ginfo} )
46
- end
47
- ginfo[:slide_node] = node
48
-
49
- slide_url = ginfo[:slide_node].to_url
50
- css_url = slide_url + ( '/' + @plugin_manager['Core/ResourceManager'].get_resource( 'webgen-css' ).output_path )
51
-
52
- @plugin_manager['Core/ResourceManager'].append_data( 'webgen-css', "
53
- .thumb-#{collage_title(ginfo)} {
54
- background: url(\"#{slide_url.route_from(css_url)}\") 0 0 no-repeat;
55
- width: #{ginfo[:slide_node].slide_size[0]}px;
56
- height: #{ginfo[:slide_node].slide_size[0]}px;
57
- }
58
- .thumb-#{collage_title(ginfo)} img {
59
- padding: #{ginfo[:slide_node].slide_border_width}px;
60
- }
61
- .thumb-#{collage_title(ginfo)} img:hover {
62
- border: 1px solid black;
63
- }
64
-
65
- }")
66
- end
67
-
68
- #######
69
- private
70
- #######
71
-
72
- def collage_title( ginfo )
73
- ginfo['title'].tr( ' ', '_' )
74
- end
75
-
76
- def collage_name( ginfo )
77
- collage_title( ginfo ) + '_collage.jpg'
78
- end
79
-
80
- def collage_thumb_name( ginfo )
81
- collage_title( ginfo ) + '_collage_tn.jpg'
82
- end
83
-
84
- def slide_name( ginfo )
85
- collage_title( ginfo ) + '_slide.png'
86
- end
87
-
88
- end
89
-
90
-
91
- class SlideWriter < FileHandlers::DefaultHandler
92
-
93
- include Magick
94
-
95
- infos( :name => 'File/SlideWriter',
96
- :author => Webgen::AUTHOR,
97
- :summary => 'Generates a slide background for image thumbnails' )
98
-
99
- param 'borderWidth', 10, 'The width of the slide border'
100
- param 'color', '#ffffff', 'The color of the slide'
101
-
102
- def create_node( path, parent, meta_info, data )
103
- node = Node.new( parent, File.basename( path ) )
104
- node.meta_info.update( meta_info )
105
- node.node_info[:data] = data
106
- node.node_info[:processor] = self
107
-
108
- node
109
- end
110
-
111
- def slide_size( node )
112
- (node.node_info[:data][:ginfo]['thumbnailSize'] || param( 'thumbnailSize', 'File/ThumbnailWriter' )).split('x').collect{ |s| s.to_i + slide_border_width( node )*2 }
113
- end
114
-
115
- def slide_color( node )
116
- node.node_info[:data][:ginfo]['slideColor'] || param( 'color' )
117
- end
118
-
119
- def slide_border_width( node )
120
- node.node_info[:data][:ginfo]['slideBorderWidth'] || param( 'borderWidth' )
121
- end
122
-
123
- def create_slide( node )
124
- return if node.node_info[:slide]
125
-
126
- ginfo = node.node_info[:data][:ginfo]
127
-
128
- width, height = node.slide_size
129
- border_width = node.slide_border_width
130
-
131
- slide = Image.new( width, height ) { self.background_color = 'transparent' }
132
-
133
- gc = Magick::Draw.new
134
- gc.fill_opacity(0)
135
- gc.stroke( node.slide_color )
136
- gc.stroke_width( border_width )
137
- gc.roundrectangle( border_width/2, border_width/2, width-border_width/2, height-border_width/2, 5, 5)
138
- gc.draw(slide)
139
-
140
- node.node_info[:slide] = slide
141
- end
142
-
143
- def write_node( node )
144
- return if File.exists?( node.full_path ) #TODO always create? what settings to check?
145
- create_slide( node )
146
- node.node_info[:slide].write( node.full_path )
147
- end
148
-
149
- end
150
-
151
-
152
- # Most of the code in create_slide, backandforth and creat_collage is from Corban Brook from
153
- # his tutorial
154
- # http://schf.uc.org/articles/2006/10/18/render-greatlooking-collages-with-ruby-and-rmagick
155
- # and has slightly been adapted for use in this gallery style.
156
- class CollageWriter < FileHandlers::DefaultHandler
157
-
158
- include Magick
159
-
160
- infos( :name => 'File/CollageWriter',
161
- :author => Webgen::AUTHOR,
162
- :summary => 'Generates a pretty collage for the main gallery page' )
163
-
164
- param 'size', '700x300', 'The size of the generated collage'
165
- param 'color', '#CCCCCC', 'The background color of the collage'
166
-
167
- def create_node( path, parent, meta_info, data )
168
- node = Node.new( parent, File.basename( path ) )
169
- node.meta_info.update( meta_info )
170
- node.node_info[:data] = data
171
- node.node_info[:processor] = self
172
- node
173
- end
174
-
175
- def collage_size( node )
176
- (node.node_info[:data][:ginfo]['collageSize'] || param( 'size' )).split('x').collect{ |s| s.to_i}
177
- end
178
-
179
- def collage_color( node )
180
- node.node_info[:data][:ginfo]['collageColor'] || param( 'color' )
181
- end
182
-
183
- def create_collage( node )
184
- return if node.node_info[:collage]
185
- parent = node.node_info[:data][:parent]
186
- ginfo = node.node_info[:data][:ginfo]
187
-
188
- ginfo[:slide_node].create_slide
189
-
190
- width, height = node.collage_size
191
- slide_border_width = ginfo[:slide_node].slide_border_width
192
- slide_width, slide_height = ginfo[:slide_node].slide_size
193
-
194
- # create background
195
- create_collage_background( node )
196
- collage = node.node_info[:collage_background]
197
-
198
- # fetch four random images
199
- images = []
200
- (1..4).each do
201
- gal_number = rand(ginfo.galleries.length)
202
- pic_number = rand(ginfo.galleries[gal_number].images.length)
203
- redo if images.include?( [gal_number, pic_number] )
204
- images << [gal_number, pic_number]
205
- end
206
-
207
- # create main image
208
- base_image = images.shift
209
- base_image = ginfo.galleries[base_image[0]].images[base_image[1]]
210
- base_image_file = File.join( parent.node_info[:src], base_image.filename )
211
- photo = Image.read( base_image_file ).first
212
- photo.crop_resized!( width - slide_border_width*2, height*2/3 - slide_border_width )
213
- collage.composite!( photo, slide_border_width, slide_border_width, OverCompositeOp )
214
-
215
- # Arrange the other three images
216
- (images.size-1).downto(0) do |i|
217
- image = ginfo.galleries[i[0]].images[i[1]]
218
- image_file = File.join( parent.node_info[:src], image.filename )
219
- slide = create_slide( ginfo, image_file, slide_width, slide_height, slide_border_width )
220
- collage.composite!( slide, width/2 - slide_width*3/2 + i * slide_width*2/3 + rand(15),
221
- height*2/3 - slide_height*2/3 + rand(15), OverCompositeOp)
222
- end
223
-
224
- node.node_info[:collage] = collage
225
- end
226
-
227
- def write_node( node )
228
- return if File.exists?( node.full_path ) #TODO always create? what settings to check?
229
- create_collage( node )
230
- node.node_info[:collage].write( node.full_path )
231
- end
232
-
233
- #######
234
- private
235
- #######
236
-
237
- def create_collage_background( node )
238
- return if node.node_info[:collage_background]
239
-
240
- ginfo = node.node_info[:data][:ginfo]
241
- width, height = node.collage_size
242
- color = node.collage_color
243
- slide_color = ginfo[:slide_node].slide_color
244
- slide_border_width = ginfo[:slide_node].slide_border_width
245
-
246
- temp = Image.new( width, height ) { self.background_color = color }
247
- pic = Image.new( width, height) { self.background_color = 'transparent' }
248
-
249
- gc = Draw.new
250
- gc.fill( color )
251
- gc.stroke( slide_color )
252
- gc.stroke_width( slide_border_width )
253
- gc.rectangle( slide_border_width/2, slide_border_width/2, width-slide_border_width/2-3, height*2/3 )
254
- gc.draw(pic)
255
-
256
- shadow = pic.shadow( 0, 0, 0.1, '20%' )
257
- temp.composite!( shadow, 3, 3, OverCompositeOp )
258
- temp.composite!( pic, 0, 0, OverCompositeOp )
259
-
260
- node.node_info[:collage_background] = temp
261
- end
262
-
263
- def backandforth(degree)
264
- polarity = rand(2) * -1
265
- (polarity < 0 ? rand(degree) * polarity : rand(degree) )
266
- end
267
-
268
- def create_slide( ginfo, filename, s_width, s_height, s_border_width )
269
- slide = ginfo[:slide_node].node_info[:slide].clone
270
- slide_background = Image.new( slide.columns, slide.rows ) { self.background_color = 'transparent' }
271
- photo = Image.read( filename ).first
272
-
273
- i_width = s_width - s_border_width*2
274
- i_height = s_height - s_border_width*2
275
-
276
- # create a grey scale gradient fill for our mask
277
- mask_fill = GradientFill.new( 0, 0, 0, i_height, '#FFFFFF', '#AAAAAA' )
278
- mask = Image.new( i_width, i_height, mask_fill )
279
- # create thumbnail sized square image of photo
280
- photo.crop_resized!( i_width, i_height )
281
-
282
- # apply alpha mask to slide
283
- photo.matte = true
284
- mask.matte = false
285
- photo.composite!( mask, 0, 0, CopyOpacityCompositeOp )
286
-
287
- # composite photo and slide on transparent background
288
- slide_background.composite!( photo, s_border_width, s_border_width, OverCompositeOp)
289
- slide_background.composite!( slide, 0, 0, OverCompositeOp)
290
-
291
- # rotate slide a little bit
292
- slide_background.rotate!( backandforth(40) )
293
-
294
- # create workspace to apply shadow
295
- workspace = Image.new( slide_background.columns+5, slide_background.rows+5 ) { self.background_color = 'transparent' }
296
- shadow = slide_background.shadow( 0, 0, 0.1, '20%' )
297
- workspace.composite!( shadow, 3, 3, OverCompositeOp )
298
- workspace.composite!( slide_background, NorthWestGravity, OverCompositeOp )
299
-
300
- return workspace
301
- end
302
-
303
- end
304
-
305
-
306
- class CollageThumbWriter < FileHandlers::DefaultHandler
307
-
308
- include Magick
309
-
310
- infos( :name => 'File/CollageThumbWriter',
311
- :author => Webgen::AUTHOR,
312
- :summary => 'Generates a thumbnail of a collage image' )
313
-
314
- def create_node( path, parent, meta_info, data )
315
- node = Node.new( parent, File.basename( path ) )
316
- node.meta_info.update( meta_info )
317
- node.node_info[:data] = data
318
- node.node_info[:processor] = self
319
- node
320
- end
321
-
322
- def write_node( node )
323
- return if File.exists?( node.full_path ) #TODO always create? what settings to check?
324
- ginfo = node.node_info[:data][:ginfo]
325
- ginfo[:collage_node].create_collage
326
- collage = ginfo[:collage_node].node_info[:collage]
327
- collage.change_geometry( ginfo[:slide_node].slide_size.collect {|s| s*2}.join('x') ) {|c,r,i| i.resize!( c, r )}
328
- collage.write( node.full_path )
329
- end
330
-
331
- end
332
-
333
-
334
- end