Help talk:Transclusion

From Wikisource
Jump to navigation Jump to search

Header[edit]

Header parameter? VadimVMog (talk) 06:18, 18 August 2012 (UTC)[reply]

Done done. Chris55 (talk) 11:38, 18 August 2012 (UTC)[reply]

Labeled Section Transclusion markup[edit]

I see that section transclusion in Wikisource is using a different markup than the default Extension:Labeled Section Transclusion, with things like ## label ## and {{#section}}. How were these introduced? Installing Labeled Section Transclusion and Extension:Proofread Page doesn't produce this behavior, and I've looked through the extension list for Wikisource and don't see any likely candidates. Thanks! ~ Michael Chidester (talk) 02:36, 13 May 2013 (UTC)[reply]

It's a gadget. See Wikisource:Scriptorium/Archives/2010-11#Easy_LST. Beeswaxcandle (talk) 02:49, 13 May 2013 (UTC)[reply]

Table of contents?[edit]

It looks like transcluding from the Page namespace fails to produce a Mediawiki table of contents. Here is a test case at User:Jerome Charles Potts/draft/test ; if you examine the source HTML, you can search for the various <h (2, 3, 4) tags ; there are enough of them to, i believe, normally produce a TOC. I added the __FORCETOC__ "magic word", but that too failed. Is this a bug, or a feature ? --Jerome Charles Potts (talk) 02:46, 17 January 2016 (UTC)[reply]

This is correct behaviour. Works mostly come with their own TOC and we don't want the Mediawiki one as well. If a work doesn't have a TOC and it would be useful, then we use {{AuxTOC}}. Beeswaxcandle (talk) 03:21, 17 January 2016 (UTC)[reply]
Thank you much for the answer. I think that i deplore this feature, as i suppose that a __NOTOC__ would solve the "problem". --Jerome Charles Potts (talk) 07:26, 17 January 2016 (UTC)[reply]
@Jerome Charles Potts: we are also reproducing a work, not updating it to our version of what we think that it should be. That said, we do have means to add ToC through use of templates see Category:TOC templates. These would be added to the Notes section, and often link to various components. Quite useful for adding to Indexes when we want to get to specific letters. So while we would not do ToC for all works, if you can present a case for a specific work, then we always happy to see how that will aid navigation, etc. To also note that many 19thC works have chapter ToC as part of their design, do feel that you can add anchors to those, though I haven't seen that approach widely taken. — billinghurst sDrewth 01:53, 18 January 2016 (UTC)[reply]

Syntax[edit]

The instructions read, in part:

<pages index="file name.djvu" from=x to=y/>
  • "file name.djvu" is replaced with the exact name of the Index you are working with.
  • The number after the slash (/) following the file name of the first page you wish to transclude is "x".
  • The number after the slash (/) following the file name of the final page you wish to transclude is "y".

Should this not be:

<pages index="file name.djvu" from=x to=y/>
  • "file name.djvu" is replaced with the exact name of the Index you are working with.
  • The number after the equals sign (=) following the file name of the first page you wish to transclude is "x".
  • The number after the equals sign (=) following the file name of the final page you wish to transclude is "y".

? Laura1822 (talk) 11:37, 3 November 2016 (UTC)[reply]

@Laura1822: It means that for something like Page:A biographical dictionary of eminent Scotsmen, vol 1.djvu/84 that it is "84", so after the forward slash. — billinghurst sDrewth 11:40, 3 November 2016 (UTC)[reply]
I see now, thank you! But obviously, that wasn't clear to me before. Laura1822 (talk) 12:55, 3 November 2016 (UTC)[reply]

Dealing with a new paragraph at the begin of a page[edit]

When transcluding pages, it automatically adds a space between the last letter of a page and the first letter of the next page and continue as one paragraph. If a paragraph ends at a page and a new one starts on the next page, how to transclude them correctly in the main namespace? Even the exampled work (The Wind in the Willows (1913)) has that problem. Page 126 is a new paragraph but it goes into the previous paragraph in the transclusion page. Any trick to force a new paragraph? Vinhtantran (talk) 07:02, 20 December 2018 (UTC)[reply]

