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.16 by root, Sun Mar 30 13:02:27 2008 UTC vs.
Revision 1.19 by root, Mon May 5 17:07:13 2008 UTC

1#! perl 1#! perl
2 2
3# convert given .pod files to wiki style 3# convert given .pod files to wiki style
4 4
5# base path of arch tree, only used for new arch graphics 5# base path of arch tree, only used for new arch graphics
6my $ARCH = "/root/devel/cvs/cf.schmorp.de/arch"; 6my $ARCH = "/root/src/cf.schmorp.de/arch";
7 7
8use strict; 8use strict;
9 9
10use Storable; 10use Storable;
11use Pod::POM; 11use Pod::POM;
77} 77}
78 78
79sub view_seq_link { 79sub view_seq_link {
80 my (undef, $link) = @_; 80 my (undef, $link) = @_;
81 81
82 my $text = $link =~ s/^(.*)\|// ? $1 : $link; 82 $link =~ s/^(.*)\|//
83 or $link =~ /([^\/]*)$/;
84
85 my $text = $1;
83 86
84 if ($link =~ /http:/) { 87 if ($link =~ /http:/) {
85 "<u>" . (::asxml $link) . "</u>" 88 "<u>" . (::asxml $link) . "</u>"
86 } elsif ($link =~ /^\$ARCH\/(.+)$/) { 89 } elsif ($link =~ /^\$ARCH\/(.+\....)$/) {
87 my $path = $1; 90 my $file = $1;
88 (my $base = $path) =~ s/.*\///; 91
89 -f "$ARCH/$path" && system "rsync -av -c \Q$ARCH/$path\E \Qresources/arch/$base"; 92 unless (-f "resources/arch/$file.png") {
93 print "ARCHIMG $file is missing, trying to supply... ";
94 my ($path) = split /\x00/, qx<find \Q$ARCH\E -name \Q$file.64x64.png*\E -print0>;
95 -f $path or die "$file: could not find arch image";
96 print "$path\n";
97 system "rsync -a \Q$path\E resources/arch/\Q$file.png"
98 and die "rsync failed: $?";
99 system "cvs add -kb resources/arch/\Q$file.png"
100 and ((unlink "resources/arch/$file.png"), die "cvs add failed: $?");
101 }
102
90 ::special image => "arch/$base", 1; 103 ::special image => "arch/$file.png", 1;
91 } else { 104 } else {
92 ::special link => $text, $link 105 ::special link => $text, $link
93 } 106 }
94} 107}
95 108
193 [grep $_->[P_INDEX] || defined $_->[P_MARKUP], @result] 206 [grep $_->[P_INDEX] || defined $_->[P_MARKUP], @result]
194} 207}
195 208
196############################################################################# 209#############################################################################
197 210
211$| = 1;
212
198my %wiki; 213my %wiki;
199 214
200sub add_node($) { 215sub add_node($) {
201 my ($node) = @_; 216 my ($node) = @_;
202 217
203 for (@{ $node->[N_KW] || {} }) { 218 for (@{ $node->[N_KW] || {} }) {
204 push @{$wiki{lc $_}}, $node; 219 push @{$wiki{$_}}, $node;
205 } 220 }
206} 221}
207 222
208my $root; 223my $root;
209$root->[N_KW] = ["Documents", "pod"]; 224$root->[N_KW] = ["Documents", "pod"];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines