Skip to content

Instantly share code, notes, and snippets.

@ctyo
Created July 13, 2012 17:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ctyo/3106157 to your computer and use it in GitHub Desktop.
Save ctyo/3106157 to your computer and use it in GitHub Desktop.
FreeStyleWiki上でMarkdown記法での記入を可能にするプラグイン
############################################################
#
# FreeStyleWiki上でMarkdown記法での記入を可能にします。
#
############################################################
package plugin::markdown::Install;
use strict;
sub install {
my $wiki = shift;
$wiki->add_block_plugin(
"markdown", "plugin::markdown::Markdown", "HTML");
}
1;
############################################################
#
# <p>FreeStyleWiki上でMarkdown記法での記入を可能にします。</p>
# <pre>
# {{markdown
# something markdown text
# anything markdown text
# }}
# </pre>
# <p>なお利用するには <a href="http://search.cpan.org/~bobtfish/Text-Markdown-1.000031/lib/Text/Markdown.pm">Text::Markdown</a> が必要です。<br />
#
# 2012.07.14 A.Tatsukawa [Website](http://ctyo.info)</p>
#
############################################################
package plugin::markdown::Markdown;
use strict;
use Text::Markdown qw/markdown/;
#===========================================================
# コンストラクタ
#===========================================================
sub new {
my $class = shift;
my $self = {};
return bless $self,$class;
}
#===========================================================
# ブロック内を処理
#===========================================================
sub block {
my $self = shift;
my $wiki = shift;
my $wiki_source = shift;
return markdown($wiki_source);
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment