ModifierTest02

構成

$MT_DIR/
|__ plugins/
|  |__ ModifierTest02/
|     |__ config.yaml
|     |__ lib/
|     |  |__ ModifierTest02
|            |__ Tag.pm
 
 
 

ソース

config.yaml

id: ModifierTest02
key: ModifierTest02
name: ModifierTest02
tags:
    function:
        ModifierFuncTest02: $ModifierTest02::ModifierTest02::Tag::_hdlr_function
    modifier:
        link : $ModifierTest02::ModifierTest02::Tag::_hdlr_modifier
 
 

lib/ModifierTest02/Tag.pm

package ModifierTest02::Tag;
 
use strict;
 
# モディファイア
sub _hdlr_modifier{
 
    # 引数
    my ($text, $arg, $ctx) = @_;
 
    # 引数を取得できない場合はそのまま抜ける
    if(!$arg){
        return $text;
    }
    my $link = $arg;
 
    # 値編集
    my $res_text = "<a href=\"$link\">$text</a>";
 
    # 返却
    return $res_text;
}
 
# ファンクションタグ
sub _hdlr_function{
 
    # 引数を取得
    my ($ctx, $args) = @_;
 
    # 結果を返却
    return "ModifierTest02";
}
 
1;
 
 



最終更新:2012年03月08日 23:45