User talk:Tennessee Ernie Ford/Templates/Dungeon chest/Includes digression


 * I don't use onlyinclude much at all. I keep on getting it confused with includeonly, but if it's not showing, then I can determine which one it is. It is true that using noinclude *can* cause some spacing problems, it's generally easier to use and more wiki users will understand it. --JonTheMon 20:55, August 25, 2010 (UTC)


 * Okay, I thought I understood these things, but clearly I'm missing something substantial. Are there 3 tags? 4? What is best practice?
 * What's the difference between IncludeOnly and OnlyInclude? Is one better? Why?
 * Is there no value in NoInclude? Does it make sense to explicitly tag both things that should carried forward and those that should not?
 * Does it matter whether the tags are for templates, DPL, or article transclusion?
 * tl;dr What practices should we be using going forward (and is there a good place to document them so that no one gets as confused as I just did). &mdash;Tennessee Ernie Ford ( TEF ) 21:00, August 25, 2010 (UTC)


 * (edit conflict) noinclude / onlyinclude is really just a matter of opinion/habit, as far as I can tell. Either way, you have to know how/where to use them correctly, as you can get extra whitepsace even with onlyinclude if you put it in the wrong place.  &mdash;Dr Ishmael Diablo_the_chicken.gif 21:02, August 25, 2010 (UTC)


 * @Ernie: Transclusion &mdash;Dr Ishmael Diablo_the_chicken.gif 21:03, August 25, 2010 (UTC)


 * Still confused. The linked article suggests that they are different and says nothing at all about white space. My impression is:
 * NoInclude: stuff you want on the source, but not on the destination
 * IncludeOnly: stuff that you want to display on the destination article, but not on the source
 * OnlyInclude: stuff that you want to display on both the source and the destination.


 * The article suggests that there are rules-of-precedence, but doesn't explain them. Left on my own, I would conclude that:
 * Use NoInclude when you want most of the article to show at the destination.
 * Use OnlyIncude when you want only tiny bits to show.
 * Use IncludeOnly when the destination's needs context that the source doesn't.
 * But I don't see anything that suggests that there are best practices. What am I missing? &mdash;Tennessee Ernie Ford ( TEF ) 21:43, August 25, 2010 (UTC)


 * I should've done more searching before posting that link - Wikipedia has a more comprehensive explanation. And this is how I usually explain them:
 * Stuff wrapped in noinclude will display on the source, but will not be transcluded.
 * Stuff wrapped in includeonly will not display on the source, but will be transcluded.
 * onlyinclude acts like the 'inverse' of noinclude: when transcluding, everything outside onlyinclude will be ignored (as if it were all wrapped with noinclude). For example, both of the following are equivalent and would produce "B":
 * I don't know anything about best practices, other than what WP says. &mdash;Dr Ishmael Diablo_the_chicken.gif 22:30, August 25, 2010 (UTC)
 * I don't know anything about best practices, other than what WP says. &mdash;Dr Ishmael Diablo_the_chicken.gif 22:30, August 25, 2010 (UTC)
 * I don't know anything about best practices, other than what WP says. &mdash;Dr Ishmael Diablo_the_chicken.gif 22:30, August 25, 2010 (UTC)

include tags explained
Imagine page A transcludes Template B, i.e. page A has on it. The you open both page A and Template:B in your browser. It is possible to nest all of these tags; in that case, all of the appropriate rules apply together. (See User:M.mendel/Sandbox-include.)
 * 1) Everything on template B is shown on page A, with the following exceptions:
 * 2) Everything tagged noinclude is not shown on page A.
 * 3) Everything tagged includeonly is not shown on Template:B.
 * 4) If at least one onlyinclude tag is present, rule 1 does not apply; instead, only what is tagged onlyinclude is shown on page A.

