1 |
package suikawiki; |
2 |
use strict; |
3 |
require 'util.pl'; |
4 |
require 'gfilter.pl'; |
5 |
|
6 |
sub mediatype () { q#text/x-suikawiki; version=0.9# } |
7 |
|
8 |
sub status () { 'yes' } |
9 |
|
10 |
sub recursive () { 0 } |
11 |
|
12 |
sub pre_codeconv () { 1 } |
13 |
|
14 |
sub post_codeconv () { 0 } |
15 |
|
16 |
sub add_magic ($) { |
17 |
my $magic = shift; |
18 |
$magic->addSpecials('text/x-suikawiki; version=0.9', '#?SuikaWiki/0.9'); |
19 |
} |
20 |
|
21 |
sub filter ($$$$$) { |
22 |
my ($orig_cfile, $contref, $weighted_str, $headings, $fields) = @_; |
23 |
my $cfile = ref $orig_cfile ? $$orig_cfile : ''; |
24 |
|
25 |
util::vprint ("Processing SuikaWiki/0.9 file ...\n"); |
26 |
$$contref =~ s/^\#\?[^\x0D\x0A]+[\x0D\x0A]+//s; ## Remove magic line |
27 |
|
28 |
if ($cfile =~ /([0-9A-F]+)\.txt/) { ## Get title from filename |
29 |
$fields->{title} = $1; |
30 |
$fields->{title} =~ s/([0-9A-F]{2})/chr hex $1/ge; |
31 |
} |
32 |
$fields->{author} = 'Wiki people'; |
33 |
my $weight = $conf::Weight{html}->{title}; |
34 |
$$weighted_str .= "\x7F$weight\x7F$fields->{title}\x7F/$weight\x7F\n"; |
35 |
return undef; |
36 |
} |
37 |
|
38 |
=head1 NAME |
39 |
|
40 |
suikawiki.pl --- Namazu: (totemo tenuki na) filter for SuikaWiki/0.9 documents |
41 |
|
42 |
=head1 DESCRIPTION |
43 |
|
44 |
This perl script is the filter for Wiki pages in SuikaWiki/0.9 format. |
45 |
|
46 |
=head1 TO DO |
47 |
|
48 |
SuikaWiki notations -> weighted-string |
49 |
|
50 |
=head1 LICENSE |
51 |
|
52 |
Copyright 2002 Wakaba <w@suika.fam.cx>. |
53 |
|
54 |
This program is free software; you can redistribute it and/or modify |
55 |
it under the terms of the GNU General Public License as published by |
56 |
the Free Software Foundation; either version 2 of the License, or |
57 |
(at your option) any later version. |
58 |
|
59 |
This program is distributed in the hope that it will be useful, |
60 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
61 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
62 |
GNU General Public License for more details. |
63 |
|
64 |
You should have received a copy of the GNU General Public License |
65 |
along with this program; see the file COPYING. If not, write to |
66 |
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
67 |
Boston, MA 02111-1307, USA. |
68 |
|
69 |
=cut |
70 |
|
71 |
1; # $Date: $ |