From 0f22d66c965d7f2a3e4698de7ddf992efebf6c42 Mon Sep 17 00:00:00 2001 From: joey Date: Fri, 7 Jul 2006 18:28:27 +0000 Subject: [PATCH] * Add wikitext markup plugin, which supports ".wiki" pages written in the original wiki syntax, CamelCase links and all. --- IkiWiki/Plugin/wikitext.pm | 30 ++++++++++++++++++++++++++++++ debian/changelog | 4 +++- doc/features.mdwn | 5 +++-- doc/ikiwiki.setup | 2 +- doc/install.mdwn | 3 ++- doc/plugins/wikitext.mdwn | 21 +++++++++++++++++++++ 6 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 IkiWiki/Plugin/wikitext.pm create mode 100644 doc/plugins/wikitext.mdwn diff --git a/IkiWiki/Plugin/wikitext.pm b/IkiWiki/Plugin/wikitext.pm new file mode 100644 index 000000000..310b86724 --- /dev/null +++ b/IkiWiki/Plugin/wikitext.pm @@ -0,0 +1,30 @@ +#!/usr/bin/perl +# WikiText markup +package IkiWiki::Plugin::wikitext; + +use warnings; +use strict; +use Text::WikiFormat; + +sub import { #{{{ + IkiWiki::hook(type => "filter", id => "wiki", call => \&filter); + IkiWiki::hook(type => "htmlize", id => "wiki", call => \&htmlize); +} # }}} + +sub filter (@) { #{{{ + my %params=@_; + + # Make CamelCase links work by promoting them to fullfledged + # WikiLinks. This regexp is based on the one in Text::WikiFormat. + $params{content}=~s#(?=])\b((?:[A-Z][a-z0-9]\w*){2,})#[[$1]]#g; + + return $params{content}; +} #}}} + +sub htmlize ($) { #{{{ + my $content = shift; + + return Text::WikiFormat::format($content, undef, { implicit_links => 0 }); +} # }}} + +1 diff --git a/debian/changelog b/debian/changelog index 6b7c1a679..3cea775be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,8 +4,10 @@ ikiwiki (1.9) UNRELEASED; urgency=low * Patch from Faidon to use svn --limit when possible for recentchanges, speeds up recentchanges a lot for wikis with more history. * Patch from Recai to fix utf8 issues in git backend. + * Add wikitext markup plugin, which supports ".wiki" pages written in the + original wiki syntax, CamelCase links and all. - -- Joey Hess Wed, 5 Jul 2006 16:53:34 -0400 + -- Joey Hess Fri, 7 Jul 2006 14:11:50 -0400 ikiwiki (1.8) unstable; urgency=low diff --git a/doc/features.mdwn b/doc/features.mdwn index c22d2be91..5152beffd 100644 --- a/doc/features.mdwn +++ b/doc/features.mdwn @@ -23,11 +23,12 @@ Some of ikiwiki's features: page with a filename ending in ".mdwn" is converted from markdown to html by ikiwiki. Markdown understands text formatted as it would be in an email, and is quite smart about converting it to html. The only additional markup - provided by ikiwiki aside from regular markdown is the [[WikiLink]] and + provided by ikiwiki on top of regular markdown is the [[WikiLink]] and [[PreprocessorDirective]] If you prefer to use some other markup language, ikiwiki allows others to - be added by [[plugins]]. + easily be added by [[plugins]]. For example it also supports traditional + [[plugins/WikiText]] formatted pages. * support for other file types diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup index 9713d553b..8bc0e3336 100644 --- a/doc/ikiwiki.setup +++ b/doc/ikiwiki.setup @@ -71,7 +71,7 @@ use IkiWiki::Setup::Standard { #timeformat => '%c', # To add plugins, list them here. - #add_plugins => [qw{pagecount brokenlinks search smiley}], + #add_plugins => [qw{pagecount brokenlinks search smiley wikitext}], # If you want to disable any of the default plugins, list them here. #disable_plugins => [qw{inline htmlscrubber}], } diff --git a/doc/install.mdwn b/doc/install.mdwn index f65e1a227..d23c88e41 100644 --- a/doc/install.mdwn +++ b/doc/install.mdwn @@ -6,7 +6,8 @@ perl modules if available: `CGI::Session` `CGI::FormBuilder` (version `Date::Parse` (libtimedate-perl), `HTML::Scrubber`, `RPC::XML`, `XML::Simple` -If you want to install from the tarball, you should make sure that the required perl modules are installed, then run: +If you want to install from the tarball, you should make sure that the +required perl modules are installed, then run: perl Makefile.PL make diff --git a/doc/plugins/wikitext.mdwn b/doc/plugins/wikitext.mdwn new file mode 100644 index 000000000..5c5383fc5 --- /dev/null +++ b/doc/plugins/wikitext.mdwn @@ -0,0 +1,21 @@ +This plugin allows ikiwiki to process pages written in the original wiki +text format. To use it, you need to have the Text::WikiFormat perl module +installed, enable the plugin, then files with the extention `.wiki` will be +processed as wiki text. + +Wiki formatting is very simple. An item wrapped in three single quotes is +strong. An item wrapped in two single quotes is emphasized. Any word with +multiple CapitalLetters (e. g., StudlyCaps) will become a link (standard +[[WikiLinks|WikiLink]] work too). Four or more +hyphen characters at the start of a line create a horizontal line. +Newlines turn into the appropriate tags. Headers are matching equals signs +around the header text -- the more signs, the lesser the header. + +Lists are indented text, by one tab or four spaces. In unordered lists, +where each item has its own bullet point, each item needs a leading +asterisk and space. Ordered lists consist of items marked with combination +of one or more alphanumeric characters followed by a period and an optional +space. Any indented text without either marking is code, handled literally. +You can nest lists. + +This plugin is included in ikiwiki, but is not enabled by default. -- 2.39.2