Someone just used an <onlyinclude> tag in a template in MediaWiki. From playing with it, it seems that the following two examples are identical:
===EX A <noincludeHeader</noinclude Template <noinclude>Footer</noinclude>
===EX B Header <onlyinclude>Template</onlyinclude> Footer
I could not find any documentation on MW.org, meta, en.wp or even Google, and it is not in any of the release notes going back to 1.6. Is this a hyper-new (1.9) feature, or just very poorly documented? If the former, is it safe to use it yet? If the latter, is there a reason for hiding this feature?
- Mark Clements (HappyDog)
On Fri, Oct 13, 2006 at 05:17:03PM +0100, Mark Clements wrote:
I could not find any documentation on MW.org, meta, en.wp or even Google, and it is not in any of the release notes going back to 1.6. Is this a hyper-new (1.9) feature, or just very poorly documented? If the former, is it safe to use it yet? If the latter, is there a reason for hiding this feature?
I'm pretty sure it happened in 1.6, as I needed it in a 1.5 install, and they told me "wait". :-)
It causes the text inside it, IIRC, only to be returned when the page is transcluded in as a template, and not when viewed directly; the opposite of <noinclude>... unless I'm completely insane.
Cheers, -- jra
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jay R. Ashworth wrote:
It causes the text inside it, IIRC, only to be returned when the page is transcluded in as a template, and not when viewed directly; the opposite of <noinclude>... unless I'm completely insane.
Cheers, -- jra
I think that this behavior is the one of <includeonly>, not <onlyinclude>. Anyway, I think all of them (<noinclude>, <includeonly> and <onlyinclude>) were introduced in 1.6.
"Rotem Liss" rotemliss_net@fastmail.fm wrote in message news:452FC01A.7040009@fastmail.fm...
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jay R. Ashworth wrote:
It causes the text inside it, IIRC, only to be returned when the page is transcluded in as a template, and not when viewed directly; the opposite of <noinclude>... unless I'm completely insane.
I think that this behavior is the one of <includeonly>, not <onlyinclude>. Anyway, I think all of them (<noinclude>, <includeonly> and <onlyinclude>)
were
introduced in 1.6.
Yup - Jay's example is for <includeonly>.
Both <includeonly> and <noinclude> are well documented in various places, including the template page on meta. <onlyinclude> is not mentioned at all, which implies that either it was introduced at a later date, or is deliberately 'undocumented' for some reason...
- Mark Clements (HappyDog)
On Fri, Oct 13, 2006 at 05:38:00PM +0100, Mark Clements wrote:
"Rotem Liss" rotemliss_net@fastmail.fm wrote in message news:452FC01A.7040009@fastmail.fm...
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jay R. Ashworth wrote:
It causes the text inside it, IIRC, only to be returned when the page is transcluded in as a template, and not when viewed directly; the opposite of <noinclude>... unless I'm completely insane.
I think that this behavior is the one of <includeonly>, not <onlyinclude>. Anyway, I think all of them (<noinclude>, <includeonly> and <onlyinclude>) were introduced in 1.6.
Yup - Jay's example is for <includeonly>.
Um, "oops". There are *both*?
Both <includeonly> and <noinclude> are well documented in various places, including the template page on meta. <onlyinclude> is not mentioned at all, which implies that either it was introduced at a later date, or is deliberately 'undocumented' for some reason...
Well, clearly, if I could get that wrong, having both is probably a Bad Idea... :-)
Cheers, -- jra
On 10/13/06, Mark Clements gmane@kennel17.co.uk wrote:
I could not find any documentation on MW.org, meta, en.wp or even Google, and it is not in any of the release notes going back to 1.6. Is this a hyper-new (1.9) feature, or just very poorly documented? If the former, is it safe to use it yet? If the latter, is there a reason for hiding this feature?
According to the emails that get posted to wikitech-l, it's been in the automatic test suite since June the 10th. To answer the "when did this happen" side very literally.
I'm curious what the intended uses of it are.
Steve
Steve Bennett-4 wrote:
I'm curious what the intended uses of it are.
It being <onlyinclude>, the intended use is that you can write a page which is intended to be transcluded and demarcate those parts of the page which should appear, rather than those parts which should not.
This would make it simpler when adding further annotation, since it would not have to be labelled as such; when using <noinclude> you have to make sure you add extra text either inside the existing tags or inside new tags.
There is an existing item on BugZilla requesting that when viewing a template, those areas marked with <noinclude> or <onlyinclude> be given a CSS class to allow users to see them more clearly; I forget what the current state of that item is.
HTH HAND
On 10/14/06, Phil Boswell phil.boswell@gmail.com wrote:
It being <onlyinclude>, the intended use is that you can write a page which is intended to be transcluded and demarcate those parts of the page which should appear, rather than those parts which should not.
Can you give an example of an item in that category? That is, primarily documentation, and a tiny bit of implementation spread throughout the documentation? There are lots of templates that vaguely like this:
template code template code<noinclude> documentation categories links to other templates</noinclude>
The surprise factor of a template which is *not* included (except for a tiny bit demarcated with an undocumented tag) seems quite high. I guess I'm fearing a (misguided template) that looks like this:
<noinclude> documentation </noinclude> some code <noinclude> more documentation </noinclude> <onlyinclude> real code </onlyinclude>
It wouldn't be at all obvious to the person "debugging" why "some code" is not getting executed.[1]
All of which is to say: at Wikipedia, using this tag looks like a recipe for confusion. Other wikis can fend for themselves :)
Steve [1] yes, obviously the <noincludes> are redundant - hence "misguided"
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Mark Clements wrote:
I could not find any documentation on MW.org, meta, en.wp or even Google, and it is not in any of the release notes going back to 1.6. Is this a hyper-new (1.9) feature, or just very poorly documented? If the former, is it safe to use it yet? If the latter, is there a reason for hiding this feature?
- Mark Clements (HappyDog)
<includeonly> and <noinlcude> were added here (7 August 2005): http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=10399
<onlyinclude> was added here (25 Ocobter 2005): http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=11494
Parser tests for all of them were added here (25 October 2005): http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=11495
1.5 was branched before all of them were added (1 August 2005), and therefore none of them is exist in 1.5: http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=10341
1.6 was branched after all of them were added (5 April 2006), and therefore all of them were added in 1.6: http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=13501
"Rotem Liss" rotemliss_net@fastmail.fm wrote in message news:452FC5B2.70507@fastmail.fm...
Mark Clements wrote:
I could not find any documentation on MW.org, meta, en.wp or even Google, and it is not in any of the release notes going back to 1.6. Is this a hyper-new (1.9) feature, or just very poorly documented? If the former, is it safe to use it yet? If the latter, is there a reason for hiding this feature?
[SNIP]
1.6 was branched after all of them were added (5 April 2006), and therefore all of them were added in 1.6:
Thanks for that very detailed breakdown. Given that answer, is there a reason that <onlyinclude> is not documented anywhere? I find it an odd omission if they were all introduced at the same time...
- Mark Clements (HappyDog)
On 13/10/06, Mark Clements gmane@kennel17.co.uk wrote:
Thanks for that very detailed breakdown. Given that answer, is there a reason that <onlyinclude> is not documented anywhere? I find it an odd omission if they were all introduced at the same time...
And why do we need both <noinclude> and <includeonly>? Do they not, when placed around slightly different sections of text, perform the same function?
Oldak Quill <oldakquill@...> writes:
On 13/10/06, Mark Clements <gmane@...> wrote:
Thanks for that very detailed breakdown. Given that answer, is there a reason that <onlyinclude> is not documented anywhere? I find it an odd omission if they were all introduced at the same time...
And why do we need both <noinclude> and <includeonly>? Do they not, when placed around slightly different sections of text, perform the same function?
But something interesting that is, any difference between <includeonly> and <onlyinclude>??
Shinjiman
Shinjiman wrote:
Oldak Quill <oldakquill@...> writes:
And why do we need both <noinclude> and <includeonly>? Do they not, when placed around slightly different sections of text, perform the same function?
But something interesting that is, any difference between <includeonly> and <onlyinclude>??
Yes, they do completely different things:
One of them makes the enclosed part only appear during a template inclusion. The other makes an inclusion include only that part.
The better question is, which one is which? :)
These are terribly named, but of course now we're stuck with them for compatibility. Remember this when you next add a feature...
-- brion vibber (brion @ pobox.com)
On 10/14/06, Brion Vibber brion@pobox.com wrote:
These are terribly named, but of course now we're stuck with them for compatibility. Remember this when you next add a feature...
Compatibility with what? Sounds like almost no one is aware of onlyinclude's existence, let alone brave enough to use an undocumented, unannounced feature...?
Incidentally, are there no ambiguous situations (or at least siutations requiring precedence rules to solve) when these various tags are combined? What happens with this text:
<noinclude>foo</noinclude> <onlyinclude>boo</onlyinclude> <includeonly>moo</includeonly> schmoo
I guess when viewed directly you see "foo boo"? (doesn't seem to be clear from above whether <onlyinclude> sections are visible when viewed directly) But when included as a template, do you get "boo" or "boo moo"? I guess only "boo"?
And what about this:
<onlyinclude><noinclude>foo</noinclude></onlyinclude>
? - presumably returns blank.
What if there are multiple <onlyinclude> tags:
<onlyinclude>foo</onlyinclude> <onlyinclude>boo</onlyinclude> moo
- I wouldn't even hazard a guess as to what should/would happen.
I guess this is why documentation would be handy :)
Steve
On 10/14/06, Steve Bennett stevage@gmail.com wrote:
Compatibility with what? Sounds like almost no one is aware of onlyinclude's existence, let alone brave enough to use an undocumented, unannounced feature...?
I've used it, and since it's been around since 1.5, I'm sure there are many other uses too.
What happens with this text:
<noinclude>foo</noinclude> <onlyinclude>boo</onlyinclude> <includeonly>moo</includeonly> schmoo
If you looked at the template, it would say foo boo schmoo. If you include that template, it would say boo. (The same is true if you swap the order of onlyinclude and includeonly.)
And what about this:
<onlyinclude><noinclude>foo</noinclude></onlyinclude>
The template would say foo. If used, it would be blank.
What if there are multiple <onlyinclude> tags:
<onlyinclude>foo</onlyinclude> <onlyinclude>boo</onlyinclude> moo
The template would say foo boo moo. If used, it would say foo boo.
There is a test wiki at http://test.wikipedia.org/ where you could try it.
Angela
Brion Vibber wrote:
Yes, they do completely different things:
One of them makes the enclosed part only appear during a template inclusion. The other makes an inclusion include only that part.
I don't understand. Could someone explain this in an unambiguous way?
"The other makes an inclusion include only that part."
If I take this literally, my understanding of this would be:
As soon as a template contains an <onlyinclude>, then the default mode of transcluding template content changes from "transcluding" to "not transcluding" for that whole template.
Um, this would require a prescan of the whole template searching for the existence of <onlyinclude> in order to determine the initial mode ("transcluding content" versus "not transcluding content").
I fear I'm in error. But then what is it?
Puzzled,
--Ligulem
On Sat, Oct 14, 2006 at 06:34:34AM +0100, Oldak Quill wrote:
On 13/10/06, Mark Clements gmane@kennel17.co.uk wrote:
Thanks for that very detailed breakdown. Given that answer, is there a reason that <onlyinclude> is not documented anywhere? I find it an odd omission if they were all introduced at the same time...
And why do we need both <noinclude> and <includeonly>? Do they not, when placed around slightly different sections of text, perform the same function?
Do this, don't do that; can't you read the signs...?
They reason for such a complimentary pair of operators is that they're self documenting: you can markup what you actually mean, rather than 'not what you don't mean', which can make it easier for latecomers to figure out your intent without extraneous comments.
Cheers, -- jra
wikitech-l@lists.wikimedia.org