]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/tag_pagespec_function.mdwn
5548cfd8d11452f1d1908cf5aba8c9aea3c1b91e
[ikiwiki.git] / doc / todo / tag_pagespec_function.mdwn
1 Implementing tags in terms of links is clever, but it would be nice if it was
2 opaque in both directions: tagging and matching tags. Writing pagespecs to
3 find out which pages are tagged with a given name means that the pagespec is
4 tied to whatever the tagbase is.
5
6 This patch adds a pagespec function 'tag' which lets you write pagespecs to
7 match tagged pages independent of whatever the tagbase is set to.
8
9  -- [[users/Jon]] 2009/02/17
10
11 > So, this looks good, appreciate the patch.
12
13 > The only problem I see is it could be confusing if `tag(foo)` matched
14 > a page that just linked to the tag via a wikilink, w/o actually tagging it.
15
16 >> Yes, this is confusing and not nice. I observed this misbehavior, because I wanted to match two different lists of pages (only tagged or linked in any way), but it didn't work. Would this feature require a complex patch? --Ivan Z.
17
18 >
19 > One other thing, perhaps it should be called `tagged()`? --[[Joey]] 
20
21 [[!tag patch done]]
22
23     --- a/plugins/IkiWiki/Plugin/tag.pm 2009-02-16 11:30:11.000000000 +0000
24     +++ b/plugins/IkiWiki/Plugin/tag.pm 2009-02-17 15:40:03.000000000 +0000
25     @@ -125,4 +125,12 @@
26         }
27      }
28      
29     +package IkiWiki::PageSpec;
30     +
31     +sub match_tag ($$;@) {
32     +   my $page = shift;
33     +   my $glob = shift;
34     +    return match_link($page, IkiWiki::Plugin::tag::tagpage($glob));
35     +}
36     +
37      1