--- deliantra/Deliantra-Client/DC/Pod.pm 2008/03/25 02:12:35 1.19
+++ deliantra/Deliantra-Client/DC/Pod.pm 2008/03/30 13:02:26 1.23
@@ -27,7 +27,11 @@
sub P_MARKUP (){ 2 }
sub P_INDEX (){ 3 }
-*wiki = Storable::retrieve DC::find_rcfile "docwiki.pst";
+our %wiki;
+
+sub load_docwiki {
+ *wiki = Storable::retrieve $_[0];
+}
sub goto_document($) {
$goto_document->(split /\//, $_[0]);
@@ -38,7 +42,7 @@
return 1 unless @path;
- my $kw = lc pop @path;
+ my $kw = pop @path;
$node = $node->[N_PARENT]
or return 0;
@@ -51,14 +55,15 @@
return unless @path;
- my $kw = lc pop @path;
+ my $kw = pop @path;
- # TODO: make sure results are unique
+ my %res = map +($_, $_),
+ grep { is_prefix_of $_, @path }
+ map @$_,
+ $kw eq "*" ? values %wiki
+ : $wiki{$kw} || ();
- grep { is_prefix_of $_, @path }
- map @$_,
- $kw eq "*" ? @wiki{sort keys %wiki}
- : $wiki{$kw} || ()
+ values %res
}
sub full_path_of($) {
@@ -66,8 +71,7 @@
my @path;
- # skip toplevel hierarchy pod/, because its not a document
- while ($node->[N_PARENT]) {
+ while ($node) {
unshift @path, $node;
$node = $node->[N_PARENT];
}
@@ -120,7 +124,20 @@
}
}
+my %as_common = (
+ h1 => sub {
+ "\n\n$_[1]\n"
+ },
+ h2 => sub {
+ "\n\n$_[1]\n"
+ },
+ h3 => sub {
+ "\n\n$_[1]\n"
+ },
+);
+
my %as_label = (
+ %as_common,
image => sub {
my ($par, $path) = @_;
@@ -148,6 +165,7 @@
}
my %as_paragraphs = (
+ %as_common,
image => sub {
my ($par, $path, $flags) = @_;