--- deliantra/Deliantra-Client/bin/pod2wiki 2006/08/13 18:48:57 1.3 +++ deliantra/Deliantra-Client/bin/pod2wiki 2006/09/09 23:31:58 1.10 @@ -1,11 +1,13 @@ #! perl -use Storable; - # convert given .pod files to wiki style +# base path of arch tree, only used for new arch graphics +my $ARCH = "/root/devel/cvs/cf.schmorp.de/arch"; + use strict; +use Storable; use Pod::POM; our @result; @@ -37,6 +39,10 @@ $_ } +sub special { + $MA_BEG . (join $MA_SEP, @_) . $MA_END +} + package AsParagraphs; use strict; @@ -60,10 +66,17 @@ sub view_seq_link { my (undef, $link) = @_; + my $text = $link =~ s/^(.*)\|// ? $1 : $link; + if ($link =~ /http:/) { "" . (::asxml $link) . "" + } elsif ($link =~ /^\$ARCH\/(.+)$/) { + my $path = $1; + (my $base = $path) =~ s/.*\///; + -f "$ARCH/$path" && system "rsync -av -c \Q$ARCH/$path\E \Qresources/arch/$base"; + ::special image => "arch/$base", 1; } else { - "${MA_BEG}link${MA_SEP}$link$MA_END" + ::special link => $text, $link } } @@ -73,7 +86,7 @@ level => $level, }; my $title = $_[1]->title->present ($_[0]); - $result[-1]{markup} = "$title\n\n" if length $title; + $result[-1]{markup} = "$title\n" if length $title; $title = ::flatten $title; unshift @{ $result[-1]{index} }, $title if length $title; local $level = $level + 1; $_[1]->content->present ($_[0]); @@ -149,12 +162,16 @@ push @result, { indent => $indent * 16, level => $level, - markup => "${MA_BEG}image${MA_SEP}pod/" . $_->text . $MA_END, + markup => (::special image => "pod/" . $_->text), }; } () } +sub view_begin { + () +} + sub view { my ($self, $type, $item) = @_; @@ -183,7 +200,7 @@ my ($node) = @_; for (@{ $node->{kw} || {} }) { - push @{$wiki{$_}}, $node; + push @{$wiki{lc $_}}, $node; } }