webgen 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +76 -0
- data/Rakefile +23 -18
- data/TODO +5 -0
- data/VERSION +1 -1
- data/doc/metainfo.yaml +4 -1
- data/doc/src/default.template +5 -1
- data/doc/src/documentation/basics.page +148 -0
- data/doc/src/documentation/extending_webgen.page +4 -1
- data/doc/src/documentation/index.page +6 -3
- data/doc/src/documentation/plugins/core/filehandler.page +1 -1
- data/doc/src/documentation/plugins/file/directoryhandler.page +1 -1
- data/doc/src/documentation/references/index.page +20 -1
- data/doc/src/documentation/references/meta_info_reference.page +2 -1
- data/doc/src/documentation/{gettingstarted.page → tutorial.page} +6 -103
- data/doc/src/news.page +11 -0
- data/lib/webgen/config.rb +4 -4
- data/lib/webgen/node.rb +4 -2
- data/lib/webgen/plugins/filehandlers/template.rb +3 -1
- data/lib/webgen/plugins/miscplugins/rendered_files.rb +75 -0
- data/lib/webgen/rake/webgentask.rb +161 -0
- data/test/fixtures/sample_site/src/index.de.page +1 -0
- data/test/unittests/tc_filehandler_template.rb +3 -0
- data/test/unittests/tc_node.rb +3 -0
- metadata +6 -266
- data/doc/examples/website_styles/1024px/README +0 -9
- data/doc/examples/website_styles/1024px/config.yaml +0 -2
- data/doc/examples/website_styles/1024px/src/about.page +0 -12
- data/doc/examples/website_styles/1024px/src/default.css +0 -188
- data/doc/examples/website_styles/1024px/src/default.template +0 -62
- data/doc/examples/website_styles/1024px/src/download.page +0 -15
- data/doc/examples/website_styles/1024px/src/features.page +0 -8
- data/doc/examples/website_styles/1024px/src/images/background.gif +0 -0
- data/doc/examples/website_styles/1024px/src/index.page +0 -9
- data/doc/examples/website_styles/1024px/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas00/README +0 -9
- data/doc/examples/website_styles/andreas00/config.yaml +0 -2
- data/doc/examples/website_styles/andreas00/src/about.page +0 -12
- data/doc/examples/website_styles/andreas00/src/default.css +0 -290
- data/doc/examples/website_styles/andreas00/src/default.template +0 -62
- data/doc/examples/website_styles/andreas00/src/download.page +0 -15
- data/doc/examples/website_styles/andreas00/src/features.page +0 -8
- data/doc/examples/website_styles/andreas00/src/images/bg.gif +0 -0
- data/doc/examples/website_styles/andreas00/src/images/front.jpg +0 -0
- data/doc/examples/website_styles/andreas00/src/images/menubg.gif +0 -0
- data/doc/examples/website_styles/andreas00/src/images/menubg2.gif +0 -0
- data/doc/examples/website_styles/andreas00/src/index.page +0 -9
- data/doc/examples/website_styles/andreas00/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas01/README +0 -9
- data/doc/examples/website_styles/andreas01/config.yaml +0 -2
- data/doc/examples/website_styles/andreas01/src/about.page +0 -12
- data/doc/examples/website_styles/andreas01/src/default.css +0 -310
- data/doc/examples/website_styles/andreas01/src/default.template +0 -63
- data/doc/examples/website_styles/andreas01/src/download.page +0 -15
- data/doc/examples/website_styles/andreas01/src/features.page +0 -8
- data/doc/examples/website_styles/andreas01/src/images/bg.gif +0 -0
- data/doc/examples/website_styles/andreas01/src/images/front.jpg +0 -0
- data/doc/examples/website_styles/andreas01/src/index.page +0 -9
- data/doc/examples/website_styles/andreas01/src/print.css +0 -35
- data/doc/examples/website_styles/andreas01/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas03/README +0 -9
- data/doc/examples/website_styles/andreas03/config.yaml +0 -2
- data/doc/examples/website_styles/andreas03/src/about.page +0 -12
- data/doc/examples/website_styles/andreas03/src/default.css +0 -223
- data/doc/examples/website_styles/andreas03/src/default.template +0 -60
- data/doc/examples/website_styles/andreas03/src/download.page +0 -15
- data/doc/examples/website_styles/andreas03/src/features.page +0 -8
- data/doc/examples/website_styles/andreas03/src/images/bodybg.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/contbg.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/footerbg.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/gradient1.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/gradient2.png +0 -0
- data/doc/examples/website_styles/andreas03/src/index.page +0 -9
- data/doc/examples/website_styles/andreas03/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas04/README +0 -9
- data/doc/examples/website_styles/andreas04/config.yaml +0 -2
- data/doc/examples/website_styles/andreas04/src/about.page +0 -12
- data/doc/examples/website_styles/andreas04/src/default.css +0 -290
- data/doc/examples/website_styles/andreas04/src/default.template +0 -83
- data/doc/examples/website_styles/andreas04/src/download.page +0 -15
- data/doc/examples/website_styles/andreas04/src/features.page +0 -8
- data/doc/examples/website_styles/andreas04/src/images/blinkarrow.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/bodybg.png +0 -0
- data/doc/examples/website_styles/andreas04/src/images/contentbg.png +0 -0
- data/doc/examples/website_styles/andreas04/src/images/entrybg.png +0 -0
- data/doc/examples/website_styles/andreas04/src/images/flash.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/flash2.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/globe.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/globebottom.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/linkarrow.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/menuhover.png +0 -0
- data/doc/examples/website_styles/andreas04/src/index.page +0 -9
- data/doc/examples/website_styles/andreas04/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas05/README +0 -9
- data/doc/examples/website_styles/andreas05/config.yaml +0 -2
- data/doc/examples/website_styles/andreas05/src/about.page +0 -12
- data/doc/examples/website_styles/andreas05/src/default.css +0 -33
- data/doc/examples/website_styles/andreas05/src/default.template +0 -42
- data/doc/examples/website_styles/andreas05/src/download.page +0 -15
- data/doc/examples/website_styles/andreas05/src/features.page +0 -8
- data/doc/examples/website_styles/andreas05/src/images/bodybg.gif +0 -0
- data/doc/examples/website_styles/andreas05/src/images/front.png +0 -0
- data/doc/examples/website_styles/andreas05/src/index.page +0 -9
- data/doc/examples/website_styles/andreas05/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas06/README +0 -9
- data/doc/examples/website_styles/andreas06/config.yaml +0 -2
- data/doc/examples/website_styles/andreas06/src/about.page +0 -12
- data/doc/examples/website_styles/andreas06/src/default.css +0 -353
- data/doc/examples/website_styles/andreas06/src/default.template +0 -72
- data/doc/examples/website_styles/andreas06/src/download.page +0 -15
- data/doc/examples/website_styles/andreas06/src/features.page +0 -8
- data/doc/examples/website_styles/andreas06/src/images/bodybg.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/boxbg.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/greypx.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/header.jpg +0 -0
- data/doc/examples/website_styles/andreas06/src/images/innerbg.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/leaves.jpg +0 -0
- data/doc/examples/website_styles/andreas06/src/images/tabs.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/index.page +0 -9
- data/doc/examples/website_styles/andreas06/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas07/README +0 -9
- data/doc/examples/website_styles/andreas07/config.yaml +0 -2
- data/doc/examples/website_styles/andreas07/src/about.page +0 -12
- data/doc/examples/website_styles/andreas07/src/browserfix.css +0 -7
- data/doc/examples/website_styles/andreas07/src/default.css +0 -92
- data/doc/examples/website_styles/andreas07/src/default.template +0 -44
- data/doc/examples/website_styles/andreas07/src/download.page +0 -15
- data/doc/examples/website_styles/andreas07/src/features.page +0 -8
- data/doc/examples/website_styles/andreas07/src/images/bodybg.gif +0 -0
- data/doc/examples/website_styles/andreas07/src/images/sidebarbg.gif +0 -0
- data/doc/examples/website_styles/andreas07/src/index.page +0 -9
- data/doc/examples/website_styles/andreas07/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas08/README +0 -9
- data/doc/examples/website_styles/andreas08/config.yaml +0 -2
- data/doc/examples/website_styles/andreas08/src/about.page +0 -12
- data/doc/examples/website_styles/andreas08/src/default.css +0 -224
- data/doc/examples/website_styles/andreas08/src/default.template +0 -53
- data/doc/examples/website_styles/andreas08/src/download.page +0 -15
- data/doc/examples/website_styles/andreas08/src/features.page +0 -8
- data/doc/examples/website_styles/andreas08/src/index.page +0 -9
- data/doc/examples/website_styles/andreas08/src/screenshots.page +0 -18
- data/doc/examples/website_styles/andreas09/README +0 -9
- data/doc/examples/website_styles/andreas09/config.yaml +0 -2
- data/doc/examples/website_styles/andreas09/src/about.page +0 -12
- data/doc/examples/website_styles/andreas09/src/default.css +0 -308
- data/doc/examples/website_styles/andreas09/src/default.template +0 -70
- data/doc/examples/website_styles/andreas09/src/download.page +0 -15
- data/doc/examples/website_styles/andreas09/src/features.page +0 -8
- data/doc/examples/website_styles/andreas09/src/images/bodybg-black.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-green.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-orange.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-purple.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-red.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/footerbg.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-black.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-green.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-orange.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-purple.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-red.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/index.page +0 -9
- data/doc/examples/website_styles/andreas09/src/screenshots.page +0 -18
- data/doc/examples/website_styles/default/README +0 -9
- data/doc/examples/website_styles/default/config.yaml +0 -2
- data/doc/examples/website_styles/default/src/about.page +0 -12
- data/doc/examples/website_styles/default/src/default.css +0 -84
- data/doc/examples/website_styles/default/src/default.template +0 -38
- data/doc/examples/website_styles/default/src/download.page +0 -15
- data/doc/examples/website_styles/default/src/features.page +0 -8
- data/doc/examples/website_styles/default/src/index.page +0 -9
- data/doc/examples/website_styles/default/src/screenshots.page +0 -18
- data/doc/examples/website_styles/plain/README +0 -9
- data/doc/examples/website_styles/plain/config.yaml +0 -2
- data/doc/examples/website_styles/plain/src/about.page +0 -12
- data/doc/examples/website_styles/plain/src/default.css +0 -244
- data/doc/examples/website_styles/plain/src/default.template +0 -63
- data/doc/examples/website_styles/plain/src/download.page +0 -15
- data/doc/examples/website_styles/plain/src/features.page +0 -8
- data/doc/examples/website_styles/plain/src/images/a_hover.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/desc.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/li.gif +0 -0
- data/doc/examples/website_styles/plain/src/images/mainbar.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/menu.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/submenua.gif +0 -0
- data/doc/examples/website_styles/plain/src/images/submenua_hover.jpg +0 -0
- data/doc/examples/website_styles/plain/src/index.page +0 -9
- data/doc/examples/website_styles/plain/src/screenshots.page +0 -18
- data/doc/examples/website_templates/default/README +0 -8
- data/doc/examples/website_templates/default/config.yaml +0 -2
- data/doc/examples/website_templates/default/src/default.css +0 -84
- data/doc/examples/website_templates/default/src/default.template +0 -38
- data/doc/examples/website_templates/default/src/index.page +0 -8
- data/doc/examples/website_templates/personal_hp/README +0 -8
- data/doc/examples/website_templates/personal_hp/config.yaml +0 -2
- data/doc/examples/website_templates/personal_hp/src/about.page +0 -12
- data/doc/examples/website_templates/personal_hp/src/default.css +0 -84
- data/doc/examples/website_templates/personal_hp/src/default.template +0 -38
- data/doc/examples/website_templates/personal_hp/src/index.page +0 -9
- data/doc/examples/website_templates/personal_hp/src/links.page +0 -22
- data/doc/examples/website_templates/personal_hp/src/projects.page +0 -20
- data/doc/examples/website_templates/project/README +0 -9
- data/doc/examples/website_templates/project/config.yaml +0 -2
- data/doc/examples/website_templates/project/src/about.page +0 -12
- data/doc/examples/website_templates/project/src/default.css +0 -84
- data/doc/examples/website_templates/project/src/default.template +0 -38
- data/doc/examples/website_templates/project/src/download.page +0 -15
- data/doc/examples/website_templates/project/src/features.page +0 -8
- data/doc/examples/website_templates/project/src/index.page +0 -9
- data/doc/examples/website_templates/project/src/screenshots.page +0 -18
- data/doc/plugin/gallery/slides/collage.rb +0 -334
- data/doc/src/examples/gallery_styles/default/default.gallery +0 -78
- data/doc/src/examples/gallery_styles/default/gallery_gallery.template +0 -38
- data/doc/src/examples/gallery_styles/default/gallery_image.template +0 -30
- data/doc/src/examples/gallery_styles/default/gallery_main.template +0 -18
- data/doc/src/examples/gallery_styles/index.page +0 -22
- data/doc/src/examples/gallery_styles/slides/gallery_gallery.template +0 -62
- data/doc/src/examples/gallery_styles/slides/gallery_image.template +0 -53
- data/doc/src/examples/gallery_styles/slides/gallery_main.template +0 -32
- data/doc/src/examples/gallery_styles/slides/slides.gallery +0 -79
- data/doc/src/examples/website_styles/1024px.page +0 -5
- data/doc/src/examples/website_styles/andreas00.page +0 -5
- data/doc/src/examples/website_styles/andreas01.page +0 -5
- data/doc/src/examples/website_styles/andreas03.page +0 -5
- data/doc/src/examples/website_styles/andreas04.page +0 -5
- data/doc/src/examples/website_styles/andreas05.page +0 -5
- data/doc/src/examples/website_styles/andreas06.page +0 -5
- data/doc/src/examples/website_styles/andreas07.page +0 -5
- data/doc/src/examples/website_styles/andreas08.page +0 -5
- data/doc/src/examples/website_styles/andreas09.page +0 -5
- data/doc/src/examples/website_styles/default.page +0 -5
- data/doc/src/examples/website_styles/index.page +0 -71
- data/doc/src/examples/website_styles/plain.page +0 -5
- data/doc/src/examples/website_templates/default.page +0 -5
- data/doc/src/examples/website_templates/index.page +0 -24
- data/doc/src/examples/website_templates/personal_hp.page +0 -5
- 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,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,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
|