YukiWiki

Perlで書かれたCGIスクリプトであるWiki

改造したところ

ありすぎてもう憶えてないので、そのうちDIFFとってちゃんと調べます。

でっち上げたプラグイン

cpan

SYNOPSIS

Perlモジュール名にCPANにあるモジュールのドキュメントのページへのリンクを付加します。

USAGE

&cpan(Acme::MorningMusume)

CODE

# YukiWiki plugin: cpan.pl
#
# Copyright (C) 2005 Kyo Nagashima <kyo&#64;hail2u.net>, http://hail2u.net/
#
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.

use strict;

package cpan;

sub plugin_inline {
  my($escaped_argument) = @_;

  my($module) = split(/,/, $escaped_argument);

  if ($module =~ /^[a-zA-Z][\w:]*$/) {
    (my $dist = $module) =~ s/::/-/g;

    return qq(<a href="http://search.cpan.org/search?module=$module" class="external">$module</a>);
  } else {
    return qq(&cpan($escaped_argument));
  }
}

sub plugin_usage {
  return {
    name        => 'cpan',
    version     => '1.0',
    author      => 'Kyo Nagashima <kyo@hail2u.net>',
    syntax      => '&cpan(module)',
    description => 'Create link to CPAN documents for given Perl module.',
    example     => "This script required &cpan(XML::Simple).",
  };
}

1;

img

SYNOPSIS

指定文字列をalt属性の値としたimg要素を挿入します。

USAGE

&img(all about blosxomのロゴ画像,http://blosxom.info/images/blosxom.png)

CODE

# YukiWiki plugin: img.pl
#
# Copyright (C) 2005 Kyo Nagashima <kyo&#64;hail2u.net>, http://hail2u.net/
#
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.

use strict;

package img;

sub plugin_inline {
  my($escaped_argument) = @_;

  my($alt, $url) = split(/,/, $escaped_argument);

  if ($url =~ /^https?:.*\.(gif|png|jpeg|jpg)$/) {
    return qq(<a href="$url"><img src="$url" alt="$alt" /></a>);
  } else {
    return qq(&img($escaped_argument));
  }
}

sub plugin_usage {
  return {
    name        => 'img',
    version     => '1.0',
    author      => 'Kyo Nagashima <kyo@hail2u.net>',
    syntax      => '&img(alt,url)',
    description => 'Embed an image with given altenate text.',
    example     => '&img(Screenshot,http://example.com/screenshot.png)',
  };
}

1;

linkimg

SYNOPSIS

指定文字列をalt属性の値としたimg要素を挿入し、更にその画像に指定URLでリンクを張ります。

USAGE

&linkimg(all about blosxomのロゴ画像,http://blosxom.info/images/blosxom.png,http://blosxom.info/)

CODE

# YukiWiki plugin: linkimg.pl
#
# Copyright (C) 2005 Kyo Nagashima <kyo&#64;hail2u.net>, http://hail2u.net/
#
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.

use strict;

package linkimg;

sub plugin_inline {
  my($escaped_argument) = @_;

  my($alt, $imgurl, $url) = split(/,/, $escaped_argument);

  if ($imgurl =~ /^https?:.*\.(gif|png|jpeg|jpg)$/) {
    return qq(<a href="$url"><img src="$imgurl" alt="$alt" /></a>);
  } else {
    return qq(&img($escaped_argument));
  }
}

sub plugin_usage {
  return {
    name        => 'linkimg',
    version     => '1.0',
    author      => 'Kyo Nagashima <kyo@hail2u.net>',
    syntax      => '&linkimg(alt,imgurl,url)',
    description => 'Embed an image with given altenate text and URL.',
    example     => '&img(Screenshot,http://example.com/screenshot.png,http://example.com/)',
  };
}

1;

Last-Modified: 2006-11-21T18:34:37+09:00