]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/flexible_relationships_between_pages.mdwn
ee3dd8d3a46fc4c5469a18ff2a8fbf3e561f56e0
[ikiwiki.git] / doc / todo / flexible_relationships_between_pages.mdwn
1 it has been some years since the [[matching different kinds of links]] issue
2 was tackled, but hardly a plugin is using it.
3
4 in order to enhance on the [[todo/rel attribute for links]] and [[todo/better bug tracking support]]
5 issues and to provide a more general infrastructure, i'd like to propose a
6 generic plugin for typed links. following the use case i've developed it for,
7 i'll call it `blocks` for the moment (but am open to better suggestions).
8
9 outline
10 =======
11
12 the plugin has a **configuration option** called `blocks_names`, which consists
13 of pairs of verbs; the typical example is `blocks/blockedby`, but other values
14 could be `next/prev up/down` or `owner/owns`.
15
16 for each verb in the options, there is a **directive** which is used to state
17 the relationship; relationships can be declared on both ends, so a page `bugA`
18 with the contents `\[[!blocks bugB]]` is semantically equivalent to a page
19 `bugB` with the contents `\[[!blockedby bugA]]`.
20
21 for each verb, there is also a **pagespec** which matches all pages that are
22 the origin of a relationship to a given page. if `developerA` `\[[!owns
23 bug1]]`, then if `bug1` contains `\[[!map pages="owns(.)"]]`, it will show the
24 owning developer. these specs match both ways, ie. if `bug1` `\[[!owner
25 developerA]]`, the said map directive will still produce the same result.
26
27 details
28 =======
29
30 * single word relationships vs. symmetric relationships
31
32   with some verbs, it is possible that a relationship is only used in one
33   direction (eg `index`, even though one could declare it as
34   `index/isindexof`).
35
36   other verbs are symmetric, eg. `equivalent`, which need different treatment.
37
38 * "taglink" style directives
39
40   the [[plugins/tag]] plugin would be a special case for this plugin (apart
41   from the autotag and tagdir features). as there is a `\[[!taglink ...]]`
42   directive, there could be an analogous directive for every single directive.
43
44 * implementation notes
45
46   the way pagespec hooks are implemented required some nasty perl tricks, for
47   which the people who showed me felt very bad for having spoilt me. indeed,
48   `no strict refs;` and `*$forward_name = $forward_match;` are not exactly
49   ideal. a change in the pagespec declaration api (why not just `hook` like
50   everything else) would make the implementation cleaner.
51
52 * configuration location
53
54   i aimed for static configuration of the `block_names` in the setup file. this
55   could be made more general like in the [[plugins/shortcut]] plugin, but that
56   would make things more complex.
57
58 * no html links with `rel=` yet
59
60   as there are no taglink style links between the articles so far, no htmllink
61   gets rendered that could carry the relationship name in its rel field.
62
63   having the inverse relationship description in backlinks (as in the link
64   created by the map directive in the example above) would be hard to
65   implement. (actually, i think it'd be easier to determine the rel values from
66   the taggedlinks for *every* htmllink than to influence the backlinks in this
67   plugin).
68
69 * one direction also creates a normal link
70
71   due to the way add\_link treats relationships, the forward relationship is
72   always going to be reflected in the links/backlinks. a section of
73   [[todo/matching different kinds of links]] was dismissed with "let's not
74   worry about it", this plugin might be reason to worry about it again. (i'd
75   consider what is in @links to be a representation of which hyperlinks are
76   there, and in this case, none are generated).
77
78 implementation
79 ==============
80
81 there is a working but slightly incomplete (basically where it comes to the
82 details mentioned above) implementation in [[blocks.pm]].
83
84 --chrysn