Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[ikiwiki] / 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 ----
5
6 [[!template id=gitbranch branch=smcv/autoindex-autofile author="[[smcv]]"]]
7
8 I'm having trouble fixing this:
9
10         # FIXME: some of this is probably redundant with add_autofile now, and
11         # the rest should perhaps be added to the autofile machinery
12
13 By "a generic version of" above, it seems I mean "almost, but not
14 quite, entirely unlike". I tried digging through the git history for the
15 reasoning behind the autofile and autoindex implementations, but now I'm
16 mostly confused.
17
18 ## autofile
19
20 The autofile machinery records a list of every file that has ever been proposed
21 as an autofile: for instance, the tag plugin has a list of every tag that
22 has ever been named in a \[[!tag]] or \[[!taglink]], even if no file was
23 actually needed (e.g. because it already existed). Checks for files that
24 already exist (or whatever) are deferred until after this list has been
25 updated, and files in this list are never auto-created again unless the wiki
26 is rebuilt.
27
28 This avoids re-creating the tag `create-del` in this situation, which is
29 the third one that I noted on
30 [[todo/auto-create tag pages according to a template]]:
31
32 * create tags/create-del manually
33 * tag a page as create-del
34 * delete tags/create-del
35
36 and also avoids re-creating `auto-del` in this similar situation (which I
37 think is probably the most important one to get right):
38
39 * tag a page as auto-del, which is created automatically
40 * delete tags/auto-del
41
42 I think both of these are desirable.
43
44 However, this infrastructure also results in the tag page not being
45 re-created in either of these situations (the first and second that I noted
46 on the other page):
47
48 * tag a page as auto-del-create-del, which is created automatically
49 * delete tags/auto-del-create-del
50 * create tags/auto-del-create-del manually
51 * delete tags/auto-del-create-del again
52
53 or
54
55 * create tags/create-del-auto
56 * delete tags/create-del-auto
57 * tag a page as create-del-auto
58
59 I'm less sure that these shouldn't create the tag page: we deleted the
60 manually-created version, but that doesn't necessarily mean we don't want
61 *something* to exist.
62
63 ## autoindex
64
65 The autoindex machinery records a more complex set. Items are added to the
66 set when they are deleted, but would otherwise have been added as an autoindex
67 (don't exist, do have children (by which I mean subpages or attachments),
68 and are a directory in the srcdir). They're removed if this particular run
69 wouldn't have added them as an autoindex (they exist, or don't have children).
70
71 Here's what happens in situations mirroring those above.
72
73 The "create-del" case still doesn't create the page:
74
75 * create create-del manually
76 * create create-del/child
77 * delete create-del
78 * it's added to `%deleted` and not re-created
79
80 Neither does the "auto-del" case:
81
82 * create auto-del/child, resulting in auto-del being created automatically
83 * delete auto-del
84 * it's added to `%deleted` and not re-created
85
86 However, unlike the generic autofile infrastructure, `autoindex` forgets
87 that it shouldn't re-create the deleted page in the latter two situations:
88
89 * create auto-del-create-del/child, resulting in auto-del-create-del being
90     created automatically
91 * delete auto-del-create-del; it's added to `%deleted` and not re-created
92 * create auto-del-create-del manually; it's removed from `%deleted`
93 * delete auto-del-create-del again (it's re-created)
94
95 and
96
97 * create create-del-auto
98 * delete create-del-auto; it's not added to `%deleted` because there's no
99     child that would cause it to exist
100 * create create-del-auto/child