--- deliantra/Deliantra-Client/bin/pod2wiki 2006/08/13 03:20:56 1.2
+++ deliantra/Deliantra-Client/bin/pod2wiki 2006/09/09 23:31:58 1.10
@@ -1,17 +1,23 @@
#! 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;
our $indent;
our $level;
+my $MA_BEG = "\x{fcd0}";
+my $MA_SEP = "\x{fcd1}";
+my $MA_END = "\x{fcd2}";
+
sub asxml($) {
local $_ = $_[0];
@@ -33,6 +39,10 @@
$_
}
+sub special {
+ $MA_BEG . (join $MA_SEP, @_) . $MA_END
+}
+
package AsParagraphs;
use strict;
@@ -56,12 +66,18 @@
sub view_seq_link {
my (undef, $link) = @_;
- # TODO:
- # http://...
- # ref
- # pod/ref
+ my $text = $link =~ s/^(.*)\|// ? $1 : $link;
- "" . (::asxml $_[1]) . "";
+ 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 {
+ ::special link => $text, $link
+ }
}
sub view_item {
@@ -70,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]);
@@ -146,13 +162,16 @@
push @result, {
indent => $indent * 16,
level => $level,
- markup => "\x{fffc}",
- widget => [["CFPlus::UI::Image" => path => "pod/" . $_[1]->text]],
+ markup => (::special image => "pod/" . $_->text),
};
}
()
}
+sub view_begin {
+ ()
+}
+
sub view {
my ($self, $type, $item) = @_;
@@ -181,7 +200,7 @@
my ($node) = @_;
for (@{ $node->{kw} || {} }) {
- push @{$wiki{$_}}, $node;
+ push @{$wiki{lc $_}}, $node;
}
}