ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/pod2wiki
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/pod2wiki (file contents):
Revision 1.2 by root, Sun Aug 13 03:20:56 2006 UTC vs.
Revision 1.8 by root, Mon Aug 14 18:46:08 2006 UTC

1#! perl 1#! perl
2 2
3# convert given .pod files to wiki style
4
5# base path of arch tree, only used for new arch graphics
6my $ARCH = "/root/devel/cvs/cf.schmorp.de/arch";
7
8use strict;
9
3use Storable; 10use Storable;
4
5# convert given .pod files to wiki style
6
7use strict;
8
9use Pod::POM; 11use Pod::POM;
10 12
11our @result; 13our @result;
12our $indent; 14our $indent;
13our $level; 15our $level;
16
17my $MA_BEG = "\x{fcd0}";
18my $MA_SEP = "\x{fcd1}";
19my $MA_END = "\x{fcd2}";
14 20
15sub asxml($) { 21sub asxml($) {
16 local $_ = $_[0]; 22 local $_ = $_[0];
17 23
18 s/&/&/g; 24 s/&/&/g;
29 s/^\s+//; 35 s/^\s+//;
30 s/\s+$//; 36 s/\s+$//;
31 s/\s+/ /g; 37 s/\s+/ /g;
32 38
33 $_ 39 $_
40}
41
42sub special {
43 $MA_BEG . (join $MA_SEP, @_) . $MA_END
34} 44}
35 45
36package AsParagraphs; 46package AsParagraphs;
37 47
38use strict; 48use strict;
54} 64}
55 65
56sub view_seq_link { 66sub view_seq_link {
57 my (undef, $link) = @_; 67 my (undef, $link) = @_;
58 68
59 # TODO: 69 my $text = $link =~ s/^(.*)\|// ? $1 : $link;
60 # http://...
61 # ref
62 # pod/ref
63 70
71 if ($link =~ /http:/) {
64 "<u>" . (::asxml $_[1]) . "</u>"; 72 "<u>" . (::asxml $link) . "</u>"
73 } elsif ($link =~ /^\$ARCH\/(.+)$/) {
74 my $path = $1;
75 (my $base = $path) =~ s/.*\///;
76 -f "$ARCH/$path" && system "rsync -av -c \Q$ARCH/$path\E \Qresources/arch/$base";
77 ::special image => "arch/$base", 1;
78 } else {
79 ::special link => $text, $link
80 }
65} 81}
66 82
67sub view_item { 83sub view_item {
68 push @result, { 84 push @result, {
69 indent => $indent * 8, 85 indent => $indent * 8,
144sub view_for { 160sub view_for {
145 if ($_[1]->format eq "image") { 161 if ($_[1]->format eq "image") {
146 push @result, { 162 push @result, {
147 indent => $indent * 16, 163 indent => $indent * 16,
148 level => $level, 164 level => $level,
149 markup => "\x{fffc}", 165 markup => (::special image => "pod/" . $_->text),
150 widget => [["CFPlus::UI::Image" => path => "pod/" . $_[1]->text]],
151 }; 166 };
152 } 167 }
153 () 168 ()
154} 169}
155 170
179 194
180sub add_node($) { 195sub add_node($) {
181 my ($node) = @_; 196 my ($node) = @_;
182 197
183 for (@{ $node->{kw} || {} }) { 198 for (@{ $node->{kw} || {} }) {
184 push @{$wiki{$_}}, $node; 199 push @{$wiki{lc $_}}, $node;
185 } 200 }
186} 201}
187 202
188my $root = { 203my $root = {
189 kw => ["pod"], 204 kw => ["pod"],

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines