Last modified: 2014-09-24 01:03:55 UTC
This is a feature request. Templates sometimes include an example of their own usage inside <noinclude> tags. It would be nice if previewing a change to such a template would reflect the changes. In fact, as far as I know, there is currently no way to preview the effect of a template aside from (1) submitting it, (2) picking a page that includes it, (3) doing a null edit on said page, and (4) inspecting said page. This suggestion would provide a way to preview template changes before they go "live".
There's no such thing as "self-including templates". If it appears to work, that's a bug.
Why not? It's in a <noinclude>. Seems reasonable to me.
At the point of previewing, the template changes aren't saved in the database, so the transclusion processor doesn't know about them, hence can't render them.
Ok, thanks. That explains why it currently doesn't work. Can the transclusion processor be given access to the text of the page being previewed? That probably requires some interface changes, but it may be worthwhile if it allows templates to be previewed.
Self-inclusion would violate the recursion checks; once that bug is fixed there would be nothing to show. Resolving INVALID.
Brion, I'm finding your approach to this bug very frustrating. If you're going to keep closing this bug, can you at least explain why you think this feature should be disallowed?
Recursive inclusions are disallowed as a standard protection against loops.
*** Bug 11367 has been marked as a duplicate of this bug. ***
Recursive inclusions inside <noinclude> can't cause loops.
*** Bug 22341 has been marked as a duplicate of this bug. ***
Created attachment 7454 [details] Patch for rendering This patch adds short-circuits to ParserOptions::mTemplateCallback during the parse() phase of preview, save, and parserTests (bug 8158), which includes the current text of the page instead of the previous revision from the database. This means that it won't change the behaviour of {{subst:, which continues to use the previous page's revision, and any extensions that deal with the current version of the current article will not be able to see the pending revision (as who knows what they might do). Is this approach the right way to do things, and, if so, is this patch sufficient?
Adding Derk-Jan & Gabriel to cc so they can comment on this patch.
*** Bug 63944 has been marked as a duplicate of this bug. ***
Change 137153 had a related patch set uploaded by Jackmcbarn: Use preview content when it transcludes itself https://gerrit.wikimedia.org/r/137153