Page MenuHomePhabricator

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

Assigned To
Authored By
bzimport
Mar 17 2006, 4:56 PM
Referenced Files
F2695: PATCH.template_preview
Nov 21 2014, 9:10 PM
Tokens
"Haypence" token, awarded by RandomDSdevel."Love" token, awarded by Ciencia_Al_Poder.

Description

Author: p.r.doyle+mediazilla

Description:
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".


Version: unspecified
Severity: normal
URL: http://en.wikipedia.org/wiki/Template:NLL_Team_Infobox

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).

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.

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?

Recursive inclusions are disallowed as a standard protection against loops.

  • Bug 11367 has been marked as a duplicate of this bug. ***

p.r.doyle wrote:

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

  • 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?

Attached:

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

https://gerrit.wikimedia.org/r/137153

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

https://gerrit.wikimedia.org/r/137153

Patch-For-Review

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

https://gerrit.wikimedia.org/r/137153

Jackmcbarn claimed this task.

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