X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/0044039c50a6d85c1fc06e5d079f4b62cbc9629d..4729ff0812c1f3d06d98524e2fec232d3bf90513:/doc/bugs/template_creation_error.mdwn diff --git a/doc/bugs/template_creation_error.mdwn b/doc/bugs/template_creation_error.mdwn index aae75a304..9d6915b09 100644 --- a/doc/bugs/template_creation_error.mdwn +++ b/doc/bugs/template_creation_error.mdwn @@ -198,7 +198,7 @@ Please, let me know what to do to avoid this kind of error. [[!template id=gitbranch author="[[smcv]]" branch=smcv/ready/templatebody browse=http://git.pseudorandom.co.uk/smcv/ikiwiki.git/shortlog/refs/heads/ready/templatebody]] -[[!tag patch]] +[[!tag patch users/smcv/ready]] Branch and directive renamed to `ready/templatebody` as chrysn suggested. It's on-by-default now (or will be if that branch is merged). Joey, any chance you could review this? @@ -234,6 +234,15 @@ same logic as IkiWiki itself. I don't think that's serious. --[[smcv]] >>> drop the contents of `%scanned` and rely on a single boolean >>> flag instead. >>> +>>>> This is not actually good enough for the templatebody +>>>> directive, which does in fact need to scan certain pages +>>>> during the render phase, namely when a page that is rendered +>>>> due to dependencies uses a template that no other page being +>>>> rendered in this pass was using. I've reverted this optimization, +>>>> to fix [[wrong rendering of templatebody]], and applied a more +>>>> limited version which only optimizes rebuilds (the worst case +>>>> of this memory consumption). --[[smcv]] +>>> >>> `%scanned` is likely to be no larger than `%rendered`, which >>> we already track, and whose useful lifetime does not overlap >>> with `%scanned` now. I was tempted to merge them both and call @@ -255,3 +264,23 @@ same logic as IkiWiki itself. I don't think that's serious. --[[smcv]] >>> is a start towards that; the docwiki builds successfully, but >>> the tests that use IkiWiki internals also need updating to >>> set `$phase = PHASE_RENDER` before they start preprocessing. --s + +>>>> reviewing those modifications, i think this is a good way to go. along +>>>> with warning about pagespecs evaluated in scan phase, i think it should be +>>>> an error to invoke scan in the render phase; that would mean that +>>>> `readtemplate` needs to check whether it's invoked as a scan or not to +>>>> decide whether to scan the template page, but would be generally more +>>>> robust for future plugin writing. +>>>> +>>>>> At the moment templatebody really does need to re-scan templates in +>>>>> the render phase, unfortunately. Not scanning in the render phase +>>>>> seems to be precisely how [[wrong rendering of templatebody]] +>>>>> happened. --s +>>>> +>>>> **addendum**: if the new phase state is used to create warnings/errors +>>>> about improper ikiwiki api use of plugins (which is something i'd +>>>> advocate), that should likewise warn if `add_link` actually adds a link in +>>>> the render phase. such a warning would have helped spotting the +>>>> link-related [[template evaluation oddities]] earlier. --[[chrysn]] + +>>>>> [[Merged|done]] --[[smcv]]