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)