The trick with whitespace is that if you have a line break at the end of a template, it may combine with a line break in the source to make an empty line = a paragraph break; if templates include other templates, sometimes these add up. These hidden line breaks can occur if you put the &lt;/onlyinclude> on a line by itself (the line break before gets transcluded), or if you have a linebreak after the final &lt;/noinclude>, which is insidious because it's hard to see. If you put such a template on a line by itself, the tanscluding page will have an empty line = paragraph break; if the template is used on the last line of another template, with a line break past it, you may have 2 empty lines, and sometimes more. (Think about how the different paragraph breaks in User:M.mendel/Sandbox-include come to pass; now imagine how difficult that might be if there were line breaks you did not see as easily.)

Generally, I find that it's easier to keep track if the transcluded content is always in &lt;onlyinclude> because then everything that gets transcluded is "out in the open". Sometimes somebody adds a category at the bottom or expands the documentation with no regard for the include tags; with &lt;onlyinclude>, that's perfectly ok, but with &lt;nowiki>, stuff tends to bleed into the trancluding pages because editors do not realize that the end of the page (after the nowiki section) is getting transcluded, too. -- ◄mendel► 15:08, August 26, 2010 (UTC)

Examples:
I want to move that to Forum:Coding anyway, once any remaining questions have surfaced. -- ◄mendel► 20:53, August 26, 2010 (UTC)

. &mdash;Tennessee Ernie Ford ( TEF ) 01:47, August 27, 2010 (UTC)
 * So, I think I already knew these things (from earlier in this convo). What I didn't know is why use one method of tagging over another, with the exception of Mendel's preference for onlyinclude. (I still don't understand why it doesn't make sense to explicitly tag both includes and excludes; seems even less likely to to get confused down the road.) At this point, it seems to me that we should decide upon a guideline for this wiki, so that it's more likely that we're in synch instead of stepping on each other's
 * The reason to use onlyinclude is that the other method misleads people; since you think it is possible to "explicitly tag both includes and excludes", you have already been so misled. You can either tag one or the other, but not both. -- ◄mendel► 07:40, August 27, 2010 (UTC)


 * Ok, you've managed to confuse me again. Your notes sound like you can tag everything. Unless you screw up the tags (e.g. as in whoops ), why wouldn't you want to put every bit of code on a source page (template or article) into one of the three tags?


 * Everything tagged noinclude is not shown on page A.
 * Isn't that explicitly tagging what is excluded?


 * If at least one onlyinclude tag is present, rule 1 does not apply; instead, only what is tagged onlyinclude is shown on page A.
 * Doesn't that explicitly tag what is included?


 * Everything tagged includeonly is not shown on Template:B.
 * Doesn't that explicitly tag items as a converse (definitively not shown in source, definitively shown at destination)


 * The reason I'm harping on this: tagging everything clues in future editors to the original intent.  demonstrates clearly which parts the originators meant to transclude and which not. In contrast,   leaves ambiguous about the plans the editors had for that.


 * Regardless, I think this conversation suggests that we should start making better use of commenting, which is an even surer way of 'splainin' the way it spozed to be. &mdash;Tennessee Ernie Ford ( TEF ) 10:08, August 27, 2010 (UTC)


 * Mendel's point is that if you use [onlyinclude], then there's no point or reason to use [noinclude] at all. Likewise, if you use [noinclude], then there's no reason to use [onlyinclude] with it.  Using both together is what would "mislead" people into thinking it was required to explicitly tag both types of sections.  You either tag the sections you want included, or you tag the sections you don't want included, you don't do both.  The practical difference, which you can see with how the 'x' is treated in mendel's examples, is:
 * Using [noinclude] means that everything outside [noinclude] gets included.
 * Using [onlyinclude] means that everything outside [onlyinclude] does not get included.
 * Mendel's other point is that there's less chance for "mistakes" when you use [onlyinclude], since you are designating exactly what you want included. With [noinclude], you have to be more careful that you are getting every little bit that you don't want included.  Because I fully understand that distinction, I don't see any practical difference between the two.
 * ([includeonly] doesn't affect which sections of the page get included, it's only used to hide things on the source page, so you would still use it with either of these approaches.) &mdash;Dr Ishmael Diablo_the_chicken.gif 13:01, August 27, 2010 (UTC)