Nevermind. I found template {{nop}}, and corrected the mentioned page as well. Vinhtantran (talk) 07:07, 20 December 2018 (UTC)[reply]

Transcluding within a page[edit]

I'm working on legislative projects, and within the Social Security Act 2018, it has a table of contents at the beginning, and then throughout the document at each "Part", it repeats parts of the table of contents that are relevant to that part, i.e. Page:Social_Security_Act_2018.pdf/23, so instead of repeating the table of contents throughout this vast document, I wanted to create sections around parts of the table of contents. Unfortunately, transclusion doesn't seem to work on one page from another page.

Is there a work-around I could use? If this were just a static document, then just repeating the TOC would be fine, but legislation is a living document, it gets amended, repealed, and generally changed many many times. So making things easier now by having the sub-TOC sections auto-update with the first will save time and edits.Supertrinko (talk) 21:09, 27 August 2020 (UTC)[reply]

@Supertrinko: We capture legislation at a point in time, rather than continually update a file. Each amendment should be on its own page. Thus, treat this as a static document. Beeswaxcandle (talk) 06:06, 28 August 2020 (UTC)[reply]
@Beeswaxcandle: Yes, don't worry, each amendment will be added as its own document and the act I referenced is the original. However, when amendments are included, new versions of legislation are printed, so I'd still like the ability to transclude in the method I've asked about when I get to that stage. Each document will remain static, but cross-transclusion like this will be incredibly useful. Supertrinko (talk) 02:03, 29 August 2020 (UTC)[reply]

Sub-page linking[edit]

Hi, if we're using transclusion, can we still use [[../Subpage]] style links? These seem to work on the transcluded page, but then on the [[Page:]], it's a red link as it's trying to link to a sister page.

As an example, I've got a link on Page:Pensions_Act_1856.pdf/1 labelled [[../Schedule A|Schedule A]], it works perfectly fine on Pensions Act 1856/Section 2 because Pensions Act 1856/Schedule A is a sister of it.

Is this just not a feature we can use if we want to transclude pages? I'm perfectly fine to avoid its use, just seeing if there's a way to make it work that I haven't thought of, as "../" is certainly more convenient. Thanks! Supertrinko (talk) 21:27, 2 September 2020 (UTC)[reply]

Solved this problem by adjusting how I use templates and <includeonly><noinclude> Supertrinko (talk) 02:55, 17 September 2020 (UTC)[reply]
You cannot use relative links in this way, because in the Page namespace, the page has no idea where it's going to appear in the end. It could even appear multiple times (e.g. every page using tosection and fromsection is transcluded twice).
It is very annoying when doing TOCs, but there may be hope on the horizon with some ProofreadPage wizardry. For now, sadly, just use absolute links. Inductiveloadtalk/contribs 12:26, 29 September 2021 (UTC)[reply]
Agreed, just straight using relative links was broken and ugly, which is why I created {{LinkedTOC row 1-1-1}}, which generates the links differently for the Page namespace than for the mainspace. Supertrinko (talk) 20:26, 30 September 2021 (UTC)[reply]

Is there a way to use magic words when declaring what index to transclude?[edit]

I've got Index:Social Security Act 2018.pdf, and over at Social Security Act 2018/Section 1, I'm transcluding part of it using:

<pages index="Social Security Act 2018.pdf" from=22 fromsection=s1 to=22 tosection=s1 />

Is there a way to make something like this work?

<pages index="{{BASEPAGENAME}}.pdf" from=22 fromsection=s1 to=22 tosection=s1 />

<pages index={{BASEPAGENAMEE}}.pdf from=22 fromsection=s1 to=22 tosection=s1 />

Currently these just returns: "Error: No such index"

I even tried creating the tiniest template {{2str}} to combine two strings like:

<pages index={{2str|{{BASEPAGENAMEE}}|.pdf}} from=22 fromsection={{SUBPAGENAME}} to=22 tosection={{SUBPAGENAME}} />

