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.6 by root, Mon Aug 14 02:08:30 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/src/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;
54} 60}
55 61
56sub view_seq_link { 62sub view_seq_link {
57 my (undef, $link) = @_; 63 my (undef, $link) = @_;
58 64
59 # TODO: 65 my $text = $link =~ s/^(.*)\|// ? $1 : $link;
60 # http://...
61 # ref
62 # pod/ref
63 66
67 if ($link =~ /http:/) {
64 "<u>" . (::asxml $_[1]) . "</u>"; 68 "<u>" . (::asxml $link) . "</u>"
69 } elsif ($link =~ /^\$ARCH\/(.+)$/) {
70 my $path = $1;
71 (my $base = $path) =~ s/.*\///;
72 -f "$ARCH/$path" && system "rsync -av -c \Q$ARCH/$path\E \Qresources/arch/$base";
73 "${MA_BEG}image${MA_SEP}arch/$base$MA_END"
74 } else {
75 "${MA_BEG}link$MA_SEP$text$MA_SEP$link$MA_END"
76 }
65} 77}
66 78
67sub view_item { 79sub view_item {
68 push @result, { 80 push @result, {
69 indent => $indent * 8, 81 indent => $indent * 8,
144sub view_for { 156sub view_for {
145 if ($_[1]->format eq "image") { 157 if ($_[1]->format eq "image") {
146 push @result, { 158 push @result, {
147 indent => $indent * 16, 159 indent => $indent * 16,
148 level => $level, 160 level => $level,
149 markup => "\x{fffc}", 161 markup => "${MA_BEG}image${MA_SEP}pod/" . $_->text . $MA_END,
150 widget => [["CFPlus::UI::Image" => path => "pod/" . $_[1]->text]],
151 }; 162 };
152 } 163 }
153 () 164 ()
154} 165}
155 166
179 190
180sub add_node($) { 191sub add_node($) {
181 my ($node) = @_; 192 my ($node) = @_;
182 193
183 for (@{ $node->{kw} || {} }) { 194 for (@{ $node->{kw} || {} }) {
184 push @{$wiki{$_}}, $node; 195 push @{$wiki{lc $_}}, $node;
185 } 196 }
186} 197}
187 198
188my $root = { 199my $root = {
189 kw => ["pod"], 200 kw => ["pod"],

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines