safe => 1,
rebuild => 1,
},
- tagged_is_strict => {
- type => "boolean",
- default => 0,
- description => "if 1, tagged() doesn't match normal WikiLinks to tag pages",
- safe => 1,
- rebuild => 1,
- },
}
sub tagpage ($) {
package IkiWiki::PageSpec;
sub match_tagged ($$;@) {
- my $page = shift;
- my $glob = shift;
-
- if ($IkiWiki::config{tagged_is_strict}) {
- return match_link($page, IkiWiki::Plugin::tag::tagpage($glob), linktype => 'tag');
- }
- else {
- return match_link($page, IkiWiki::Plugin::tag::tagpage($glob));
- }
+ return match_link($_[0], IkiWiki::Plugin::tag::tagpage($_[1]), linktype => 'tag');
}
1
>> is valid. [[todo/matching_different_kinds_of_links]] is probably
>> how it will eventually be solved. --[[Joey]]
->>> [[Done]]: you can now set the `tagged_is_strict` config option to `1`
->>> if you don't want `tagged` to match other wikilinks. --[[smcv]]
+>>> [[Done]]: `tagged` no longer matches other wikilinks. --[[smcv]]
> And this is an illustration why a clean work-around (without changing the software) is not possible: while thinking about [[todo/matching_different_kinds_of_links]], I thought one could work around the problem by simply explicitly including the kind of the relation into the link target (like the tagbase in tags), and by having a separate page without the "tagbase" to link to when one wants simply to refer to the tag without tagging. But this won't work: one has to at least once refer to the real tag page if one wants to talk about it, and this reference will count as tagging (unwanted). --Ivan Z.
It also provides the `tagged()` [[ikiwiki/PageSpec]], which can be used to
match pages that are tagged with a specific tag.
-If the `tagged_is_strict` config option is set, `tagged()` will only match
-tags explicitly set with [[ikiwiki/directive/tag]] or
-[[ikiwiki/directive/taglink]]; if not (the default), it will also match
-any other [[WikiLinks|ikiwiki/WikiLink]] to the tag page.
-
[[!if test="enabled(tag)" then="""
This wiki has the tag plugin enabled, so you'll see a note below that this
page is tagged with the "tags" tag.
$config{userdir} = "users";
$config{tagbase} = "tags";
-$config{tagged_is_strict} = 1;
%oldrenderedfiles=%pagectime=();
%pagesources=%pagemtime=%oldlinks=%links=%depends=%typedlinks=%oldtypedlinks=