1 Consider the "All files in this package search" on
2 <http://packages.debian.org>. The URL for such a search looks like this:
4 http://packages.debian.org/cgi-bin/search_contents.pl?word=packagename&searchmode=filelist&case=insensitive&version=unstable&arch=i386
6 To create a "debfiles" [[shortcut|shortcuts]] that takes a package name, you
7 could just hardcode the architecture and distribution:
9 \[[!shortcut name=debfiles url="http://packages.debian.org/cgi-bin/search_contents.pl?word=%s&searchmode=filelist&case=insensitive&version=unstable&arch=i386"]]
10 \[[!debfiles ikiwiki]]
12 But what if you could have them as optional parameters instead? The syntax
13 for the invocation should look like this:
15 \[[!debfiles ikiwiki dist=testing]]
17 Some possible syntax choices for the shortcut definition:
19 \[[!shortcut name=debfiles url="http://packages.debian.org/cgi-bin/search_contents.pl?word=%s&searchmode=filelist&case=insensitive&version=%(dist)s&arch=%(arch)s" dist="unstable" arch="i386"]]
20 \[[!shortcut name=debfiles url="http://packages.debian.org/cgi-bin/search_contents.pl?word=%s&searchmode=filelist&case=insensitive&version=%(dist=unstable)s&arch=%(arch=i386)s"]]
21 \[[!shortcut name=debfiles url="http://packages.debian.org/cgi-bin/search_contents.pl?word=%s&searchmode=filelist&case=insensitive&version=%{dist=unstable}&arch=%{arch=i386}"]]
22 \[[!shortcut name=debfiles url="http://packages.debian.org/cgi-bin/search_contents.pl?word=$*&searchmode=filelist&case=insensitive&version=${dist=unstable}&arch=${arch=i386}"]]
26 Well, you can already do this kind of thing with templates. Invocation does
29 \[[!template id=debfiles package=ikiwiki dist=testing]]
33 > I think I would find templates sufficient, if:
35 > 1. I could use the name of the template as a preprocessor directive
36 > (`\[[!templatename ...]]`), rather than using the `template` directive
37 > with an `id` argument (`\[[!template id=templatename]]`).
38 > 2. Template invocation allowed bare values in addition to `key=value`
39 > arguments, and template definition supported some means to access the
40 > value. This would allow `\[[!debfiles ikiwiki]]` rather than
41 > `\[[!debfiles package=ikiwiki]]`.
42 > 3. I could use ikiwiki syntax in the template, not just HTML and
43 > HTML::Template. (If I can already do that, then [[/plugins/template]]
44 > should make that more clear.)