]> sipb.mit.edu Git - ikiwiki.git/commitdiff
shortcut stuff
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Mon, 20 Nov 2006 11:31:23 +0000 (11:31 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Mon, 20 Nov 2006 11:31:23 +0000 (11:31 +0000)
IkiWiki/Plugin/shortcut.pm
Makefile.PL
basewiki/shortcuts.mdwn
debian/changelog
doc/install.mdwn
doc/plugins/ddate.mdwn
doc/plugins/htmlscrubber.mdwn
doc/plugins/openid.mdwn
doc/plugins/template.mdwn
doc/plugins/wikitext.mdwn
doc/todo/shortcut_link_text.mdwn

index d09d5879d27b5f5c640bedf259b65a0ee1e426ec..e4a9ab1a6647455267a422f101666e26c8ae3a96 100644 (file)
@@ -25,14 +25,14 @@ sub preprocess_shortcut (@) { #{{{
        }
 
        hook(type => "preprocess", no_override => 1, id => $params{name},
        }
 
        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 ($$@) { #{{{
 
        return "shortcut $params{name} points to $params{url}";
 } # }}}
 
 sub shortcut_expand ($$@) { #{{{
-       my $name=shift;
        my $url=shift;
        my $url=shift;
+       my $desc=shift;
        my %params=@_;
 
        # Get params in original order.
        my %params=@_;
 
        # Get params in original order.
@@ -51,8 +51,15 @@ sub shortcut_expand ($$@) { #{{{
        my $encoded_text=$text;
        $encoded_text=~s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
        
        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;
        $url=~s/\%s/$encoded_text/g;
-       return "<a href=\"$url\">$text</a>";
+       return "<a href=\"$url\">$desc</a>";
 } #}}}
 
 1
 } #}}}
 
 1
index b27e6cef39b6b01599b3c4d8c08a81cb5cb8c9cf..831c13255e7733e64339566797596c17e7847716 100755 (executable)
@@ -21,7 +21,7 @@ extra_build:
                --plugin=orphans --plugin=haiku --plugin=meta \
                --plugin=tag --plugin=polygen --plugin=pagestats \
                --plugin=fortune --plugin=aggregate --plugin=map \
                --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
        ./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
index cb80c4d40ed5c2449aba170d3a21e22af7cd56ba..cca0df4a3f3fcca936903033fae73fccf8d924e8 100644 (file)
@@ -2,8 +2,9 @@ This page controls what shortcut links the wiki supports.
 
 * [[shortcut name=google url="http://www.google.com/search?q=%s"]]
 * [[shortcut name=wikipedia url="http://en.wikipedia.org/wiki/%s"]]
 
 * [[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"]]
 
 * [[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.
index 5317c4755312a91b571d35b52878b7c6bdf0f24c..d381521326be8036c4e6fe9194f0ddc0bc278dfb 100644 (file)
@@ -7,12 +7,13 @@ ikiwiki (1.34) UNRELEASED; urgency=low
   * Modified svn, git, tla backends to recognise such web commits.
   * Move httpauth support to a plugin.
   * Add openidsignup config option.
   * 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.
     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 (1.33) unstable; urgency=low
 
index 08a446fb85beae8c39b93d898615067d76e015ea..ed6d499c5d65945254d9745807c67662ad2ed26b 100644 (file)
@@ -5,14 +5,16 @@ most unix-like systems.
 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 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.
 
 Various [[plugins]] use other libraries and utlities; see their individual
 documentation for details.
@@ -20,9 +22,9 @@ documentation for details.
 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 # PREFIX=/dir to install elsewhere
-        make
+       perl Makefile.PL # PREFIX=/dir to install elsewhere
+       make
        make test # optional
        make test # optional
-        make install
+       make install
 
 See [[download]] for where to get it.
 
 See [[download]] for where to get it.
index c35afe4cacaaee45b839b2403d12b7a4eafc8a9f..307673048a7dcb161d542c2e2d4f339c3c92f7be 100644 (file)
@@ -4,5 +4,5 @@
 Enables use of Discordian dates. `--timeformat` can be used to change
 the date format; see `ddate(1)`.
 
 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.
index e3652a847999f2cf7076bf0d3b99f05089af2abd..a064c49012ecc5bd754aab82d19c9ff975870838 100644 (file)
@@ -10,7 +10,7 @@ whitelisted using the same lists as used by Mark Pilgrim's Universal Feed
 Parser, documented at <http://feedparser.org/docs/html-sanitization.html>.
 Notably it strips `style`, `link`, and the `style` attribute.
 
 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.
 
 sanitisation, and this perl module also deals with various entity encoding
 tricks.
 
index 133529ea7d6a500c0e966c635bab852e5c8a965f..a6e01ccc5bde91e9bcc1d1c4935f48d92d3c69c9 100644 (file)
@@ -4,9 +4,9 @@
 This plugin allows users to use their [OpenID](http://openid.net/) to log
 into the wiki.
 
 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`
 users entering "https" OpenID urls.
 
 This plugin has a configuration option. You can set `--openidsignup`
index 8b089d90466673346c8295801082517d554a9023..7b70bb2818d412971472e9a6294693e056d96c10 100644 (file)
@@ -27,9 +27,10 @@ To create a template, make a page in the wiki named `template/foo`. Note
 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.
 
 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
 
 * To insert the value of a variable, use `<TMPL_VAR variable>`.
 * To make a block of text conditional on a variable being set use
index d7768f0f80eb21940aa073bc7a7a56f4327b37cc..abbebb6773e877031bf967af3680c065b49c5d8c 100644 (file)
@@ -2,9 +2,9 @@
 [[tag type/format]]
 
 This plugin allows ikiwiki to process pages written in the original wiki
 [[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
 
 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
index 31820836b37b4de9fa46c5861f7d2c29cb79e9e6..6842a911f6a3b7182f9d49cf92917b2961f69c85 100644 (file)
@@ -1 +1,19 @@
-[[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]]