--- deliantra/Deliantra-Client/DC/Pod.pm 2008/03/25 01:46:36 1.18 +++ deliantra/Deliantra-Client/DC/Pod.pm 2008/03/30 11:31:09 1.22 @@ -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]); @@ -40,10 +44,11 @@ my $kw = lc pop @path; - $node = $node->{parent} + $node = $node->[N_PARENT] or return 0; - return scalar grep $_ eq $kw, @{ $node->{kw} }; + #TODO: maybe get rid of lowercasing? + return scalar grep lc eq $kw, @{ $node->[N_KW] }; } sub find(@) { @@ -67,24 +72,24 @@ my @path; # skip toplevel hierarchy pod/, because its not a document - while ($node->{parent}) { + while ($node->[N_PARENT]) { unshift @path, $node; - $node = $node->{parent}; + $node = $node->[N_PARENT]; } @path } sub full_path($) { - join "/", map $_->{kw}[0], &full_path_of + join "/", map $_->[N_KW][0], &full_path_of } sub section_of($) { my ($node) = @_; - my $doc = $node->{doc}; - my $par = $node->{par}; - my $lvl = $node->{level}; + my $doc = $node->[N_DOC]; + my $par = $node->[N_PAR]; + my $lvl = $node->[N_LEVEL]; my @res; @@ -120,7 +125,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 +166,7 @@ } my %as_paragraphs = ( + %as_common, image => sub { my ($par, $path, $flags) = @_;