MW1.5: When do magic words bind in transclusion?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

MW1.5: When do magic words bind in transclusion?

Jay Ashworth-2
I'm working on a (clearly :-) non-WMF project using MediaWiki, and I've
tripped over something that I can't figure out how to do using the
templating language.

Several things I've seen in various WP templates suggest there are many
thing about that part of the parser that I don't understand (and can't
locate doco for), but if there's a better list than this on which to
ask, please let me know.

And so, to the problem:

I'm trying to use MW as a database.

I just wanted to get out of the way up front that I realize that's the
problem here.  :-)

I have a template ("A").

This template is instantiated on many pages ("A"->"B", "A"->"C", "A"->"D").

Those pages are in turn transcluded onto other pages:

"A"->"B"->"E"
"A"->"B"->"F"
"A"->"B"->"G"
"A"->"C"->"H"
"A"->"C"->"I"
"A"->"C"->"J"
"A"->"D"->"K"
"A"->"D"->"L"

What I'm trying to accomplish is to include a link on "A" that, when
the user is looking at "I" will permit them to edit "C".

I had been hoping that I could include the PAGENAMEE magic word in the
template ("A") as part of an HTTP edit link, but alas, PAGENAMEE (and
presumably all the other magic words that pertain to pages) bind so
late in the parse chain that they point to "I" in that situation.

In a situation like this, is there any reasonable way to grab the name
of "C" from inside the code of "A"?  Something with subst:, maybe?

The actual pages are
A: http://tbkinfo.net/wiki/index.php/Template:Infobox_Show
C: http://tbkinfo.net/wiki/index.php/O%27Maddy%27s_House
I: http://tbkinfo.net/wiki/index.php/O%27Maddy%27s

Cheers,
-- jra
--
Jay R. Ashworth                                                [hidden email]
Designer                          Baylink                             RFC 2100
Ashworth & Associates        The Things I Think                        '87 e24
St Petersburg FL USA      http://baylink.pitas.com             +1 727 647 1274

        A: No.
        Q: Should I include quotations after my message body?
_______________________________________________
Wikitech-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: MW1.5: When do magic words bind in transclusion?

Platonides
Maybe you could instatiate A in B as {{A|B}}, in C as {{A|C}} etc. to get C
in A, when A gets into I?

"Jay R. Ashworth" wrote:

> I have a template ("A").
>
> This template is instantiated on many pages ("A"->"B", "A"->"C",
> "A"->"D").
>
> Those pages are in turn transcluded onto other pages:
>
> "A"->"B"->"E"
> "A"->"B"->"F"
> "A"->"B"->"G"
> "A"->"C"->"H"
> "A"->"C"->"I"
> "A"->"C"->"J"
> "A"->"D"->"K"
> "A"->"D"->"L"
>
> What I'm trying to accomplish is to include a link on "A" that, when
> the user is looking at "I" will permit them to edit "C".
>
> I had been hoping that I could include the PAGENAMEE magic word in the
> template ("A") as part of an HTTP edit link, but alas, PAGENAMEE (and
> presumably all the other magic words that pertain to pages) bind so
> late in the parse chain that they point to "I" in that situation.
>
> In a situation like this, is there any reasonable way to grab the name
> of "C" from inside the code of "A"?  Something with subst:, maybe?
>
> The actual pages are
> A: http://tbkinfo.net/wiki/index.php/Template:Infobox_Show
> C: http://tbkinfo.net/wiki/index.php/O%27Maddy%27s_House
> I: http://tbkinfo.net/wiki/index.php/O%27Maddy%27s
>
> Cheers,
> -- jra



_______________________________________________
Wikitech-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: MW1.5: When do magic words bind in transclusion?

Jay Ashworth-2
On Sat, Feb 18, 2006 at 11:05:14PM +0100, Platonides wrote:
> Maybe you could instatiate A in B as {{A|B}}, in C as {{A|C}} etc. to get C
> in A, when A gets into I?

I could, if that's the only solution.  But everything except A will be
being created by civilians.

Cheers,
-- jra
--
Jay R. Ashworth                                                [hidden email]
Designer                          Baylink                             RFC 2100
Ashworth & Associates        The Things I Think                        '87 e24
St Petersburg FL USA      http://baylink.pitas.com             +1 727 647 1274

        A: No.
        Q: Should I include quotations after my message body?
_______________________________________________
Wikitech-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: MW1.5: When do magic words bind in transclusion?

Jay Ashworth-2
In reply to this post by Jay Ashworth-2
On Sat, Feb 18, 2006 at 01:03:17PM -0500, Jay R. Ashworth wrote:

> I have a template ("A").
>
> This template is instantiated on many pages ("A"->"B", "A"->"C", "A"->"D").
>
> Those pages are in turn transcluded onto other pages:
>
> "A"->"B"->"E"
> "A"->"B"->"F"
> "A"->"B"->"G"
> "A"->"C"->"H"
> "A"->"C"->"I"
> "A"->"C"->"J"
> "A"->"D"->"K"
> "A"->"D"->"L"
>
> What I'm trying to accomplish is to include a link on "A" that, when
> the user is looking at "I" will permit them to edit "C".
>
> I had been hoping that I could include the PAGENAMEE magic word in the
> template ("A") as part of an HTTP edit link, but alas, PAGENAMEE (and
> presumably all the other magic words that pertain to pages) bind so
> late in the parse chain that they point to "I" in that situation.
>
> In a situation like this, is there any reasonable way to grab the name
> of "C" from inside the code of "A"?  Something with subst:, maybe?

