Created
November 13, 2011 16:03
-
-
Save kimarx/1362261 to your computer and use it in GitHub Desktop.
This is a blosxom plugin that allows Blosxom to interprete the syntax of Creole Wiki..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Blosxom Plugin: creole | |
# Author: Kim, Yi-Chul | |
# Last Update: 2011-11-14 01:04+09:00. | |
# This blosxom plugin is based on text_hatena_rev. | |
# Probably you need to rename meta plugin in order to use this plugin. | |
# example: 'mv meta 2meta'. | |
# If you use Emacs, it will be better to visit this Emacs Wiki's page. | |
# Wiki Creole mode for Emacs: | |
# http://manuelp.github.com/emacs/2009/11/03/wikicreole-mode-emacs.html | |
package creole; | |
# use lib "/path/to/dir"; # dir in which Text::WikiCreole installed. | |
# You can find Text::WikiCreole module in CPAN. | |
use strict; | |
use Text::WikiCreole; | |
# --- Configurable variables ----------- | |
# Do you want to work with meta plug-in? | |
# set this value to: | |
# 0: convert every entry. | |
# none-0: need to add 'meta-markup: creole'. | |
my $with_meta = 1; | |
# Do you use this plugin with SmartyPants? | |
# set this value to: | |
# 0: no. | |
# 1: yes. | |
my $with_smartypants = 1; | |
# ------------------------------ | |
# Text::WikiCreole module has several features for customization. | |
# This is an example of configuration for using <blockquote> tag. | |
creole_tag("ip", "open", "<blockquote>"); | |
creole_tag("ip", "close", "</blockquote>"); | |
# ------------------------------ | |
sub start { | |
if ($with_meta) { | |
foreach my $plugin (@blosxom::plugins) { | |
return 1 if $plugin eq 'meta'; | |
} | |
return 0; | |
} | |
return 1; | |
} | |
sub story { | |
my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_; | |
if (defined($meta::markup) && ($meta::markup =~ /^.*creole$/) or ($with_meta == 0)) { | |
$$body_ref = creole_parse($$body_ref); | |
# rewrite "&" for SmartyPants. | |
if ( $with_smartypants == 1 ) { | |
$$body_ref =~ s/&/&/ig; | |
} | |
} | |
return 1; | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment