aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/matching_different_kinds_of_links.mdwn
blob: 26c5a072bf3cb205b238a4e6fd0882583a0b7609 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[[!tag wishlist]]

As noted in [[todo/tag_pagespec_function]], there is a "misbehavior" of a `tagged()` pagespec: it matches even pages which have plain links to the tag page.

And in general, it would be quite useful to be able to distinguish different kinds of links: one more kind, in addition to "tag", is "bug dependency" noted in [[todo/structured_page_data#another_kind_of_links]] and [[todo/tracking_bugs_with_dependencies#another_kind_of_links]].

It could distinguish the links by the `rel=` attribute. ([[Tags already receive a special rel-class|todo/rel_attribute_for_links]].) This means there is a general need for a syntax to specify user-defined rel-classes on wikilink (then bug deps would simply use their special rel-class, either directly, or through a special directive like `\[[!depends ]]`), and to refer to them in pagespecs (in forward and backward direction).

Besides pagespecs, the `rel=` attribute could be used for styles. --Ivan Z.

> FWIW, the `add_link` function introduced in a recent
> release adds an abstraction that could be used to get
> part of the way there to storing data about different types of
> links. That function could easily be extended to take an optional
> third parameter specifying the link type.
> 
> Then there's the question of how to store and access the data. `%links`
> does not offer a good way to add additional information about links.
> Now, we could toss `%links` entirely and switch to an accessor function,
> but let's think about not doing that..
> 
> The data that seems to be needed is basically a deep hash, so
> one could check `$linktype{$page}{tag}{$link}` to see if
> the page contains a link of the given type. (Note that pages could
> contain links that were duplicates except for their types.)
> 
> There would be some data duplication, unfortuantly, but if `%linktype`
> is not populated for regular wikilinks, it would at least be limited to
> tags and other unusual link types, so not too bad.
> 
> `%linktype` could be stored in `%pagestate`.. if so
> the actual use might look like `$pagestate{$page}{linktype}{tag}{$link}`.
> That could be implemented by the tag plugin right now
> with no core changes. (BTW, then I originally wrote tag, pagestate
> was not available, which is why I didn't make it differentiate from
> normal links.) Might be better to go ahead and add the variable to
> core though. --[[Joey]] 

I saw somewhere else here some suggestions for the wiki-syntax for specifying the relation name of a link. One more suggestion---[the syntax used in Semantic MediaWiki](http://en.wikipedia.org/wiki/Semantic_MediaWiki#Basic_usage), like this:

<pre>
... the capital city is \[[Has capital::Berlin]] ...
</pre>

So a part of the effect of [[`\[[!taglink TAG\]\]`|plugins/tag]] could be represented as something like `\[[tag::TAG]]` or (more understandable relation name in what concerns the direction) `\[[tagged::TAG]]`.

I don't have any opinion on this syntax (whether it's good or not)...--Ivan Z.