gettalong-webgen 0.5.5.20081012 → 0.5.6.20081020
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +8 -1
- data/data/webgen/website_styles/1024px/src/default.template +1 -1
- data/data/webgen/website_styles/andreas00/src/default.template +1 -1
- data/data/webgen/website_styles/andreas01/src/default.template +2 -1
- data/data/webgen/website_styles/andreas03/src/default.template +1 -1
- data/data/webgen/website_styles/andreas04/src/default.template +1 -1
- data/data/webgen/website_styles/andreas05/src/default.template +1 -1
- data/data/webgen/website_styles/andreas06/src/default.template +1 -1
- data/data/webgen/website_styles/andreas07/src/default.template +1 -1
- data/data/webgen/website_styles/andreas08/src/default.template +1 -1
- data/data/webgen/website_styles/andreas09/src/default.template +1 -1
- data/data/webgen/website_styles/simple/src/default.template +1 -1
- data/doc/reference_configuration.page +248 -69
- data/doc/tag/link.page +44 -0
- data/lib/webgen/cli.rb +4 -4
- data/lib/webgen/configuration.rb +3 -1
- data/lib/webgen/default_config.rb +4 -0
- data/lib/webgen/sourcehandler/base.rb +2 -1
- data/lib/webgen/tag.rb +1 -0
- data/lib/webgen/tag/link.rb +23 -0
- data/lib/webgen/version.rb +1 -1
- data/lib/webgen/website.rb +2 -1
- data/test/test_cli.rb +14 -0
- data/test/test_node.rb +1 -2
- data/test/test_tag_link.rb +61 -0
- data/test/test_tree.rb +2 -0
- metadata +6 -2
data/Rakefile
CHANGED
@@ -98,6 +98,7 @@ EOF
|
|
98
98
|
'Rakefile',
|
99
99
|
'setup.rb',
|
100
100
|
'VERSION',
|
101
|
+
'ChangeLog',
|
101
102
|
'AUTHORS',
|
102
103
|
'THANKS',
|
103
104
|
'COPYING',
|
@@ -120,6 +121,12 @@ EOF
|
|
120
121
|
File.open('VERSION', 'w+') {|file| file.write(Webgen::VERSION + "\n")}
|
121
122
|
end
|
122
123
|
|
124
|
+
CLOBBER << 'ChangeLog'
|
125
|
+
file 'ChangeLog' do
|
126
|
+
puts "Generating ChangeLog file"
|
127
|
+
`git log --name-only > ChangeLog`
|
128
|
+
end
|
129
|
+
|
123
130
|
Rake::PackageTask.new('webgen', Webgen::VERSION) do |pkg|
|
124
131
|
pkg.need_tar = true
|
125
132
|
pkg.need_zip = true
|
@@ -194,7 +201,7 @@ EOF
|
|
194
201
|
task :gemspec do
|
195
202
|
spec.version = Webgen::VERSION + '.' + Time.now.strftime('%Y%m%d')
|
196
203
|
spec.summary = 'webgen beta build, not supported!!!'
|
197
|
-
spec.files = spec.files.reject {|f| f == 'VERSION'}
|
204
|
+
spec.files = spec.files.reject {|f| f == 'VERSION' || f == 'ChangeLog'}
|
198
205
|
spec.post_install_message = "
|
199
206
|
|
200
207
|
|
@@ -35,7 +35,7 @@
|
|
35
35
|
<p>Write a short presentation of yourself or the site right here!</p>
|
36
36
|
|
37
37
|
<h2>Pages:</h2>
|
38
|
-
<div id="menu">{menu: {max_levels: 2}}</div>
|
38
|
+
<div id="menu">{menu: {max_levels: 2, used_nodes: files}}</div>
|
39
39
|
|
40
40
|
<h2>Site news:</h2>
|
41
41
|
<p><strong>09.09.2009</strong><br />
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
3
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
4
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{lang:}">
|
@@ -24,7 +25,7 @@
|
|
24
25
|
|
25
26
|
<div id="leftside">
|
26
27
|
<h2 class="hide">Menu:</h2>
|
27
|
-
<div id="menu">{menu: }</div>
|
28
|
+
<div id="menu">{menu: {used_nodes: files}}</div>
|
28
29
|
|
29
30
|
<div class="announce">
|
30
31
|
<h2>Latest news:</h2>
|
@@ -37,7 +37,7 @@
|
|
37
37
|
<div id="sidebar">
|
38
38
|
|
39
39
|
<h2 class="sidelink menuheader"><a id="sitemenu"></a>Menu:</h2>
|
40
|
-
<div id="menu">{menu: {max_levels: 1}}</div>
|
40
|
+
<div id="menu">{menu: {max_levels: 1, used_nodes: files}}</div>
|
41
41
|
<a class="hide" href="#top" accesskey="1">Top of page</a>
|
42
42
|
|
43
43
|
<h3>Regular links</h3>
|
@@ -5,8 +5,14 @@ in_menu: false
|
|
5
5
|
|
6
6
|
# Configuration Option Reference
|
7
7
|
|
8
|
-
This reference describes all available configurations that can be set via the configuration
|
9
|
-
(or, if you want to have more
|
8
|
+
This reference describes all available configurations that can be set via the [configuration
|
9
|
+
file]({relocatable: manual.html#website-configfile}) `config.yaml` (or, if you want to have more
|
10
|
+
control, via an extension file).
|
11
|
+
|
12
|
+
The reference is splitted into sections to provide better navigation. A sub header under a category
|
13
|
+
always specifies the name of a configuration option and after that comes a description and example
|
14
|
+
code. The example code either shows how to set this option in the configuration file (for most
|
15
|
+
configuration options) and/or how to use it in a webgen tag (for tag configuration options).
|
10
16
|
|
11
17
|
## General Options
|
12
18
|
|
@@ -17,10 +23,9 @@ This reference describes all available configurations that can be set via the co
|
|
17
23
|
|
18
24
|
* Syntax: `LANGUAGE` where `LANGUAGE` is a ISO-639-1/2 two or three letter language code
|
19
25
|
|
20
|
-
*
|
26
|
+
* Example for setting the option in the configuration file:
|
21
27
|
|
22
|
-
website.lang:
|
23
|
-
website.lang: fr
|
28
|
+
website.lang: de
|
24
29
|
|
25
30
|
|
26
31
|
* ### website.link\_to\_current\_page
|
@@ -30,7 +35,7 @@ This reference describes all available configurations that can be set via the co
|
|
30
35
|
|
31
36
|
* Syntax: `BOOLEAN` where `BOOLEAN` is `true` or `false`
|
32
37
|
|
33
|
-
*
|
38
|
+
* Example for setting the option in the configuration file:
|
34
39
|
|
35
40
|
website.link_to_current_page: false
|
36
41
|
|
@@ -44,7 +49,7 @@ This reference describes all available configurations that can be set via the co
|
|
44
49
|
|
45
50
|
* Syntax: `[TYPE, LOCATION]` where `TYPE` is one of `:file` or `:string`
|
46
51
|
|
47
|
-
*
|
52
|
+
* Example for setting the option in the configuration file:
|
48
53
|
|
49
54
|
website.cache: [:file, my.cache]
|
50
55
|
|
@@ -58,7 +63,11 @@ This reference describes all available configurations that can be set via the co
|
|
58
63
|
|
59
64
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
60
65
|
|
61
|
-
*
|
66
|
+
* Example for setting the option in the configuration file:
|
67
|
+
|
68
|
+
common.sitemap.honor_in_menu: true
|
69
|
+
|
70
|
+
Example for setting the option directly in a tag:
|
62
71
|
|
63
72
|
Sitemap with in-menu nodes: \{sitemap: {honor_in_menu: true}}
|
64
73
|
|
@@ -70,7 +79,11 @@ This reference describes all available configurations that can be set via the co
|
|
70
79
|
|
71
80
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
72
81
|
|
73
|
-
*
|
82
|
+
* Example for setting the option in the configuration file:
|
83
|
+
|
84
|
+
common.sitemap.any_lang: true
|
85
|
+
|
86
|
+
Example for setting the option directly in a tag:
|
74
87
|
|
75
88
|
Sitemap with nodes in any language: \{sitemap: {any_lang: true}}
|
76
89
|
|
@@ -82,7 +95,11 @@ This reference describes all available configurations that can be set via the co
|
|
82
95
|
|
83
96
|
* Syntax: `[KIND, ...]` where `KIND` is the kind of node that should be used.
|
84
97
|
|
85
|
-
*
|
98
|
+
* Example for setting the option in the configuration file:
|
99
|
+
|
100
|
+
common.sitemap.used_kinds: [asset]
|
101
|
+
|
102
|
+
Example for setting the option directly in a tag:
|
86
103
|
|
87
104
|
Sitemap with only asset nodes: \{sitemap: {used_kinds: [asset]}}
|
88
105
|
|
@@ -100,7 +117,7 @@ This reference describes all available configurations that can be set via the co
|
|
100
117
|
`Webgen::Source::FileSystem`) and `ARG1`, `ARG2` and so on are the parameters for the source
|
101
118
|
class. The supported parameters can be found in the documentation for each source class.
|
102
119
|
|
103
|
-
*
|
120
|
+
* Example for setting the option in the configuration file:
|
104
121
|
|
105
122
|
sources: [[/, Webgen::Source::FileSystem, src], [/, Webgen::Source::FileSystem, /mnt/pictures, **/*.jpg]
|
106
123
|
|
@@ -113,7 +130,7 @@ This reference describes all available configurations that can be set via the co
|
|
113
130
|
`Webgen::Output::FileSystem`) and `ARG1`, `ARG2` and so on are the parameters for the output
|
114
131
|
class. The supported parameters can be found in the documentation for each output class.
|
115
132
|
|
116
|
-
*
|
133
|
+
* Example for setting the option in the configuration file:
|
117
134
|
|
118
135
|
output: [Webgen::Output::FileSystem, custom_out]
|
119
136
|
|
@@ -121,15 +138,23 @@ This reference describes all available configurations that can be set via the co
|
|
121
138
|
* ### sourcehandler.patterns
|
122
139
|
|
123
140
|
Specifies the path patterns that are used by the individual source handlers. This configuration
|
124
|
-
option is not normally set in the configuration file but in an extension file
|
125
|
-
(e.g. `ext/init.rb`)
|
141
|
+
option is not normally set directly in the configuration file but either in an extension file
|
142
|
+
(e.g. `ext/init.rb`) or using a [configuration file helper]({relocatable:
|
143
|
+
manual.html#website-configfile}) because otherwise the default entries would be overwritten.
|
126
144
|
|
127
145
|
* Syntax: `\{NAME: [PATTERN, PATTERN, ...], ...}` where `NAME` is the
|
128
146
|
name the name of a source handler and `PATTERN` are one or more path patterns.
|
129
147
|
|
130
|
-
*
|
148
|
+
* Example for setting the option in `ext/init.rb`:
|
149
|
+
|
150
|
+
config = Webgen::WebsiteAccess.website.config
|
151
|
+
config['sourcehandler.patterns']['Webgen::SourceHandler::Copy'] << '**/*.swf'
|
152
|
+
|
153
|
+
Example for setting the option via the configuration file helper in the configuration file:
|
131
154
|
|
132
|
-
|
155
|
+
patterns:
|
156
|
+
Copy:
|
157
|
+
add: [**/*.swf]
|
133
158
|
|
134
159
|
|
135
160
|
* ### sourcehandler.invoke
|
@@ -141,9 +166,10 @@ This reference describes all available configurations that can be set via the co
|
|
141
166
|
invocation (source handlers with a lower `ORDER` setting are executed earlier than ones with a
|
142
167
|
higher `ORDER` setting) and `NAME` is the name of a source handler.
|
143
168
|
|
144
|
-
*
|
169
|
+
* Example for setting the option in `ext/init.rb`:
|
145
170
|
|
146
|
-
config
|
171
|
+
config = Webgen::WebsiteAccess.website.config
|
172
|
+
config['sourcehandler.invoke'][5] << 'Extension::MyNewSourceHandler'
|
147
173
|
|
148
174
|
|
149
175
|
* ### sourcehandler.casefold
|
@@ -153,7 +179,7 @@ This reference describes all available configurations that can be set via the co
|
|
153
179
|
|
154
180
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
155
181
|
|
156
|
-
*
|
182
|
+
* Example for setting the option in the configuration file:
|
157
183
|
|
158
184
|
sourcehandler.casefold: true
|
159
185
|
|
@@ -164,7 +190,7 @@ This reference describes all available configurations that can be set via the co
|
|
164
190
|
|
165
191
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
166
192
|
|
167
|
-
*
|
193
|
+
* Example for setting the option in the configuration file:
|
168
194
|
|
169
195
|
sourcehandler.use_hidden_files: true
|
170
196
|
|
@@ -176,7 +202,7 @@ This reference describes all available configurations that can be set via the co
|
|
176
202
|
|
177
203
|
* Syntax: `[PATTERN, ...]` where `PATTERN` is a valid path pattern.
|
178
204
|
|
179
|
-
*
|
205
|
+
* Example for setting the option in the configuration file:
|
180
206
|
|
181
207
|
sourcehandler.ignore: [**/*~, **/CVS/**]
|
182
208
|
|
@@ -188,7 +214,7 @@ This reference describes all available configurations that can be set via the co
|
|
188
214
|
|
189
215
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
190
216
|
|
191
|
-
*
|
217
|
+
* Example for setting the option in the configuration file:
|
192
218
|
|
193
219
|
sourcehandler.default_lang_in_output_path: true
|
194
220
|
|
@@ -202,7 +228,7 @@ This reference describes all available configurations that can be set via the co
|
|
202
228
|
* Syntax: `\{NAME: {MI_KEY: MI_VALUE, ...}, ...}` where `NAME` is either the name of a source
|
203
229
|
handler or the special key `:all` which sets default meta info for all source handlers.
|
204
230
|
|
205
|
-
*
|
231
|
+
* Example for setting the option in the configuration file:
|
206
232
|
|
207
233
|
default_meta_info:
|
208
234
|
:all:
|
@@ -218,7 +244,7 @@ This reference describes all available configurations that can be set via the co
|
|
218
244
|
|
219
245
|
* Syntax: `PATH` where `PATH` is the absolute localized canonical name of the default template.
|
220
246
|
|
221
|
-
*
|
247
|
+
* Example for setting the option in the configuration file:
|
222
248
|
|
223
249
|
sourcehandler.template.default_template: other.template
|
224
250
|
|
@@ -235,8 +261,9 @@ This reference describes all available configurations that can be set via the co
|
|
235
261
|
* Syntax: `\{SHORT: NAME, ...}` where `SHORT` is the short name of the content processor class
|
236
262
|
`NAME`.
|
237
263
|
|
238
|
-
* Examples
|
264
|
+
* Examples for setting the option in `ext/init.rb`:
|
239
265
|
|
266
|
+
config = Webgen::WebsiteAccess.website.config
|
240
267
|
config['contentprocessor.map']['newcp'] = 'Extension::MyNewContentProcessor'
|
241
268
|
|
242
269
|
|
@@ -247,7 +274,7 @@ This reference describes all available configurations that can be set via the co
|
|
247
274
|
|
248
275
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
249
276
|
|
250
|
-
*
|
277
|
+
* Example for setting the option in the configuration file:
|
251
278
|
|
252
279
|
contentprocessor.erubis.use_pi: true
|
253
280
|
|
@@ -260,7 +287,7 @@ This reference describes all available configurations that can be set via the co
|
|
260
287
|
* Syntax: `\{KEY: VALUE, ...}` where `KEY` and `VALUE` are key-value pairs of options where
|
261
288
|
`KEY` needs to be a Symbol and not a String.
|
262
289
|
|
263
|
-
*
|
290
|
+
* Example for setting the option in the configuration file:
|
264
291
|
|
265
292
|
contentprocessor.erubis.options: {:trim: true}
|
266
293
|
|
@@ -272,10 +299,9 @@ This reference describes all available configurations that can be set via the co
|
|
272
299
|
|
273
300
|
* Syntax: `PREFIX` where `PREFIX` is the prefix name.
|
274
301
|
|
275
|
-
*
|
302
|
+
* Example for setting the option in the configuration file:
|
276
303
|
|
277
304
|
contentprocessor.tags.prefix: webgen
|
278
|
-
contentprocessor.tags.prefix: tag
|
279
305
|
|
280
306
|
|
281
307
|
* ### contentprocessor.tags.map
|
@@ -286,16 +312,18 @@ This reference describes all available configurations that can be set via the co
|
|
286
312
|
|
287
313
|
* Syntax: `\{SHORT: NAME, ...}` where `SHORT` is the short name of the tag class `NAME`.
|
288
314
|
|
289
|
-
*
|
315
|
+
* Example for setting the option in `ext/init.rb`:
|
290
316
|
|
317
|
+
config = Webgen::WebsiteAccess.website.config
|
291
318
|
config['contentprocessor.tags.map']['highlight'] = 'Extension::MyHighlightingTag'
|
292
319
|
|
293
320
|
|
294
321
|
## Tag Specific Options
|
295
322
|
|
296
323
|
These options are not normally set in the configuration file but given directly as options to the
|
297
|
-
respective tag classes. Therefore, all
|
298
|
-
files in Webgen Page Format
|
324
|
+
respective tag classes. Therefore, all options described in this section have an example which shows
|
325
|
+
how to use the option in files in Webgen Page Format and most options also have an example which
|
326
|
+
shows how to set the option in the configuration file.
|
299
327
|
|
300
328
|
* ### tag.breadcrumbtrail.separator
|
301
329
|
|
@@ -305,7 +333,11 @@ files in Webgen Page Format.
|
|
305
333
|
* Syntax: `SEPARATOR` where `SEPARATOR` is a string (special HTML characters need to be properly
|
306
334
|
escaped)
|
307
335
|
|
308
|
-
*
|
336
|
+
* Example for setting the option in the configuration file:
|
337
|
+
|
338
|
+
tag.breadcrumbtrail.separator: '---'
|
339
|
+
|
340
|
+
Example for setting the option directly in a tag:
|
309
341
|
|
310
342
|
Breadcrumb trail with different separator: \{breadcrumb_trail: {separator: ' --- '}}
|
311
343
|
|
@@ -316,7 +348,11 @@ files in Webgen Page Format.
|
|
316
348
|
|
317
349
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
318
350
|
|
319
|
-
*
|
351
|
+
* Example for setting the option in the configuration file:
|
352
|
+
|
353
|
+
tag.breadcrumbtrail.omit_index_path: true
|
354
|
+
|
355
|
+
Example for setting the option directly in a tag:
|
320
356
|
|
321
357
|
Breadcrumb trail with index path omitted: \{breadcrumb_trail: {omit_index_path: true}}
|
322
358
|
|
@@ -337,7 +373,11 @@ files in Webgen Page Format.
|
|
337
373
|
|
338
374
|
* Syntax: `INTEGER` where `INTEGER` is any integer number
|
339
375
|
|
340
|
-
*
|
376
|
+
* Example for setting the option in the configuration file:
|
377
|
+
|
378
|
+
tag.breadcrumbtrail.start_level: 2
|
379
|
+
|
380
|
+
Example for setting the option directly in a tag:
|
341
381
|
|
342
382
|
Breadcrumb trail starting at level 2: \{breadcrumb_trail: {start_level: 2}}
|
343
383
|
|
@@ -349,7 +389,11 @@ files in Webgen Page Format.
|
|
349
389
|
|
350
390
|
* Syntax: `INTEGER` where `INTEGER` is any integer number
|
351
391
|
|
352
|
-
*
|
392
|
+
* Example for setting the option in the configuration file:
|
393
|
+
|
394
|
+
tag.breadcrumbtrail.end_level: 2
|
395
|
+
|
396
|
+
Example for setting the option directly in a tag:
|
353
397
|
|
354
398
|
Breadcrumb trail ending at level 2: \{breadcrumb_trail: {end_level: 2}}
|
355
399
|
|
@@ -360,7 +404,11 @@ files in Webgen Page Format.
|
|
360
404
|
|
361
405
|
* Syntax: `LANG` where `LANG` is one of <%= (require 'coderay'; CodeRay::Scanners.list.map {|n| '`' + n + '`'}.join(', ')) %>.
|
362
406
|
|
363
|
-
*
|
407
|
+
* Example for setting the option in the configuration file:
|
408
|
+
|
409
|
+
tag.coderay.lang: ruby
|
410
|
+
|
411
|
+
Example for setting the option directly in a tag:
|
364
412
|
|
365
413
|
highlighting some ruby code \{coderay:: ruby}puts 5 + 5{coderay}
|
366
414
|
|
@@ -371,7 +419,11 @@ files in Webgen Page Format.
|
|
371
419
|
|
372
420
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
373
421
|
|
374
|
-
*
|
422
|
+
* Example for setting the option in the configuration file:
|
423
|
+
|
424
|
+
tag.coderay.process_body: false
|
425
|
+
|
426
|
+
Example for setting the option directly in a tag:
|
375
427
|
|
376
428
|
wrapping in a span: \{coderay:: {lang: ruby, process_body: false}}puts 5 + 5{coderay}
|
377
429
|
|
@@ -382,7 +434,11 @@ files in Webgen Page Format.
|
|
382
434
|
|
383
435
|
* Syntax: `WRAP` where `WRAP` is either `div` or `span`
|
384
436
|
|
385
|
-
*
|
437
|
+
* Example for setting the option in the configuration file:
|
438
|
+
|
439
|
+
tag.coderay.wrap: span
|
440
|
+
|
441
|
+
Example for setting the option directly in a tag:
|
386
442
|
|
387
443
|
wrapping in a span: \{coderay:: {lang: ruby, wrap: span}}puts 5 + 5{coderay}
|
388
444
|
|
@@ -393,7 +449,11 @@ files in Webgen Page Format.
|
|
393
449
|
|
394
450
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
395
451
|
|
396
|
-
*
|
452
|
+
* Example for setting the option in the configuration file:
|
453
|
+
|
454
|
+
tag.coderay.line_numbers: false
|
455
|
+
|
456
|
+
Example for setting the option directly in a tag:
|
397
457
|
|
398
458
|
not showing line numbers: \{coderay:: {lang: ruby, line_numbers: false}}puts 5 + 5{coderay}
|
399
459
|
|
@@ -404,7 +464,11 @@ files in Webgen Page Format.
|
|
404
464
|
|
405
465
|
* Syntax: `NUMBER` where `NUMBER` is an integer value.
|
406
466
|
|
407
|
-
*
|
467
|
+
* Example for setting the option in the configuration file:
|
468
|
+
|
469
|
+
tag.coderay.line_number_start: 4
|
470
|
+
|
471
|
+
Example for setting the option directly in a tag:
|
408
472
|
|
409
473
|
starting with line 4: \{coderay:: {lang: ruby, line_number_start: 4}}puts 5 + 5{coderay}
|
410
474
|
|
@@ -415,7 +479,11 @@ files in Webgen Page Format.
|
|
415
479
|
|
416
480
|
* Syntax: `NUMBER` where `NUMBER` is an integer value.
|
417
481
|
|
418
|
-
*
|
482
|
+
* Example for setting the option in the configuration file:
|
483
|
+
|
484
|
+
tag.coderay.bold_every: 2
|
485
|
+
|
486
|
+
Example for setting the option directly in a tag:
|
419
487
|
|
420
488
|
every other line bold: \{coderay:: {lang: ruby, bold_every: 2}}puts 5 + 5{coderay}
|
421
489
|
|
@@ -426,7 +494,11 @@ files in Webgen Page Format.
|
|
426
494
|
|
427
495
|
* Syntax: `NUMBER` where `NUMBER` is an integer value.
|
428
496
|
|
429
|
-
*
|
497
|
+
* Example for setting the option in the configuration file:
|
498
|
+
|
499
|
+
tag.coderay.tab_width: 4
|
500
|
+
|
501
|
+
Example for setting the option directly in a tag:
|
430
502
|
|
431
503
|
tabulator == 4 spaces: \{coderay:: {lang: ruby, tab_width: 4}}puts 5 + 5{coderay}
|
432
504
|
|
@@ -439,7 +511,11 @@ files in Webgen Page Format.
|
|
439
511
|
|
440
512
|
* Syntax: `FORMAT` where `FORMAT` is a string.
|
441
513
|
|
442
|
-
*
|
514
|
+
* Example for setting the option in the configuration file:
|
515
|
+
|
516
|
+
tag.date.format: '%Y-%m-%d'
|
517
|
+
|
518
|
+
Example for setting the option directly in a tag:
|
443
519
|
|
444
520
|
very short date format: \{date: {format: '%Y-%m-%d'}}
|
445
521
|
|
@@ -451,7 +527,7 @@ files in Webgen Page Format.
|
|
451
527
|
|
452
528
|
* Syntax: `COMMAND` where `COMMAND` is the to-be-executed command.
|
453
529
|
|
454
|
-
*
|
530
|
+
* Example for setting the option directly in a tag:
|
455
531
|
|
456
532
|
executing a simple command \{exeucte_cmd: echo hallo}
|
457
533
|
|
@@ -463,7 +539,11 @@ files in Webgen Page Format.
|
|
463
539
|
|
464
540
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
465
541
|
|
466
|
-
*
|
542
|
+
* Example for setting the option in the configuration file:
|
543
|
+
|
544
|
+
tag.executecommand.process_output: false
|
545
|
+
|
546
|
+
Example for setting the option directly in a tag:
|
467
547
|
|
468
548
|
executing command without further processing \{execute_cmd: {command: 'echo hallo', process_output: false}}
|
469
549
|
|
@@ -474,7 +554,11 @@ files in Webgen Page Format.
|
|
474
554
|
|
475
555
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
476
556
|
|
477
|
-
*
|
557
|
+
* Example for setting the option in the configuration file:
|
558
|
+
|
559
|
+
tag.executecommand.escape_html: false
|
560
|
+
|
561
|
+
Example for setting the option directly in a tag:
|
478
562
|
|
479
563
|
executing command, output not escaped \{execute_cmd: {command: 'echo hallo', escape_html: false}}
|
480
564
|
|
@@ -487,7 +571,7 @@ files in Webgen Page Format.
|
|
487
571
|
|
488
572
|
* Syntax: `FILENAME` where `FILENAME` is the name of a file
|
489
573
|
|
490
|
-
*
|
574
|
+
* Example for setting the option directly in a tag:
|
491
575
|
|
492
576
|
including a file \{include_file: my_file.txt}
|
493
577
|
|
@@ -499,7 +583,11 @@ files in Webgen Page Format.
|
|
499
583
|
|
500
584
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
501
585
|
|
502
|
-
*
|
586
|
+
* Example for setting the option in the configuration file:
|
587
|
+
|
588
|
+
tag.includefile.process_output: false
|
589
|
+
|
590
|
+
Example for setting the option directly in a tag:
|
503
591
|
|
504
592
|
including a file without further processing \{include_file: {filename: my_file.txt, process_output: false}}
|
505
593
|
|
@@ -510,7 +598,11 @@ files in Webgen Page Format.
|
|
510
598
|
|
511
599
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
512
600
|
|
513
|
-
*
|
601
|
+
* Example for setting the option in the configuration file:
|
602
|
+
|
603
|
+
tag.includefile.escape_html: false
|
604
|
+
|
605
|
+
Example for setting the option directly in a tag:
|
514
606
|
|
515
607
|
including a file without escaping \{include_file: {filename: my_file.txt, escape_html: false}}
|
516
608
|
|
@@ -522,7 +614,11 @@ files in Webgen Page Format.
|
|
522
614
|
* Syntax: `SEPARATOR` where `SEPARATOR` is a string (special HTML characters need to be properly
|
523
615
|
escaped)
|
524
616
|
|
525
|
-
*
|
617
|
+
* Example for setting the option in the configuration file:
|
618
|
+
|
619
|
+
tag.langbar.separator: ' --- '
|
620
|
+
|
621
|
+
Example for setting the option directly in a tag:
|
526
622
|
|
527
623
|
Langbar with another separator: \{langbar: {separator: ' --- '}}
|
528
624
|
|
@@ -533,7 +629,11 @@ files in Webgen Page Format.
|
|
533
629
|
|
534
630
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
535
631
|
|
536
|
-
*
|
632
|
+
* Example for setting the option in the configuration file:
|
633
|
+
|
634
|
+
tag.langbar.show_own_lang: false
|
635
|
+
|
636
|
+
Example for setting the option directly in a tag:
|
537
637
|
|
538
638
|
Langbar with current page's lang not shown: \{langbar: {show_own_lang: false}}
|
539
639
|
|
@@ -545,7 +645,11 @@ files in Webgen Page Format.
|
|
545
645
|
|
546
646
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
547
647
|
|
548
|
-
*
|
648
|
+
* Example for setting the option in the configuration file:
|
649
|
+
|
650
|
+
tag.langbar.show_single_lang: false
|
651
|
+
|
652
|
+
Example for setting the option directly in a tag:
|
549
653
|
|
550
654
|
Langbar with single language not shown: \{langbar: {show_single_lang: false}}
|
551
655
|
|
@@ -558,11 +662,43 @@ files in Webgen Page Format.
|
|
558
662
|
* Syntax: `\{CODE: NAME, ...}` where `CODE` is a language code and `NAME` the associated language
|
559
663
|
name of the code.
|
560
664
|
|
561
|
-
*
|
665
|
+
* Example for setting the option in the configuration file:
|
666
|
+
|
667
|
+
tag.langbar.lang_names: \{de: Deutsch, en: English}
|
668
|
+
|
669
|
+
Example for setting the option directly in a tag:
|
562
670
|
|
563
671
|
Langbar with custom language names: \{langbar: {lang_names: {de: Deutsch, en: English}}}
|
564
672
|
|
565
673
|
|
674
|
+
* ### tag.link.path
|
675
|
+
|
676
|
+
The default mandatory configuration option for Tag::Link that specifies the (AL)CN path to which
|
677
|
+
should be linked.
|
678
|
+
|
679
|
+
* Syntax: `PATH` where `PATH` is an (absolute) (localized) canonical name.
|
680
|
+
|
681
|
+
* Example for setting the option directly in a tag:
|
682
|
+
|
683
|
+
You will find more information on the \{link: docu.html} page!
|
684
|
+
|
685
|
+
|
686
|
+
* ### tag.link.attr
|
687
|
+
|
688
|
+
Specifies additional HTML attributes that should be set on the link generated by Tag::Link.
|
689
|
+
|
690
|
+
* Syntax: `\{NAME: VALUE, ...}` where `NAME` is a valid HTML attribute name and `VALUE` its
|
691
|
+
value.
|
692
|
+
|
693
|
+
* Example for setting the option in the configuration file:
|
694
|
+
|
695
|
+
tag.link.attr: \{title: DocuPage}
|
696
|
+
|
697
|
+
Example for setting the option directly in a tag:
|
698
|
+
|
699
|
+
You will find more info on the \{link: {path: docu.html, attr: {title: DocuPage}}} page!
|
700
|
+
|
701
|
+
|
566
702
|
* ### tag.menu.used\_nodes
|
567
703
|
|
568
704
|
Specifies the type of nodes that should be used for menu generation. If `all` is specified then
|
@@ -572,7 +708,11 @@ files in Webgen Page Format.
|
|
572
708
|
|
573
709
|
* Syntax: `TYPE` where `TYPE` is one of `all`, `files` or `fragments`
|
574
710
|
|
575
|
-
*
|
711
|
+
* Example for setting the option in the configuration file:
|
712
|
+
|
713
|
+
tag.menu.used_nodes: fragments
|
714
|
+
|
715
|
+
Example for setting the option directly in a tag:
|
576
716
|
|
577
717
|
Show the fragment node menu: \{menu: {used_nodes: fragments}}
|
578
718
|
|
@@ -584,7 +724,11 @@ files in Webgen Page Format.
|
|
584
724
|
|
585
725
|
* Syntax: `LEVEL` where `LEVEL` is a number that is greater or equal to one.
|
586
726
|
|
587
|
-
*
|
727
|
+
* Example for setting the option in the configuration file:
|
728
|
+
|
729
|
+
tag.menu.start_level: 2
|
730
|
+
|
731
|
+
Example for setting the option directly in a tag:
|
588
732
|
|
589
733
|
Menu starting at level 2: \{menu: {start_level: 2}}
|
590
734
|
|
@@ -596,7 +740,11 @@ files in Webgen Page Format.
|
|
596
740
|
|
597
741
|
* Syntax: `LEVEL` where `LEVEL` is a number that is greater or equal to one.
|
598
742
|
|
599
|
-
*
|
743
|
+
* Example for setting the option in the configuration file:
|
744
|
+
|
745
|
+
tag.menu.min_levels: 2
|
746
|
+
|
747
|
+
Example for setting the option directly in a tag:
|
600
748
|
|
601
749
|
Menu that always shows at least 2 levels : \{menu: {min_levels: 2}}
|
602
750
|
|
@@ -608,7 +756,11 @@ files in Webgen Page Format.
|
|
608
756
|
|
609
757
|
* Syntax: `LEVEL` where `LEVEL` is a number that is greater or equal to one.
|
610
758
|
|
611
|
-
*
|
759
|
+
* Example for setting the option in the configuration file:
|
760
|
+
|
761
|
+
tag.menu.max_levels: 2
|
762
|
+
|
763
|
+
Example for setting the option directly in a tag:
|
612
764
|
|
613
765
|
Menu that always shows at most 2 levels : \{menu: {max_levels: 2}}
|
614
766
|
|
@@ -621,7 +773,11 @@ files in Webgen Page Format.
|
|
621
773
|
|
622
774
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
623
775
|
|
624
|
-
*
|
776
|
+
* Example for setting the option in the configuration file:
|
777
|
+
|
778
|
+
tag.menu.show_current_subtree_only: false
|
779
|
+
|
780
|
+
Example for setting the option directly in a tag:
|
625
781
|
|
626
782
|
Showing all subtrees: \{menu: {show_current_subtree_only: false}}
|
627
783
|
|
@@ -654,7 +810,11 @@ files in Webgen Page Format.
|
|
654
810
|
|
655
811
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
656
812
|
|
657
|
-
*
|
813
|
+
* Example for setting the option in the configuration file:
|
814
|
+
|
815
|
+
tag.menu.nested: false
|
816
|
+
|
817
|
+
Example for setting the option directly in a tag:
|
658
818
|
|
659
819
|
Don't use nested lists: \{menu: {nested: false}}
|
660
820
|
|
@@ -662,12 +822,11 @@ files in Webgen Page Format.
|
|
662
822
|
* ### tag.relocatable.path
|
663
823
|
|
664
824
|
The default mandatory configuration option for Tag::Relocatable that specifies the path that
|
665
|
-
should be made relocatable.
|
666
|
-
Webgen::Tag::Relocatable.
|
825
|
+
should be made relocatable.
|
667
826
|
|
668
827
|
* Syntax: `PATH` where `PATH` is a (localized) canonical name.
|
669
828
|
|
670
|
-
*
|
829
|
+
* Example for setting the option directly in a tag:
|
671
830
|
|
672
831
|
<a href="\{relocatable: ../features.html}">Some Path</a>
|
673
832
|
|
@@ -680,7 +839,7 @@ files in Webgen Page Format.
|
|
680
839
|
|
681
840
|
* Syntax: `PATH` where `PATH` is a relative or absolute source path.
|
682
841
|
|
683
|
-
*
|
842
|
+
* Example for setting the option directly in a tag:
|
684
843
|
|
685
844
|
\{tikz:: images/tikz.png}\tikz \draw (0,0) -- (0,2);{tikz}
|
686
845
|
|
@@ -692,7 +851,11 @@ files in Webgen Page Format.
|
|
692
851
|
|
693
852
|
* Syntax: `[NAME, ...]` where `NAME` is the name of a TikZ library.
|
694
853
|
|
695
|
-
*
|
854
|
+
* Example for setting the option in the configuration file:
|
855
|
+
|
856
|
+
tag.tikz.libraries: [mindmap, arrows]
|
857
|
+
|
858
|
+
Example for setting the option directly in a tag:
|
696
859
|
|
697
860
|
\{tikz:: {path: images/tikz.png, libraries: [mindmap, arrows]}}
|
698
861
|
\tikz \draw (0,0) -- (0,2) -- (2,2);
|
@@ -705,7 +868,11 @@ files in Webgen Page Format.
|
|
705
868
|
|
706
869
|
* Syntax: `OPTS` where `OPTS` is the string with the global options.
|
707
870
|
|
708
|
-
*
|
871
|
+
* Example for setting the option in the configuration file:
|
872
|
+
|
873
|
+
tag.tikz.opts: 'scale=3, line cap=round'
|
874
|
+
|
875
|
+
Example for setting the option directly in a tag:
|
709
876
|
|
710
877
|
\{tikz:: {path: images/tikz.png, opts: 'scale=3, line cap=round'}}
|
711
878
|
\tikz \draw (0,0) -- (0,2) -- (2,2);
|
@@ -722,7 +889,11 @@ files in Webgen Page Format.
|
|
722
889
|
* Syntax: `RENDER_RES OUTPUT_RES` where `RENDER_RES` is the integer specifying the render
|
723
890
|
resolution and `OUTPUT_RES` is the integer specifying the output resolution.
|
724
891
|
|
725
|
-
*
|
892
|
+
* Example for setting the option in the configuration file:
|
893
|
+
|
894
|
+
tag.tikz.resolution: 300 72
|
895
|
+
|
896
|
+
Example for setting the option directly in a tag:
|
726
897
|
|
727
898
|
\{tikz:: {path: images/tikz.png, resolution: 300 72}}
|
728
899
|
\tikz \draw (0,0) -- (0,2) -- (2,2);
|
@@ -737,7 +908,11 @@ files in Webgen Page Format.
|
|
737
908
|
|
738
909
|
* Syntax: `BOOLEAN` where `BOOLEAN` is either `true` or `false`.
|
739
910
|
|
740
|
-
*
|
911
|
+
* Example for setting the option in the configuration file:
|
912
|
+
|
913
|
+
tag.tikz.transparent: true
|
914
|
+
|
915
|
+
Example for setting the option directly in a tag:
|
741
916
|
|
742
917
|
\{tikz:: {path: images/tikz.png, transparent: true}}
|
743
918
|
\tikz \draw (0,0) -- (0,2) -- (2,2);
|
@@ -751,7 +926,11 @@ files in Webgen Page Format.
|
|
751
926
|
* Syntax: `\{KEY:VALUE, ...}` where `KEY` is a valid HTML `img` tag attribute name and `VALUE`
|
752
927
|
the to-be-set value.
|
753
928
|
|
754
|
-
*
|
929
|
+
* Example for setting the option in the configuration file:
|
930
|
+
|
931
|
+
tag.tikz.img_attr: \{alt: Some TikZ picture}
|
932
|
+
|
933
|
+
Example for setting the option directly in a tag:
|
755
934
|
|
756
935
|
\{tikz:: {path: images/tikz.png, img_attr: {alt: Some TikZ picture}}}
|
757
936
|
\tikz \draw (0,0) -- (0,2) -- (2,2);
|
data/doc/tag/link.page
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
title: Webgen::Tag::Link
|
3
|
+
used_options:
|
4
|
+
- tag.link.path
|
5
|
+
- tag.link.attr
|
6
|
+
---
|
7
|
+
## Description
|
8
|
+
|
9
|
+
This tag can be used to generate a link to an (absolute) (localized) canonical path. The generated
|
10
|
+
link will behave exactly like the ones generated by, for example, the breadcrumb trail tag or the
|
11
|
+
menu tag. So it respects the setting of the configuration option `website.link_to_current_page`
|
12
|
+
which means that if this option is set to `false` only a `span` element and not an `a` element is
|
13
|
+
created.
|
14
|
+
|
15
|
+
The configuration option `tag.link.attr` lets you specify additional HTML options that should be set
|
16
|
+
on the generated link. It can also be used to set the link text via the special `:link_text` key!
|
17
|
+
|
18
|
+
## Examples
|
19
|
+
|
20
|
+
<table class="examples">
|
21
|
+
<tr>
|
22
|
+
<th>Usage</th><th>Output</th>
|
23
|
+
</tr>
|
24
|
+
<tr>
|
25
|
+
<td>\{link: /default.css}</td>
|
26
|
+
<td>{link: /default.css}</td>
|
27
|
+
</tr>
|
28
|
+
<tr>
|
29
|
+
<td>\{link: link.html}</td>
|
30
|
+
<td>{link: link.html}</td>
|
31
|
+
</tr>
|
32
|
+
<tr>
|
33
|
+
<td>\{link: link.html#description}</td>
|
34
|
+
<td>{link: link.html#description}</td>
|
35
|
+
</tr>
|
36
|
+
<tr>
|
37
|
+
<td>\{link: ../}</td>
|
38
|
+
<td>{link: ../}</td>
|
39
|
+
</tr>
|
40
|
+
<tr>
|
41
|
+
<td>\{link: {path: relocatable.html, attr: {:link_text: A nicer link text, title: Just a title}}}</td>
|
42
|
+
<td>{link: {path: relocatable.html, attr: {:link_text: A nicer link text, title: Just a title}}}</td>
|
43
|
+
</tr>
|
44
|
+
</table>
|
data/lib/webgen/cli.rb
CHANGED
@@ -88,16 +88,16 @@ module Webgen
|
|
88
88
|
self.program_version = Webgen::VERSION
|
89
89
|
self.options = CmdParse::OptionParserWrapper.new do |opts|
|
90
90
|
opts.separator "Global options:"
|
91
|
-
opts.on("--directory DIR", "-d", String, "The website directory (default: the current directory)") {
|
91
|
+
opts.on("--directory DIR", "-d", String, "The website directory (default: the current directory)") {|p| @directory = p}
|
92
92
|
opts.on("--verbose", "-v", "Print more output") { @verbosity = :verbose }
|
93
93
|
opts.on("--quiet", "-q", "No output") { @verbosity = :quiet }
|
94
|
-
opts.on("--log-level LEVEL", "-l", Integer, "The logging level (0..debug, 3..error)") {
|
95
|
-
opts.on("--log-filter", "-f", Regexp, 'Filter for logging events') {
|
94
|
+
opts.on("--log-level LEVEL", "-l", Integer, "The logging level (0..debug, 3..error)") {|p| @log_level = p}
|
95
|
+
opts.on("--log-filter", "-f", Regexp, 'Filter for logging events') {|p| @log_filter = p}
|
96
96
|
end
|
97
97
|
self.add_command(CmdParse::HelpCommand.new)
|
98
98
|
self.add_command(CmdParse::VersionCommand.new)
|
99
99
|
Webgen::CLI.constants.select {|c| c =~ /.+Command$/ }.each do |c|
|
100
|
-
self.add_command(Webgen::CLI.const_get(c).new, (c == 'RunCommand' ? true : false))
|
100
|
+
self.add_command(Webgen::CLI.const_get(c).new, (c.to_s == 'RunCommand' ? true : false))
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
data/lib/webgen/configuration.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'facets/symbol/to_proc'
|
2
|
+
|
1
3
|
module Webgen
|
2
4
|
|
3
5
|
# Stores the configuration for a webgen website.
|
@@ -99,7 +101,7 @@ module Webgen
|
|
99
101
|
# Complete +sh_name+ by checking if a source handler called
|
100
102
|
# <tt>Webgen::SourceHandler::SH_NAME</tt> exists.
|
101
103
|
def complete_source_handler_name(sh_name)
|
102
|
-
(Webgen::SourceHandler.constants.include?(sh_name) ? 'Webgen::SourceHandler::' + sh_name : sh_name)
|
104
|
+
(Webgen::SourceHandler.constants.map(&:to_s).include?(sh_name) ? 'Webgen::SourceHandler::' + sh_name : sh_name)
|
103
105
|
end
|
104
106
|
private :complete_source_handler_name
|
105
107
|
|
@@ -150,6 +150,7 @@ config.contentprocessor.tags.map({
|
|
150
150
|
'date' => 'Webgen::Tag::Date',
|
151
151
|
'sitemap' => 'Webgen::Tag::Sitemap',
|
152
152
|
'tikz' => 'Webgen::Tag::TikZ',
|
153
|
+
'link' => 'Webgen::Tag::Link',
|
153
154
|
:default => 'Webgen::Tag::Metainfo'
|
154
155
|
}, :doc => 'Tag processor name to class map')
|
155
156
|
|
@@ -200,6 +201,9 @@ config.tag.tikz.resolution('72 72', :doc => 'A string specifying the render and
|
|
200
201
|
config.tag.tikz.transparent(false, :doc => 'Specifies whether the generated image should be transparent (only png)')
|
201
202
|
config.tag.tikz.img_attr({}, :doc => 'A hash of additional HTML attributes for the created img tag')
|
202
203
|
|
204
|
+
config.tag.link.path(nil, :doc => 'The (A)LCN path to which a link should be generated', :mandatory => 'default')
|
205
|
+
config.tag.link.attr({}, :doc => 'A hash of additional HTML attributes that should be set on the link')
|
206
|
+
|
203
207
|
# All things regarding common functionality
|
204
208
|
website.autoload_service(:create_sitemap, 'Webgen::Common::Sitemap')
|
205
209
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'facets/symbol/to_proc'
|
1
2
|
require 'webgen/websiteaccess'
|
2
3
|
require 'webgen/loggable'
|
3
4
|
require 'webgen/page'
|
@@ -163,7 +164,7 @@ module Webgen::SourceHandler
|
|
163
164
|
Webgen::WebsiteAccess.website.config['sourcehandler.default_lang_in_output_path'] ||
|
164
165
|
Webgen::WebsiteAccess.website.config['website.lang'] != path.meta_info['lang']
|
165
166
|
end
|
166
|
-
if OutputPathHelpers.public_instance_methods(false).include?(method)
|
167
|
+
if OutputPathHelpers.public_instance_methods(false).map(&:to_s).include?(method)
|
167
168
|
name = send(method, parent, path, use_lang_part)
|
168
169
|
name += '/' if path.path =~ /\/$/ && name !~ /\/$/
|
169
170
|
if (node = node_exists?(parent, path, name)) && node.lang == path.meta_info['lang']
|
data/lib/webgen/tag.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Webgen::Tag
|
2
|
+
|
3
|
+
# Create a link to a given (A)LCN.
|
4
|
+
class Link
|
5
|
+
|
6
|
+
include Webgen::Tag::Base
|
7
|
+
|
8
|
+
# Return a HTML link to the given (A)LCN.
|
9
|
+
def call(tag, body, context)
|
10
|
+
if (dest_node = context.ref_node.resolve(param('tag.link.path'), context.dest_node.lang))
|
11
|
+
context.dest_node.link_to(dest_node, param('tag.link.attr').merge(:lang => context.content_node.lang))
|
12
|
+
else
|
13
|
+
raise ArgumentError, 'Resolving of path failed'
|
14
|
+
end
|
15
|
+
rescue ArgumentError, URI::InvalidURIError => e
|
16
|
+
log(:error) { "Could not link to path '#{param('tag.link.path')}' in <#{context.ref_node.absolute_lcn}>: #{e.message}" }
|
17
|
+
context.dest_node.flag(:dirty)
|
18
|
+
''
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/lib/webgen/version.rb
CHANGED
data/lib/webgen/website.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'logger'
|
3
3
|
require 'set'
|
4
4
|
require 'fileutils'
|
5
|
+
require 'facets/symbol/to_proc'
|
5
6
|
|
6
7
|
# Requirements for Website
|
7
8
|
require 'webgen/coreext'
|
@@ -197,7 +198,7 @@ module Webgen
|
|
197
198
|
raise 'Structure of config file is not valid, has to be a Hash' if !config.kind_of?(Hash)
|
198
199
|
config.each do |key, value|
|
199
200
|
case key
|
200
|
-
when *Webgen::Configuration::Helpers.public_instance_methods(false) then @config.send(key, value)
|
201
|
+
when *Webgen::Configuration::Helpers.public_instance_methods(false).map(&:to_s) then @config.send(key, value)
|
201
202
|
else @config[key] = value
|
202
203
|
end
|
203
204
|
end
|
data/test/test_cli.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'webgen/cli'
|
3
|
+
|
4
|
+
class TestCLICommandParser < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_initialize
|
7
|
+
cli = Webgen::CLI::CommandParser.new
|
8
|
+
assert_equal('render', cli.main_command.default_command)
|
9
|
+
assert_equal(:normal, cli.verbosity)
|
10
|
+
assert_equal(Logger::WARN, cli.log_level)
|
11
|
+
assert_equal(Dir.pwd, cli.directory)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
data/test/test_node.rb
CHANGED
@@ -203,9 +203,8 @@ class TestNode < Test::Unit::TestCase
|
|
203
203
|
node.unflag(:dirty_meta_info)
|
204
204
|
node.node_info[:used_meta_info_nodes] << node.absolute_lcn
|
205
205
|
node.node_info[:used_meta_info_nodes] << 'unknown alcn'
|
206
|
-
node.node_info[:used_meta_info_nodes] << @tree.dummy_root.absolute_lcn
|
207
206
|
assert(node.meta_info_changed?)
|
208
|
-
assert_equal(
|
207
|
+
assert_equal(1, calls)
|
209
208
|
end
|
210
209
|
|
211
210
|
def test_method_missing
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'helper'
|
3
|
+
require 'webgen/tree'
|
4
|
+
require 'webgen/contentprocessor'
|
5
|
+
require 'webgen/tag'
|
6
|
+
|
7
|
+
class TestTagLink < Test::Unit::TestCase
|
8
|
+
|
9
|
+
include Test::WebsiteHelper
|
10
|
+
|
11
|
+
def setup
|
12
|
+
super
|
13
|
+
@obj = Webgen::Tag::Link.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(context)
|
17
|
+
@obj.call('link', '', context)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_call
|
21
|
+
root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/')
|
22
|
+
node = Webgen::Node.new(root, '/file.html', 'file.html', {'lang' => 'en'})
|
23
|
+
dir = Webgen::Node.new(root, '/dir/', 'dir/', 'index_path' => "index.html")
|
24
|
+
file = Webgen::Node.new(dir, '/dir/file.html', 'file.html', {'lang' => 'en', 'title' => 'Dir/File'})
|
25
|
+
Webgen::Node.new(dir, '/dir/other.de.html', 'other.html', {'lang' => 'de'})
|
26
|
+
Webgen::Node.new(file, '/dir/file.html#fragment', '#fragment')
|
27
|
+
dir2 = Webgen::Node.new(root, '/dir2/', 'dir2/', 'index_path' => "index.html")
|
28
|
+
Webgen::Node.new(dir2, '/dir2/index.html', 'index.html')
|
29
|
+
|
30
|
+
context = Webgen::ContentProcessor::Context.new(:chain => [node])
|
31
|
+
|
32
|
+
# no path set
|
33
|
+
node.unflag(:dirty)
|
34
|
+
@obj.set_params('tag.link.path' => nil)
|
35
|
+
assert_equal('', call(context))
|
36
|
+
assert(node.flagged(:dirty))
|
37
|
+
|
38
|
+
# invalid paths
|
39
|
+
@obj.set_params('tag.link.path' => ':/asdf=-)')
|
40
|
+
assert_equal('', call(context))
|
41
|
+
|
42
|
+
# basic node resolving
|
43
|
+
@obj.set_params('tag.link.path' => 'dir/file.html')
|
44
|
+
assert_equal('<a href="dir/file.html">Dir/File</a>', call(context))
|
45
|
+
@obj.set_params('tag.link.path' => 'dir/file.html', 'tag.link.attr' => {'title' => 'other'})
|
46
|
+
assert_equal('<a href="dir/file.html" title="other">Dir/File</a>', call(context))
|
47
|
+
@obj.set_params('tag.link.path' => 'dir/other.html')
|
48
|
+
assert_equal('', call(context))
|
49
|
+
|
50
|
+
# non-existing fragments
|
51
|
+
@obj.set_params('tag.link.path' => 'file.html#hallo')
|
52
|
+
assert_equal('', call(context))
|
53
|
+
|
54
|
+
# directory paths
|
55
|
+
@obj.set_params('tag.link.path' => 'dir')
|
56
|
+
assert_equal('<a href="dir/"></a>', call(context))
|
57
|
+
@obj.set_params('tag.link.path' => 'dir2')
|
58
|
+
assert_equal('<a href="dir2/index.html"></a>', call(context))
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/test/test_tree.rb
CHANGED
@@ -13,11 +13,13 @@ class TestTree < Test::Unit::TestCase
|
|
13
13
|
|
14
14
|
def test_initialize
|
15
15
|
assert_not_nil(@tree.dummy_root)
|
16
|
+
assert_equal('', @tree.dummy_root.absolute_lcn)
|
16
17
|
end
|
17
18
|
|
18
19
|
def test_root
|
19
20
|
root = Webgen::Node.new(@tree.dummy_root, '/', '/')
|
20
21
|
assert_equal(root, @tree.root)
|
22
|
+
assert_equal('/', root.absolute_lcn)
|
21
23
|
end
|
22
24
|
|
23
25
|
def test_register_node_and_register_path
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gettalong-webgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6.20081020
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-19 15:00:00 -07:00
|
13
13
|
default_executable: webgen
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -395,6 +395,7 @@ files:
|
|
395
395
|
- doc/tag/executecommand.page
|
396
396
|
- doc/tag/includefile.page
|
397
397
|
- doc/tag/langbar.page
|
398
|
+
- doc/tag/link.page
|
398
399
|
- doc/tag/menu.page
|
399
400
|
- doc/tag/metainfo.page
|
400
401
|
- doc/tag/relocatable.page
|
@@ -460,6 +461,7 @@ files:
|
|
460
461
|
- lib/webgen/tag/executecommand.rb
|
461
462
|
- lib/webgen/tag/includefile.rb
|
462
463
|
- lib/webgen/tag/langbar.rb
|
464
|
+
- lib/webgen/tag/link.rb
|
463
465
|
- lib/webgen/tag/menu.rb
|
464
466
|
- lib/webgen/tag/metainfo.rb
|
465
467
|
- lib/webgen/tag/relocatable.rb
|
@@ -486,6 +488,7 @@ files:
|
|
486
488
|
- misc/images/quote.gif
|
487
489
|
- test/test_blackboard.rb
|
488
490
|
- test/test_cache.rb
|
491
|
+
- test/test_cli.rb
|
489
492
|
- test/test_common_sitemap.rb
|
490
493
|
- test/test_configuration.rb
|
491
494
|
- test/test_contentprocessor.rb
|
@@ -530,6 +533,7 @@ files:
|
|
530
533
|
- test/test_tag_executecommand.rb
|
531
534
|
- test/test_tag_includefile.rb
|
532
535
|
- test/test_tag_langbar.rb
|
536
|
+
- test/test_tag_link.rb
|
533
537
|
- test/test_tag_menu.rb
|
534
538
|
- test/test_tag_metainfo.rb
|
535
539
|
- test/test_tag_relocatable.rb
|