}
hook(type => "preprocess", no_override => 1, id => $params{name},
- call => sub { shortcut_expand($params{name}, $params{url}, @_) });
+ call => sub { shortcut_expand($params{url}, $params{desc}, @_) });
return "shortcut $params{name} points to $params{url}";
} # }}}
sub shortcut_expand ($$@) { #{{{
- my $name=shift;
my $url=shift;
+ my $desc=shift;
my %params=@_;
# Get params in original order.
my $encoded_text=$text;
$encoded_text=~s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
+ if (defined $desc) {
+ $desc=~s/\%s/$text/g;
+ }
+ else {
+ $desc=$text;
+ }
+
$url=~s/\%s/$encoded_text/g;
- return "<a href=\"$url\">$text</a>";
+ return "<a href=\"$url\">$desc</a>";
} #}}}
1
--plugin=orphans --plugin=haiku --plugin=meta \
--plugin=tag --plugin=polygen --plugin=pagestats \
--plugin=fortune --plugin=aggregate --plugin=map \
- --plugin=template --plugin=toc
+ --plugin=template --plugin=toc --plugin=shortcut
./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
./pm_filter $(PREFIX) $(VER) < ikiwiki.pl > ikiwiki.out
* [[shortcut name=google url="http://www.google.com/search?q=%s"]]
* [[shortcut name=wikipedia url="http://en.wikipedia.org/wiki/%s"]]
-* [[shortcut name=debbug url="http://bugs.debian.org/%s"]]
+* [[shortcut name=debbug url="http://bugs.debian.org/%s" desc="bug #%s"]]
* [[shortcut name=cpan url="http://search.cpan.org/search?mode=dist&query=%s"]]
-To add a new shortcut, use the "shortcut" preprocessor directive. "%s" in
-the url becomes the text passed to the named shortcut.
+To add a new shortcut, use the "shortcut" preprocessor directive. "%s" is
+replaced with the text passed to the named shortcut. The optional desc
+parameter controls the description of the link.
* Modified svn, git, tla backends to recognise such web commits.
* Move httpauth support to a plugin.
* Add openidsignup config option.
- * Make the openid plugin support the callbacks from myopenid.com via its
+ * Make the openid plugin support the callbacks from myopenid.com via its
affiliate program.
* Change how post signin actions are propigated through the signin process;
they're now stored in the session.
+ * Add optional "desc" parameter to shortcut definitions.
- -- Joey Hess <joeyh@debian.org> Sun, 19 Nov 2006 16:40:26 -0500
+ -- Joey Hess <joeyh@debian.org> Mon, 20 Nov 2006 06:14:51 -0500
ikiwiki (1.33) unstable; urgency=low
Ikiwiki is a perl program, and needs a recent version of perl such as
5.8.8. (5.8.0 has been reported not to work).
-Ikiwiki requires the `Text::MarkDown`, `URI` and `HTML::Parser` perl
-modules be installed, and also uses the following perl modules if
-available:
-`CGI::Session` `CGI::FormBuilder` (version 3.02.02 or newer)
-`HTML::Template` `Mail::Sendmail` `Time::Duration` `Date::Parse`,
-`HTML::Scrubber`, `RPC::XML`, `XML::Simple`, `XML::Feed`, `File::MimeInfo`.
+Ikiwiki requires the [[cpan Text::MarkDown]], [[cpan URI]] and
+[[cpan HTML::Parser]] perl modules be installed, and also uses the
+following perl modules if available:
+[[cpan CGI::Session]], [[cpan CGI::FormBuilder]] (version 3.02.02 or newer,
+but 3.0401 might be broken),
+[[cpan HTML::Template]], [[cpan Mail::Sendmail]], [[cpan Time::Duration]]
+[[cpan TimeDate]], [[cpan HTML::Scrubber]], [[cpan RPC::XML]],
+[[cpan XML::Simple]], [[cpan XML::Feed]], [[cpan File::MimeInfo]].
-The [[tla]] support also needs the `MailTools` perl module.
+The [[tla]] support also needs the [[cpan MailTools]] perl module.
Various [[plugins]] use other libraries and utlities; see their individual
documentation for details.
If you want to install from the tarball, you should make sure that the
required perl modules are installed, then run:
- perl Makefile.PL # PREFIX=/dir to install elsewhere
- make
+ perl Makefile.PL # PREFIX=/dir to install elsewhere
+ make
make test # optional
- make install
+ make install
See [[download]] for where to get it.
Enables use of Discordian dates. `--timeformat` can be used to change
the date format; see `ddate(1)`.
-This plugin requires the DateTime and DateTime::Calendar::Discordian
-perl modules.
+This plugin requires the [[cpan DateTime]] and
+[[cpan DateTime::Calendar::Discordian]] perl modules.
Parser, documented at <http://feedparser.org/docs/html-sanitization.html>.
Notably it strips `style`, `link`, and the `style` attribute.
-It uses the HTML::Scrubber perl module to perform its html
+It uses the [[cpan HTML::Scrubber]] perl module to perform its html
sanitisation, and this perl module also deals with various entity encoding
tricks.
This plugin allows users to use their [OpenID](http://openid.net/) to log
into the wiki.
-The plugin needs the `Net::OpenID::Consumer` perl module. The
-`LWPx::ParanoidAgent` perl module is used if available, for added
-security. Finally, the `Crypt::SSLeay` perl module is needed to support
+The plugin needs the [[cpan Net::OpenID::Consumer]] perl module. The
+[[cpan LWPx::ParanoidAgent]] perl module is used if available, for added
+security. Finally, the [[cpan Crypt::SSLeay]] perl module is needed to support
users entering "https" OpenID urls.
This plugin has a configuration option. You can set `--openidsignup`
that this is a different location than the directory used for the
[[templates]] used to build the wiki itself, which is not inside the wiki.
-The template uses the syntax used by the HTML::Template perl module, which
-allows for some fairly complex things to be done. Consult its documentation
-for the full syntax, but all you really need to know are a few things:
+The template uses the syntax used by the [[cpan HTML::Template]] perl
+module, which allows for some fairly complex things to be done. Consult its
+documentation for the full syntax, but all you really need to know are a
+few things:
* To insert the value of a variable, use `<TMPL_VAR variable>`.
* To make a block of text conditional on a variable being set use
[[tag type/format]]
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.
+text format. To use it, you need to have the [[cpan 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. Four or more
-[[plugins/shortcut]] creates link shortcut [[PreprocessorDirective]]s, which substitute their argument into the specified shortcut URL to generate the link target, and use the argument as the link text. For example, given the example [[shortcuts]], `\[[wikipedia ikiwiki]]` generates a link to <http://en.wikipedia.org/wiki/ikiwiki>, with the link text "ikiwiki". This works well in many cases; however, for things like the `debbug` example, it simply uses the number as the link text, which does not always provide enough context to understand the link at first glance. For example, `\[[debbug 397501]]` generates a link to <http://bugs.debian.org/397501>, with just "397501" as the link text. While [[plugins/template]] provides a general solution for arbitrary cases, it would help to have a simple option via the shortcut plugin to set the link text, with a `%s` substitution. Thus, something like `\[[shortcut name=debbug url="http://bugs.debian.org/%s" desc="bug #%s"]]` might suffice on a Debian-specific wiki to indicate a bug number, while a more general wiki might use something like `\[[shortcut name=debbug url="http://bugs.debian.org/%s" desc="Debian bug #%s"]]`.
\ No newline at end of file
+[[plugins/shortcut]] creates link shortcut [[PreprocessorDirective]]s,
+which substitute their argument into the specified shortcut URL to generate
+the link target, and use the argument as the link text. For example, given
+the example [[shortcuts]], `\[[wikipedia ikiwiki]]` generates a link to
+<http://en.wikipedia.org/wiki/ikiwiki>, with the link text "ikiwiki". This
+works well in many cases; however, for things like the `debbug` example, it
+simply uses the number as the link text, which does not always provide
+enough context to understand the link at first glance. For example,
+`\[[debbug 397501]]` generates a link to <http://bugs.debian.org/397501>,
+with just "397501" as the link text. While [[plugins/template]] provides a
+general solution for arbitrary cases, it would help to have a simple option
+via the shortcut plugin to set the link text, with a `%s` substitution.
+Thus, something like `\[[shortcut name=debbug
+url="http://bugs.debian.org/%s" desc="bug #%s"]]` might suffice on a
+Debian-specific wiki to indicate a bug number, while a more general wiki
+might use something like `\[[shortcut name=debbug
+url="http://bugs.debian.org/%s" desc="Debian bug #%s"]]`.
+
+> [[todo/done]] --[[Joey]]