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 |
6 | my $ARCH = "/root/devel/cvs/cf.schmorp.de/arch"; |
6 | my $ARCH = "/root/src/cf.schmorp.de/arch"; |
7 | |
7 | |
8 | use strict; |
8 | use strict; |
9 | |
9 | |
10 | use Storable; |
10 | use Storable; |
11 | use Pod::POM; |
11 | use Pod::POM; |
… | |
… | |
77 | } |
77 | } |
78 | |
78 | |
79 | sub view_seq_link { |
79 | sub 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 | |
198 | my %wiki; |
213 | my %wiki; |
199 | |
214 | |
200 | sub add_node($) { |
215 | sub 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 | |
208 | my $root; |
223 | my $root; |
209 | $root->[N_KW] = ["Documents", "pod"]; |
224 | $root->[N_KW] = ["Documents", "pod"]; |