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