Page MenuHomePhabricator

Self-including templates should reflect changes on preview
Closed, ResolvedPublic


Author: p.r.doyle+mediazilla

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

Version: unspecified
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:10 PM
bzimport set Reference to bz5278.
bzimport added a subscriber: Unknown Object (MLST).
brion added a comment.Mar 17 2006, 7:52 PM

There's no such thing as "self-including templates". If it appears to work, that's a bug.

p.r.doyle+mediazilla wrote:

Why not? It's in a <noinclude>. Seems reasonable to me.

robchur wrote:

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.

p.r.doyle+mediazilla wrote:

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.

brion added a comment.Apr 2 2006, 3:08 AM

Self-inclusion would violate the recursion checks; once that bug is fixed there
would be nothing to show. Resolving INVALID.

p.r.doyle+mediazilla wrote:

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?

brion added a comment.Apr 2 2006, 7:12 PM

Recursive inclusions are disallowed as a standard protection against loops.

IAlex added a comment.Sep 21 2009, 4:58 PM
  • Bug 11367 has been marked as a duplicate of this bug. ***

p.r.doyle wrote:

Recursive inclusions inside <noinclude> can't cause loops.

IAlex added a comment.Feb 1 2010, 4:05 PM
  • Bug 22341 has been marked as a duplicate of this bug. ***

conrad.irwin wrote:

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?


sumanah wrote:

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

Change 137153 had a related patch set uploaded (by Jackmcbarn):
Use preview content when it transcludes itself


Change 137153 merged by jenkins-bot:
Use preview content when it transcludes itself

Jackmcbarn closed this task as Resolved.Dec 31 2014, 5:28 PM
Jackmcbarn claimed this task.

The fix will be live on all WMF wikis on January 14th.