]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/flexible_relationships_between_pages.mdwn
7e3487d38b1440a96c969d7d3ee9ebdb187df189
[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. it can be also viewed of a way to have
7 [[todo/structured page data]] that consists of URLs inside the wiki.
8
9 following the use case i've developed it for, i'll call it `blocks` for the
10 moment (but am open to better suggestions).
11
12 outline
13 =======
14
15 the plugin has a **configuration option** called `blocks_names`, which consists
16 of pairs of verbs; the typical example is `blocks/blockedby`, but other values
17 could be `next/prev up/down` or `owner/owns`.
18
19 for each verb in the options, there is a **directive** which is used to state
20 the relationship; relationships can be declared on both ends, so a page `bugA`
21 with the contents `\[[!blocks bugB]]` is semantically equivalent to a page
22 `bugB` with the contents `\[[!blockedby bugA]]`.
23
24 for each verb, there is also a **pagespec** which matches all pages that are
25 the origin of a relationship to a given page. if `developerA` `\[[!owns
26 bug1]]`, then if `bug1` contains `\[[!map pages="owns(.)"]]`, it will show the
27 owning developer. these specs match both ways, ie. if `bug1` `\[[!owner
28 developerA]]`, the said map directive will still produce the same result.
29
30 details
31 =======
32
33 * single word relationships vs. symmetric relationships
34
35   with some verbs, it is possible that a relationship is only used in one
36   direction (eg `index`, even though one could declare it as
37   `index/isindexof`).
38
39   > isindexof is not a very interesting relationship - it just clogs up
40   > the link-map, since the index is "the index of" all pages. I can't
41   > see any situation in which you'd want to do pagespec matching
42   > on it? --[[smcv]]
43
44   other verbs are symmetric, eg. `equivalent`, which need different treatment.
45
46 * "taglink" style directives
47
48   the [[plugins/tag]] plugin would be a special case for this plugin (apart
49   from the autotag and tagdir features). as there is a `\[[!taglink ...]]`
50   directive, there could be an analogous directive for every single directive.
51
52   > This is basically the traillink/trailitem duality, too.
53   > I'd be quite tempted to generalize to something like this:
54   >
55   >     We can't fix [[!link blocks="bug123" text="Bug 123"]] until we do this.
56   >
57   >     [[!hiddenlink owner="smcv"]]
58   >
59   > but perhaps that's too wordy?
60   >
61   > I think both trail and tag need their own special processing beyond the
62   > general case, but maybe not? --[[smcv]]
63
64 * implementation notes
65
66   the way pagespec hooks are implemented required some nasty perl tricks, for
67   which the people who showed me felt very bad for having spoilt me. indeed,
68   `no strict refs;` and `*$forward_name = $forward_match;` are not exactly
69   ideal. a change in the pagespec declaration api (why not just `hook` like
70   everything else) would make the implementation cleaner.
71
72   > How about replacing `blockedby(bug*)` with `linktype(blockedby bug*)` or
73   > something? Then you'd only need one pseudo-hook. --[[smcv]]
74
75 * configuration location
76
77   i aimed for static configuration of the `block_names` in the setup file. this
78   could be made more general like in the [[plugins/shortcut]] plugin, but that
79   would make things more complex.
80
81 * no html links with `rel=` yet
82
83   as there are no taglink style links between the articles so far, no htmllink
84   gets rendered that could carry the relationship name in its rel field.
85
86   having the inverse relationship description in backlinks (as in the link
87   created by the map directive in the example above) would be hard to
88   implement. (actually, i think it'd be easier to determine the rel values from
89   the taggedlinks for *every* htmllink than to influence the backlinks in this
90   plugin).
91
92 * one direction also creates a normal link
93
94   due to the way add\_link treats relationships, the forward relationship is
95   always going to be reflected in the links/backlinks. a section of
96   [[todo/matching different kinds of links]] was dismissed with "let's not
97   worry about it", this plugin might be reason to worry about it again. (i'd
98   consider what is in @links to be a representation of which hyperlinks are
99   there, and in this case, none are generated).
100
101   > taglink and traillink already count as wikilinks without generating
102   > any visible HTML. --[[smcv]]
103
104 implementation
105 ==============
106
107 there is a working but slightly incomplete (basically where it comes to the
108 details mentioned above) implementation in [[blocks.pm]].
109
110 --chrysn