/[pub]/suikawiki/script/lib/SuikaWiki/Plugin/WikiConst.pm
Suika

Contents of /suikawiki/script/lib/SuikaWiki/Plugin/WikiConst.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Thu Apr 3 01:07:41 2003 UTC (22 years ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
*** empty log message ***

1 wakaba 1.1 ## This file is auto-generated (at 2003-03-21T08:02:45Z).
2     ## Do not edit by hand!
3    
4     =head1 NAME
5    
6     SuikaWiki::Plugin::WikiConst --- SuikaWiki: constance
7     <IW:SuikaWiki:SuikaWiki>
8    
9    
10     =cut
11    
12     package SuikaWiki::Plugin::WikiConst;
13     use strict;
14     our $VERSION = q(2003.0321.0802);
15    
16    
17    
18     sub import {
19     my $self = shift;
20     $self->SuikaWiki::Plugin::regist (qw/wikiformat/);
21     }
22    
23     sub property ($;@) {
24     shift;
25     my %prop = (
26     name => q(SuikaWiki: constance),
27     version => $VERSION,
28     uri => q(IW:SuikaWiki:SuikaWiki),
29     provide => [qw/wikiformat/],
30     partinfo => {
31     q(wikiformat/SuikaWikiConst/0.9-to-HTML) => q(SuikaWikiConst/0.9 document format -> HTML),
32     },
33     );
34     if (scalar @_ == 0) {
35     \%prop;
36     } else {
37     @prop{@_};
38     }
39     }
40     sub load_formatter ($$%) {
41     my $self = shift;
42     my ($fmt, %q) = @_;
43     unless ($q{type}) {
44     #
45     }
46     elsif ($q{type} eq 'wikiformat') {
47     $fmt->{q(SuikaWikiConst/0.9_to_HTML)} = sub { my ($r, $p, $o) = ('', @_);
48     my $data = to_hash ($o->{content});
49     for my $key (sort keys %$data) {
50     if ($o->_database_exist ($key)) {
51     $r .= qq(<dt>@{[$o->_html_wikilink ($key)]}</dt>\n);
52     } else {
53     $r .= qq(<dt>@{[$o->escape ($key)]}</dt>\n);
54     }
55     $r .= qq( <dd>@{[$o->escape ($data->{$key})]}</dd>\n);
56     }
57     $r = qq(<dl class="SuikaWikiConst">$r</dl>) if $r;
58     $r };
59    
60     }
61     } # sub load_formatter
62    
63     sub to_hash ($;$) {
64     my $page = shift;
65     my $h = shift || {};
66     my $val;
67     for my $line (split /\n/, $page) {
68     next if $line =~ /^#/;
69     $line =~ tr/\x0A\x0D//d;
70     if ($val && $line =~ s/^\s+\\?//) {
71     $h->{$val} .= length $h->{$val} ? "\n" . $line : $line;
72     } elsif ($line =~ /^(.+):/) {
73     $val = $1; $h->{$val} = '';
74     }
75     }
76     $h;
77     }
78    
79     =head1 LICENSE
80    
81     Copyright 2003 Wakaba <w@suika.fam.cx>
82    
83     This program is free software; you can redistribute it and/or modify
84     it under the terms of the GNU General Public License as published by
85     the Free Software Foundation; either version 2 of the License, or
86     (at your option) any later version.
87    
88     This program is distributed in the hope that it will be useful,
89     but WITHOUT ANY WARRANTY; without even the implied warranty of
90     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
91     GNU General Public License for more details.
92    
93     You should have received a copy of the GNU General Public License
94     along with this program; see the file COPYING. If not, write to
95     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
96     Boston, MA 02111-1307, USA.
97    
98     =cut
99    
100     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24