testfilter.pl

来自「namazu日文检索引擎」· PL 代码 · 共 83 行

PL
83
字号
## -*- Perl -*-# $Id: testfilter.pl,v 1.5 2007/07/02 08:01:24 fumiyas Exp $# Copyright (C) 2000 Namazu Project All rights reserved ,#     This is free software with ABSOLUTELY NO WARRANTY.##  This program is free software; you can redistribute it and/or modify#  it under the terms of the GNU General Public License as published by#  the Free Software Foundation; either versions 2, or (at your option)#  any later version.# #  This program is distributed in the hope that it will be useful#  but WITHOUT ANY WARRANTY; without even the implied warranty of#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the#  GNU General Public License for more details.##  You should have received a copy of the GNU General Public License#  along with this program; if not, write to the Free Software#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA#  02111-1307, USA##  This file must be encoded in EUC-JP encoding#package testfilter;use strict;require 'util.pl';my $dvipath = undef;my $nkfpath = undef;sub mediatype() {    return ('x-test/x-test');}sub status() {    return 'yes';}sub recursive() {    return 0;}sub pre_codeconv() {    return 0;}sub post_codeconv () {    return 0;}sub add_magic ($) {    my $magic = shift @_;    $magic->addMagicEntry("0\tstring\tNamazu-Filter-Test:\tx-test/x-test");    $magic->addFileExts('\\.x-test$', 'x-test/x-test');    return;}sub filter ($$$$$) {    my ($orig_cfile, $contref, $weighted_str, $headings, $fields)      = @_;    my $cfile = defined $orig_cfile ? $$orig_cfile : '';    util::vprint("Processing namazu-filter-test file ... \n");    test_filter($contref, $weighted_str, $fields);    return undef;}sub test_filter {    my ($contref, $weighted_str, $fields) = @_;    if ($$contref =~ s/^Namazu-Filter-Test(?:-.*)?: (.*)\n//m) {	$fields->{'title'} = $1 if defined $1;	$weighted_str .= "\x7f1\x7f$1\x7f/1\x7f\n" if defined $1;    }    $fields->{'author'} = "x-test-author";}1;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?