Jump to content

Help:Beginner's guide to transclusion

From Wikisource

How to add books to the main namespace.

What is transclusion?

[edit]

"Transclusion" is the way we get text from the Page namespace to the main namespace. The Page namespace is where text is meant to be proofread. The main namespace is where text is meant to be read.

Transclusion copies the text across whenever anyone wants to read the page in the main namespace. It is still linked to the Page namespace. So any changes made to the text in the Page namespace will be seen in main namespace as well.

When to transclude

[edit]

The preferred time to transclude text to the main namespace is after the proofreading is complete and all of the pages have been validated (green page status).

Sometimes it can help with the proofreading if you can see what the final version will look like in the main namespace. If so, you can transclude pages to the main namespace before the proofreading is all done. As the main namespace is the one we want people to read, we would like it to look as neat and tidy as possible. So please try to only transclude text that is in as good a condition as possible.

Simple transclusion

[edit]

To start transclusion:

  1. Start a new page on which you want the final version of the text to appear.
  2. Edit this page.
  3. Add just the transclusion code (as shown below).
  4. Save the page.

The code you need to use depends on how many pages you want to transclude to one page.

Transclusion code
Number of pages Code to use
One <pages index="filename" include="X" header="1" />
Two or more <pages index="filename" from="X" to="X" header="1" />

The red text needs to be changed to the details for your work and the pages you want to transclude:

  • The filename is the name used for the Index page and the page scan file.
  • The X's are the page numbers in the scan that you want to transclude. These are the page numbers from the scan (the numbers in the pagenames in the Page namespace) not the page numbers printed on the pages.

For example: If you were transcluding a chapter from a PDF or DJVU based Index, e.g. Index:My example book.djvu which covers pages 20 to 35 of the scan (i.e. pages Page:My example book.djvu/20, Page:My example book.djvu/21, ... Page:My example book.djvu/35). The code would be:

<pages index="My example book.djvu" from="20" to="35" header="1" />.


For example: If you were transcluding a chapter from an image based Index, e.g. Index:My example book, which covers pages 20 to 35 of the scan (i.e. pages Page:My example 20.jpg, Page:My example book 21.jpeg, ... Page:My example book 35.png). The code would be:

<pages index="My example book" from="My example 20.jpg" to="My example book 35.png" header="1" />.

Manual header

[edit]

The simple transclusion uses a "magic header" that takes information from the Index page to create the header seen at the top of the page. If there is a problem with this header or you want more control, you may need to add a manual header instead.

To add a manual header:

  1. Start a new page at which you want the final version of the text to appear.
  2. Edit this page.
  3. Add the header code (as shown below).
  4. Fill in any parts of the header that you want filled in.
  5. Add the transclusion code (as shown below).
  6. Save.

The manual header code that needs to be added above the transclusion code is:

{{header
 | title      = 
 | author     = 
 | translator = 
 | section    = 
 | previous   = 
 | next       = 
 | year       = 
 | portal     = 
 | notes      = 
}}

The title and author parts need to be filled in. See {{header}} for more information.

The transclusion code is the same as with the simple transclusion except the "header" attribute should be excluded. (This is the part of the code that creates the "magic header".) Example code is shown below:

Transclusion code (with no header)
Number of pages Code to use
One <pages index="filename" include="X" />
Two or more <pages index="filename" from="X" to="X" />

Advanced features

[edit]

There are more things that can be done with transclusion. You can exclude or skip pages. You can also just transclude part of a page instead of the whole thing. For information on this and more, see Help:Transclusion.