Help talk:Transclusion
This is the talk page for discussing improvements to the Transclusion page. |
|
Archives: 1, 2Auto-archiving period: 12 months ![]() |
![]() | This help page does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||
|
![]() | On 11 August 2020, it was proposed that this page be moved from Wikipedia:Transclusion to Help:Transclusion. The result of the discussion was moved. |
How do we transclude and feature images from the infobox or another source?
[edit]This help should include that -- that's what I'm looking for right now. Been all over the web. If the image in the article is in the infobox, it does not reflect in the transclusion. Danidamiobi (talk) 11:40, 7 October 2022 (UTC)
- Do you think you could link to the article or place you are trying to transclude from? There could be a variety of reasons it doesn't work, so specifics would be helpful. Aidan9382 (talk) 11:43, 7 October 2022 (UTC)
Notes and refs
[edit]I'm working on the 1930 FIFA World Cup page and have run into some problems with transcluded tables. As the group stage results and match information is being transcluded from their respective pages, it's leading to duplicate refs and notes. Is there anyway to avoid this without manually reinserting the tables? Kosack (talk) 15:11, 13 January 2023 (UTC)
Help with lst in Draft space
[edit]I'm developing this draft, and attempted to use labeled section transclusion in this edit to import a small section from another draft, but it didn't work. (I've since duplicated the text in both places, so the current revision of the draft no longer uses lst.) I'm wondering if there was something wrong with the way I labeled the lst section name containing the "Draft:" prefix, or whether lst simply does not support use of Draft space. If the latter is the case, then I would like to update the documentation at WP:SELTRANS and at Help:Labeled section transclusion to mention the fact that it is not supported. (If it's a config issue, i.e., supportable per the Mediawiki extension but not currently supported at en-wiki, then I'd like to see about having our implementation of the extension configuration altered so it is supported; but that's a different issue, probably for WP:VPR or WP:VPT.) If it's fixable as is, feel free to fix it in the Draft, or just let me know what I did wrong. Thanks, Mathglot (talk) 00:56, 21 January 2023 (UTC)
- @Mathglot: You tried to transclude with
{{#section:Draft:Glossary of French criminal law|ordre publique}}
but you had marked the section with<section begin="ordre public" />
.[1] Use the same spelling of the label. PrimeHunter (talk) 02:28, 21 January 2023 (UTC)- @PrimeHunter: Omg, what a dumb error; I feel like an idiot. Thanks for taking the time. Mathglot (talk) 02:33, 21 January 2023 (UTC)
Make sense of lede paragraph on parsing and HTML syntax fragments
[edit]Can someone help me make sense of this entire paragraph in the lede? What exactly are these syntax fragments? I want to kind of reword this paragraph so it makes more sense to the layman, i.e. me, who doesn't understand this terminology. With the goal being a paragraph that kind of explains the implications of said transclusion occuring before parsing and thus emitting of syntax fragments, and hence what considerations need to be had; as this is what is what a help document is about.
Transclusion runs before full page parsing. The content being transcluded is processed and embedded before the target page is parsed and fully rendered. When transclusion happens at the HTML layer before parsing, it allows certain content – like syntax fragments such as
&
andmp;
instead of the proper character entity reference&
or unclosed tags like an unclosed<div>
tags – to be inserted in their original form and preserved in the final render. However, this approach may cause pages to render incorrectly or violate the principle of least surprise for the reader.[a] It should be used sparingly when cleaner alternatives are not available. Emitting fragments of template syntax, such as opening braces ({{
), is unlikely to re-parse correctly as template syntax in the target page, and it is unwise to rely on such behavior unless formally documented.
should it rather say:
Transclusion runs before Wikipedia fully processes (parses) a page, meaning that content from a template or another page is inserted first and only afterward is the entire page rendered. Because of this, transclusion can introduce incomplete pieces of code ("syntax fragments"), such as partially formed HTML entities or wikitext elements that don't function as expected. This can sometimes cause formatting issues or unexpected behavior.
To avoid this, editors should ensure that transcluded content is complete and does not introduce partial syntax that could break the page. Using transclusion to generate incomplete template code—such as an opening
{{
without a closing}}
—is unreliable and should not be depended upon unless officially documented.
Or can someone provide clarity? waddie96 ★ (talk) 15:15, 17 February 2025 (UTC)
- Possibly mw:Help:DiscussionTools/Why can't I reply to this comment?#Accidental complex transclusion? waddie96 ★ (talk) 15:28, 17 February 2025 (UTC)
- Waddie96, I get what is meant by the fragments, but it shouldn't be in the lead, and I can't see who would be helped by including it in the body, either. The type of person who comes to a Help page on transclusions is not going to be generating syntax fragments and then coming here to figure out some issue with the pieces not assembling correctly. If someone creates Help:Advanced transclusion, it can go there (still not in the lead, however). The last paragraph of the lead was added 31 Oct. 2023 by MaxEnt (talk · contribs), and in its current state detracts more than it adds. I favor removing it and moving to the Advanced article; maybe Max wants to take that on. Mathglot (talk) 08:30, 18 February 2025 (UTC)
- I've gone ahead and temporarily moved it to Help:Transclusion § Advanced concepts until such time as the 'main' if we should pre-emptively label it Help:Advanced transclusion is created one day. It's awfully advanced and confusing, even to the technically advanced... waddie96 ★ (talk) 11:12, 18 February 2025 (UTC)
- @Mathglot forgot to ping in case you not subscribed. waddie96 ★ (talk) 11:12, 18 February 2025 (UTC)
- Waddie96, I get what is meant by the fragments, but it shouldn't be in the lead, and I can't see who would be helped by including it in the body, either. The type of person who comes to a Help page on transclusions is not going to be generating syntax fragments and then coming here to figure out some issue with the pieces not assembling correctly. If someone creates Help:Advanced transclusion, it can go there (still not in the lead, however). The last paragraph of the lead was added 31 Oct. 2023 by MaxEnt (talk · contribs), and in its current state detracts more than it adds. I favor removing it and moving to the Advanced article; maybe Max wants to take that on. Mathglot (talk) 08:30, 18 February 2025 (UTC)
Notes
[edit]- ^ For example, if whitespace, tabs, and newline HTML code are preserved without parsing, the final page may display awkward spacing, misalignments, or unexpected breaks. This whitespace is usually added in the source code to improve readability for developers and isn’t intended to appear in the published content.