# Blosxom Plugin: url_hash # Author: KITAMURA Akatsuki # Version: 2007-02-16 # Blosxom Home/Docs/Licensing: http://www.blosxom.com/ # This script is encoded in UTF-8. package url_hash; use strict; # --- Configurable Variables ----------- # 記事URL(permalink)のテンプレート my $url_tmpl = '$url$path/$fn.htm'; # --- Plug-in package variables -------- use vars qw( $md5 ); # -------------------------------------- sub start { 1; } sub story { my $story_ref = $_[3]; return 1 if ($$story_ref !~ /\$url_hash::md5/); my $url = &$blosxom::interpolate($url_tmpl); require Digest::MD5; $md5 = Digest::MD5::md5_hex($url); 1; } 1; __END__ =encoding utf8 =head1 NAME Blosxom Plugin: url_hash =head1 SYNOPSIS 記事URL(permalink)のハッシュ値をテンプレートで使うための プラグインです。 今のところMD5のみの対応です。Digest::MD5モジュールが必要です。 =head1 CONFIGURATION blosxomのテンプレート変数を用いて、記事URLの構造を $url_tmpl に設定してください。 値はシングルクォートで囲んでください。 例: # カテゴリベースのURL $url_tmpl = '$url$path/$fn.htm'; # 日付ベースのURL $url_tmpl = '$url/$yr/$mo_num/$da#$fn'; 変数は、storyテンプレートの文脈で展開されます。 &$blosxom::interpolate を使って変数を展開するので、 interpolateサブルーチンを上書きするプラグインを使っている場合は、 ご注意下さい。 =head1 DESCRIPTION storyテンプレート用の変数として、以下のものを使うことができます。 $url_hash::md5 : 記事URLのMD5ハッシュ値(十六進形式) =head1 VERSION 2007-02-16 =head1 AUTHOR 北村曉 (KITAMURA Akatsuki) , http://www.akatsukinishisu.net/ =head1 SEE ALSO Blosxom Home/Docs/Licensing: http://www.blosxom.com/ Blosxom Plugin Docs: http://www.blosxom.com/plugins/ =head1 LICENSE This Blosxom Plug-in Copyright (c) 2007, KITAMURA Akatsuki Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.