]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/autoindex_should_use_add__95__autofile.mdwn
Merge remote branch 'smcv/ready/transient-recentchanges'
[ikiwiki.git] / doc / todo / autoindex_should_use_add__95__autofile.mdwn
1 `add_autofile` is a generic version of [[plugins/autoindex]]'s code,
2 so the latter should probably use the former. --[[smcv]]
3
4 > [[merged|done]] --[[Joey]] 
5
6 ----
7
8 [[!template id=gitbranch branch=smcv/ready/autoindex-autofile author="[[smcv]]"]]
9
10 I'm having trouble fixing this:
11
12         # FIXME: some of this is probably redundant with add_autofile now, and
13         # the rest should perhaps be added to the autofile machinery
14
15 By "a generic version of" above, it seems I mean "almost, but not
16 quite, entirely unlike".
17
18 > As long as it's not Tea. ;) --[[Joey]] 
19
20 I tried digging through the git history for the
21 reasoning behind the autofile and autoindex implementations, but now I'm
22 mostly confused.
23
24 ## autofile
25
26 The autofile machinery records a list of every file that has ever been proposed
27 as an autofile: for instance, the tag plugin has a list of every tag that
28 has ever been named in a \[[!tag]] or \[[!taglink]], even if no file was
29 actually needed (e.g. because it already existed). Checks for files that
30 already exist (or whatever) are deferred until after this list has been
31 updated, and files in this list are never auto-created again unless the wiki
32 is rebuilt.
33
34 This avoids re-creating the tag `create-del` in this situation, which is
35 the third one that I noted on
36 [[todo/auto-create tag pages according to a template]]:
37
38 * create tags/create-del manually
39 * tag a page as create-del
40 * delete tags/create-del
41
42 and also avoids re-creating `auto-del` in this similar situation (which I
43 think is probably the most important one to get right):
44
45 * tag a page as auto-del, which is created automatically
46 * delete tags/auto-del
47
48 I think both of these are desirable.
49
50 However, this infrastructure also results in the tag page not being
51 re-created in either of these situations (the first and second that I noted
52 on the other page):
53
54 * tag a page as auto-del-create-del, which is created automatically
55 * delete tags/auto-del-create-del
56 * create tags/auto-del-create-del manually
57 * delete tags/auto-del-create-del again
58
59 or
60
61 * create tags/create-del-auto
62 * delete tags/create-del-auto
63 * tag a page as create-del-auto
64
65 I'm less sure that these shouldn't create the tag page: we deleted the
66 manually-created version, but that doesn't necessarily mean we don't want
67 *something* to exist.
68
69 > That could be argued, but it's a very DWIM thing. Probably best to keep
70 > the behavior simple and predictable, so one only needs to remember that
71 > when a page is deleted, nothing will ever re-create it behind ones back.
72 > --[[Joey]]
73
74 >> Fair enough, I'll make autoindex do that. --s
75
76 ## autoindex
77
78 The autoindex machinery records a more complex set. Items are added to the
79 set when they are deleted, but would otherwise have been added as an autoindex
80 (don't exist, do have children (by which I mean subpages or attachments),
81 and are a directory in the srcdir). They're removed if this particular run
82 wouldn't have added them as an autoindex (they exist, or don't have children).
83
84 Here's what happens in situations mirroring those above.
85
86 The "create-del" case still doesn't create the page:
87
88 * create create-del manually
89 * create create-del/child
90 * delete create-del
91 * it's added to `%deleted` and not re-created
92
93 Neither does the "auto-del" case:
94
95 * create auto-del/child, resulting in auto-del being created automatically
96 * delete auto-del
97 * it's added to `%deleted` and not re-created
98
99 However, unlike the generic autofile infrastructure, `autoindex` forgets
100 that it shouldn't re-create the deleted page in the latter two situations:
101
102 * create auto-del-create-del/child, resulting in auto-del-create-del being
103     created automatically
104 * delete auto-del-create-del; it's added to `%deleted` and not re-created
105 * create auto-del-create-del manually; it's removed from `%deleted`
106 * delete auto-del-create-del again (it's re-created)
107
108 and
109
110 * create create-del-auto
111 * delete create-del-auto; it's not added to `%deleted` because there's no
112     child that would cause it to exist
113 * create create-del-auto/child
114
115 > I doubt there is any good reason for this behavior. These are probably
116 > bugs. --[[Joey]] 
117
118 >> OK, I believe my updated branch gives `autoindex` the same behaviour
119 >> as auto-creation of tags. The `auto-del-create-del` and
120 >> `create-del-auto` use cases work the same as for tags on my demo wiki. --s