No luck (feel free to delete that template, I don't think I can.)

Seems magic words might resolve after the page index runs?

Just means when going and updating different versions of the same section, it'll be easier because it's one less thing to update. Supertrinko (talk) 02:55, 17 September 2020 (UTC)[reply]

@Supertrinko: No, that won't work. And it's not desirable in general either, since the Index: usually has a different name than the page it is transcluded on. If you have a specific work with a lot of subpages we can investigate other ways to lighten the load (bot creation etc.). Xover (talk) 11:59, 29 September 2021 (UTC)[reply]
In this specific case, I'd suggest transcluding onto the handful of pages /Part 1, /Part 2, etc, rather than into 400 sections of a few paragraphs or less each. Then do the linking to sections within that page using {{anchor}} and friends. Inductiveloadtalk/contribs 12:23, 29 September 2021 (UTC)[reply]
It's very much a standardised way of formatting legislation to have separate pages for each section. Creating the 400 pages isn't the challenging part as each page is a minor variation of the last and could probably be automated. Supertrinko (talk) 20:14, 29 September 2021 (UTC)[reply]
It might be "standardised" when the legislation itself is being pulled out of a properly structured database like https://legislation.govt.nz does (note that they also provide an all-in-one version here, because that comes for free when you have a dynamic data-driven website), but I'm unsure of the actual benefit of splitting up that much at Wikisource other than making absolutely certain that all maintenance must be done with bots. Sectional linking can be done with anchors, and it doesn't mean a reader has to load and flip between 400 separate pages.
But then again, shoehorning legislation into Wikitext at WS will pretty much always be a worse UX than a website designed for the purpose, so I guess it's all just degrees of badness. Inductiveloadtalk/contribs 21:20, 29 September 2021 (UTC)[reply]

@Supertrinko: Yes, there is a way to leverage transclusion using magic words, it is the standard way that I do it, especially where I have subpages and sections to transclude, this is the simple model. {{#tag:pages||index={{subst:BASEPAGENAME}}.djvu|from=|to=}} BUT BUT BUT as Inductiveload says, please please please do not go to so many subpage, it is just but ugly on the web AND when we do Wikidata links, it firstly become more ugly for little benefit, but it is often better to add legislation by the major sections as they are more holistic and match subjects; well at least with Australian legislation that I read, so guess is similar with NZ. I think major chunks is good, and bite-size junks is bad. — billinghurst sDrewth 16:03, 30 September 2021 (UTC)[reply]

Major part of the work this way is in the initial planning and design. I have explained my black magic before though cannot remember where it was as it was a while ago. — billinghurst sDrewth 16:08, 30 September 2021 (UTC)[reply]
Thanks! That's a fantastic way of using magic words with transclusion, I'll be sure to make use of it! Supertrinko (talk) 20:26, 30 September 2021 (UTC)[reply]

@Billinghurst: @Inductiveload: If this conversation should be elsewhere, please feel free to move it.

Regarding creating pages for sections vs pages for parts, it was just the most logical conclusion I came to. Amongst NZ legislation (and most common law legislation), not all acts are split into parts or sub-parts. But all are split into sections, so that seems to be the only consistent way of breaking up the legislation into smaller parts. Sections are also the most recognisable sub-division of a legislative instrument.

I think consistency is incredibly important for legislation on Wikidata. If every legislative instrument is different even within one jurisdiction, it becomes harder to read and harder to use.

Another benefit of this consistency would be predictable links i.e. wikisource.org/wiki/[Legislation Name]/Section_[No.]

That means that you can create links to legislation that haven't even started to be uploaded onto Wikisource because all the page names are completely predictable (There are ways to hide broken links, or we might like to leave them broken to encourage the leg to be added). Once you know how wikisource arranges legislation, there's never a need to find out the link to a page because you can just infer it.

Regarding the individual pages, I don't think they look "ugly" at all. I think Social Security Act 2018 (Version 56)/Section 8 is a really neat way of presenting that section. Most sections are self contained anyway, so generally you're not looking at two sections together. You click your link to your section and there's everything you need, what could be ugly about that?

Regarding holistics, Of the acts that are split into parts (Such as the one I'm linking to), yes, they are arranged such that similar and related sections are grouped together. However still, they are generally grouped together for the purposes of easy navigation. It's not so common to need to read so many sections at the same time. And with the Social Security Act 2018 (Version 56)/Part 1 page, it's barely an inconvenience.

A reader will never need to flip between 400 pages, you don't read entire legislative documents, you read the sections you need. But if they do, the fantastic thing with transclusion is you can do something like this: Pensions Act 1849/Whole vs Pensions Act 1849/Section 2. Only recommended for smaller acts.

Regarding Wikidata, it shouldn't make things particularly complex. Sections again are an easily predictable way of breaking up an act into items. Example: Section 8 would be Part of (P361) its parent act.

However, as Inductiveload pointed out, it will inevitably mean bot work. This however is why I asked for Billinghurst's solution on magic words, Ideally once these pages are created, any maintenance on them should be exceptionally rare. Legislation is exceptionally large and I think either way it's something that should be supported by bots.

So upon further consideration, I still think pages per section is the best way to go, but I'm interested in your thoughts. I've been convinced to change my mind plenty of times before here on wikisource. Supertrinko (talk) 20:26, 30 September 2021 (UTC)[reply]

@Supertrinko: This is not the best place to discuss legislation transclusion, so I will keep it short. As a user of legislation in real life, I prefer reading by division or part, though that is me, reading by section irritates me as a reader. Yes, the courts hear cases based on breaches of sections, but we are not that legal publisher. I can cope with scrolling down a page. But that could just be me. — billinghurst sDrewth 00:56, 1 October 2021 (UTC)[reply]


{{#tag:pages||index={{subst:BASEPAGENAME}}.djvu|from=|to=}}
{{#tag:pages||index={{subst:BASEPAGENAME}}.djvu|from=|to=|fromsection={{subst:SUBPAGENAME}}|tosection={{subst:SUBPAGENAME}}}}
{{#tag:pages||index={{subst:BASEPAGENAME}}.djvu|include=|onlysection={{subst:SUBPAGENAME}}}}
{{DEFAULTSORT:{{subst:SUBPAGENAME}}}}
{{subst:#tag:ref|}}

are my sidebar shortcuts or toolbar shortcuts that I press when I am transcluding works. Having these available through templatescript just makes life so much easier. The best bit is that you don't need to wrap inside quotes as the elements presume that to be the case, which is why you will see me just transcluding this way rather than using <pages>.

Subst'ing ref is useful when you have other subst: inside it or when you need to add name of follow, as it just becomes {{#tag:ref|texttexttext|follow=yourref}} adn if you are subst;'ing other tings inside the ref, then it just works. If you have lots of complex template code then you get a forest of curly brackets which can be an issue. — billinghurst sDrewth 00:56, 1 October 2021 (UTC)[reply]

Is there a page name (page title) case (capitalization) preference?[edit]

  1. A Dictionary Of The Qawsedrftgy Language
  2. A Dictionary of the Qawsedrftgy Language
  3. A dictionary of the Qawsedrftgy language

Fish bowl (talk) 05:49, 29 July 2022 (UTC)[reply]

See Wikisource:Style guide#Page titles. (Leaving this here for anyone else who is looking in the wrong place.) Fish bowl (talk) 05:58, 29 July 2022 (UTC)[reply]

How to force removing (and on the opposite, force showing) the banners mentioned file names?[edit]

I think this thing shall be controlled by some functions, otherwise such banners may be ugly occur. Liuxinyu970226 (talk) 23:18, 29 June 2023 (UTC)[reply]

Problem on fa.wiki[edit]

Recently when we do transclusion on fa.wikisource we don't see numbers of pages as before. Can anyone help us? it used to work but right now even books which we transcluded before don't show the page numbers. So we can't click on them and go to the corresponding part of the book. Yousef (talk) 17:32, 3 December 2023 (UTC)[reply]

@Yoosef Pooranvary: Page numbers (and dynamic layouts) on faWS are provided by s:fa:MediaWiki:PageNumbers.js (which is hard-loaded from Common.js), added by Pedram.salehpoor in 2017 and untouched since. The problem is most likely the check in line 174 (and 77) that references proofreadpage_source_href. This config variable was changed last year, so the script now needs to reference prpSourceIndexPage instead. You'll need an Interface administrator to edit the script for you, and since you don't appear to have any on faWS you'll need to ask the Stewards at m:SRM.
Alternately, it appears as if faWP has some Interface admins. faWS appears to have a lot of outdated and unmaintained javascript, including multiple Gadgets that will not even load due to having not been converted to ResourceLoader(!). It would not be a bad idea to ask the Interface admins on faWP whether any of them might be willing to help out with cleaning up and maintaining the javascript of faWS. Perhaps Ladsgroup (who is an Interface admin on faWP) would be willing to help you find the right place to contact them? If any are willing to help you'll need a discussion demonstrating community consensus to add the right to that person's account, and then make a Steward request to actually add that permission.
I'd also be happy to help with this, but as I don't speak Persian I probably wouldn't do you much good. But if you manage to persuade one of the faWP admins to take this on, I can try to answer any Wikisource-specific technical questions they might have (or find someone who can). Xover (talk) 20:35, 3 December 2023 (UTC)[reply]
@Xover @Yoosef Pooranvary Hi, I'm a global interface admin. I can take a look! Give me a bit. Ladsgroup (talk) 21:21, 3 December 2023 (UTC)[reply]
@Xover Thank you for your thorough explanation. Ladsgroup is following up the issue. Yousef (talk) 22:33, 3 December 2023 (UTC)[reply]

Help on Error: No such index[edit]

Can someone help with the error on the page https://en.wikisource.org/wiki/Notes_on_H.A._Bethe%27s_%22Theory_of_armor_penetration%22._1._Static_penetration. Index is here https://en.wikisource.org/wiki/Index:Notes_on_HA_Bethe%27s%22_Theory_of_Armor_Penetration%22_1._Static_Penetration.pdf. Its very confusing. Sunlitsky (talk) 16:27, 19 March 2024 (UTC)[reply]

@Sunlitsky: The problem is the quotation marks as part of the file name, they're really hard to use with the Proofread Page system (long story, technical stuff). If you like I can move the file to a different name for you? Xover (talk) 18:10, 19 March 2024 (UTC)[reply]
PS. Inside the wiki, you can make links to other pages on the wiki using the syntax [[Page name]]. For historical reasons, there's a special trick that needs to be used when you link to a file description page (the ones that start with "File:"): insert a colon at the very beginning like this [[:File:Filename of the file.pdf]]. Otherwise MediaWiki will try to display a thumbnail of the file instead of just linking to it (yes, this is very confusing, but it's too hard to change it now). For the two pages above that would end up like: Index:Notes on HA Bethe's" Theory of Armor Penetration" 1. Static Penetration.pdf and File:Notes on HA Bethe's" Theory of Armor Penetration" 1. Static Penetration.pdf. English Wikipedia has a pretty decent help page about this at w:Help:Link (the "w:" is an "interwiki prefix"; it means the rest of the link refers to something on Wikipedia, instead of locally here on Wikisource). Xover (talk) 18:17, 19 March 2024 (UTC)[reply]
Yes, please move the file to a different name.thanks.Sunlitsky (talk) 20:13, 19 March 2024 (UTC)[reply]
@Sunlitsky: Done Xover (talk) 22:11, 19 March 2024 (UTC)[reply]
ThanksSunlitsky (talk) 23:10, 19 March 2024 (UTC)[reply]

How to fix the error:Invalid interval[edit]

How do i fix the error: invalid interval in the page https://en.wikisource.org/wiki/Index:THEORY_OF_SHOCK_WAVES_AND_INTRODUCTION_TO_GAS_DYNAMICS.pdf to be used in https://en.wikisource.org/wiki/Theory_of_shock_waves_and_introduction_to_gas_dynamics. Sunlitsky (talk) 14:13, 28 March 2024 (UTC)[reply]

I do not see any such error. --EncycloPetey (talk) 22:03, 28 March 2024 (UTC)[reply]