And it turns out I was damned close.  Further spelunking in the help,
which I was too sick to do the other day, apparently, suggests that the
comments in the subst section at

  http://en.wikipedia.org/wiki/Help:Variable#Depending_on_page

to wit:

  When a template containing
  {{<includeonly>subst:</includeonly>PAGENAME}} is subst'ed in a page,
  the name of the latter page is put in the wikitext, and similarly for
  other variables.

which is precisely what I need: when someone creates a B which
transcludes A, B will contain it's own name as part of the edit link.

But it doesn't appear to be working.  The created B instead includes
the uninterpreted {{<includeonly>subst:</includeonly>PAGENAME}} .

This is in 1.5.3.  That help page doesn't say 1.6-only as some do; is
this a 1.6-only behavior anyway?  Or am I missing something else?

Cheers,
-- jra
--
Jay R. Ashworth                                                [hidden email]
Designer                          Baylink                             RFC 2100
Ashworth & Associates        The Things I Think                        '87 e24
St Petersburg FL USA      http://baylink.pitas.com             +1 727 647 1274

        A: No.
        Q: Should I include quotations after my message body?
_______________________________________________
Wikitech-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Probably SOLVED: MW1.5: When do magic words bind in transclusion?

Jay Ashworth-2
On Mon, Feb 20, 2006 at 03:52:58PM -0500, Jay R. Ashworth wrote:

>   When a template containing
>   {{<includeonly>subst:</includeonly>PAGENAME}} is subst'ed in a page,
>   the name of the latter page is put in the wikitext, and similarly for
>   other variables.
>
> which is precisely what I need: when someone creates a B which
> transcludes A, B will contain it's own name as part of the edit link.
>
> But it doesn't appear to be working.  The created B instead includes
> the uninterpreted {{<includeonly>subst:</includeonly>PAGENAME}} .
>
> This is in 1.5.3.  That help page doesn't say 1.6-only as some do; is
> this a 1.6-only behavior anyway?  Or am I missing something else?

As RedACE pointed out on IRC, it's <includeonly> that's version
specific, and while it's supposed to require 1.6, I'm told it will
probably work on 1.5.6, which we'll upgrade to tonight.

Cheers,
-- jra
--
Jay R. Ashworth                                                [hidden email]
Designer                          Baylink                             RFC 2100
Ashworth & Associates        The Things I Think                        '87 e24
St Petersburg FL USA      http://baylink.pitas.com             +1 727 647 1274

        A: No.
        Q: Should I include quotations after my message body?
_______________________________________________
Wikitech-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Probably SOLVED: MW1.5: When do magic words bind in transclusion?

Jay Ashworth-2
On Tue, Feb 21, 2006 at 01:47:38PM -0500, Jay R. Ashworth wrote:

> On Mon, Feb 20, 2006 at 03:52:58PM -0500, Jay R. Ashworth wrote:
> >   When a template containing
> >   {{<includeonly>subst:</includeonly>PAGENAME}} is subst'ed in a page,
> >   the name of the latter page is put in the wikitext, and similarly for
> >   other variables.
> >
> > which is precisely what I need: when someone creates a B which
> > transcludes A, B will contain it's own name as part of the edit link.
> >
> > But it doesn't appear to be working.  The created B instead includes
> > the uninterpreted {{<includeonly>subst:</includeonly>PAGENAME}} .
> >
> > This is in 1.5.3.  That help page doesn't say 1.6-only as some do; is
> > this a 1.6-only behavior anyway?  Or am I missing something else?
>
> As RedACE pointed out on IRC, it's <includeonly> that's version
> specific, and while it's supposed to require 1.6, I'm told it will
> probably work on 1.5.6, which we'll upgrade to tonight.

Spake I too soon.

The link, in my 'A' template, looks like this:

  [http://tbkinfo.net/wiki/index.php?title={{<includeonly>subst:</includeonly>NAMESPACE}}:{{<includeonly>subst:</includeonly>PAGENAMEE}}&action=edit
  (edit this show)]

When I'm looking at the rendered version *of A*, I get a link with A's
edit URL:

  http://tbkinfo.net/wiki/index.php?title=Template:Infobox_Show&action=edit

If I include A in C, I get the raw text of the includeonly tags:

  http://tbkinfo.net/wiki/index.php?title={{subst:NAMESPACE}}:{{subst:PAGENAMEE}}&action=edit

while I'm looking at the link on C.

TimStarling: is that the bug you thought you backported a fix for?  Or
am I just screwed until 1.6?

Cheers,
-- jra
--
Jay R. Ashworth                                                [hidden email]
Designer                          Baylink                             RFC 2100
Ashworth & Associates        The Things I Think                        '87 e24
St Petersburg FL USA      http://baylink.pitas.com             +1 727 647 1274

        A: No.
        Q: Should I include quotations after my message body?
_______________________________________________
Wikitech-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/wikitech-l