Help:Page breaks

Page breaks can cause several problems when transcluding texts, even if the individual pages render well in the Page: namespace.

Templates across page breaks
If you have a template that spans a page break, you cannot just put the opening of the template (eg  on the first page and the closing   on the next page. This is because the Wikimedia software first renders the wikicode on each page, before transclusion, so the software never notices that a template is closed in a later page: it treats it as normal text.

To get around this you need to use a "split" form of this template, along with the header and footer fields in the Page: namespace edit view (if you don't have these visible, click the [+] button in the toolbar). This means that only a single "start" and "end" template appear in the transclusion, but the contained text is not actually inside a template. Each page is also wrapped in the Page: namespace, using the header and footer fields, so it appears correctly both before and after transclusion.

First page

 * Body


 * Footer

Middle pages

 * Header


 * Body


 * Footer

Last page

 * Header


 * Body

Templates that use this system
This method is used by many templates. These are "block" level templates like fine block, as "span" level templates like smaller don't cause a line break when they are ended. If you need to run a span template across page, simply terminate the first template on the first page, and start a new one on the second.

Examples of templates that use this method include:


 * block center: block center/s, block center/e
 * fine block: fine block/s, fine block/e
 * smaller block: smaller block/s, smaller block/e
 * div col, div col end (no unsplit template)

If the block template you would like to use across a page break doesn't have a split variant, create it using one of the templates above as a reference. Remember to transclude the documentation from the unsplit template page.

Tables across page breaks
Tables split over pages are done the same way as the split templates above, using the table syntax of {| and |} instead of and. For some commonly used table formatting, split templates such as block center/s and TOC begin already exist, and are used as described above.

For a one-off split-table, you don't need to make a template.

Method
This method has two parts, both due to the way that the ProofreadPage extension concatenates pages without newlines between them:
 * 1) Use nopt to force the table markup (either   or  ) to start on a new line in the final text (this is required for it to be seen as table markup).
 * 2) Place new row markers  at the start of pages, not the end of the previous page. This is required for the page numbers to be placed correctly.

Poems across page breaks
Poems should generally be formatted using the ppoem template. It has been designed specifically for formatting poems on Wikisource and makes a lot of the most common things needed for poems a lot easier. It does however have a slightly different usage model than most of the other templates mentioned here.

Each page of a poem needs to use its own complete ppoem template, and then the template takes care of joining the parts together in the right way when they are transcluded together for display. In order to do this you need to tell the template whether the page break is on a stanza, if one line follows the last, or if the break is on the same line. On the first or earlier page you tell it how it ends, and on the following page you tell it how it starts.

The old way to do this, which you will meet in some texts that were transcribed before ppoem was available, used the  tag. This tag must always be opened and closed in the body of the page.

If you use "direct formatting" (i.e. ), then you don't need to do anything different.

If you use block center, you have to split that template as usual over the pages:

Footnotes across page breaks
Footnotes that span more than one page are handled in a similar way to normal. The method below will display correctly both in the Page namespace and when transcluded into the Main namespace.

First page

 * Body


 * Footer

Subsequent pages

 * Body


 * Footer

Potential problems

 * The  can be anything as long as it's not shared with unrelated footnotes that are transcluded onto the same page. Using the page number is preferred.
 * Normally the  is at the end of the page. However, if there is a change of section – for transcluding in a different chapter – then continued footnote should be moved to the top of the page, or else it will not be transcluded.
 * Long footnotes may have multiple paragraphs; the use of double carriage returns to start a new paragraph will not work in the transcluded footnotes – it has to be forced by putting the template Paragraph break (or its shortcuts pbr / parabr) between the two paragraphs. Using  or   to separate the paragraphs should be avoided, as these do not always work well when exporting to PDF or eBook formats.
 * The parts of a footnote are automatically joined with a space. For joining without a space (e.g. when a word is split over two pages) use hws and hwe.

Lists across page breaks
Lists across page breaks create complications where typically, a portion of parent list item and a 'continued' wording is used on the second page.

Sub listed item on second page
Rather than placing the continuation content in the header of the second page it should be placed in the body inside a  pair, followed by a line feed. The next list item, (or sub list item) is then continued as normal.


 * Body of first page


 * Body of second page

Continuation of first list item

 * Body of first page


 * Body of second page

Note that any Section tag's should be placed after the list item on the first page, but immediately before the noincluded portion on the second. There is NO line-feed placed between the section tags and the noincluded portion on the second page.

Links
If a link spans a page break, use lps on the first page and lpe on the second.

As an example, if you wanted to link "Lorem ipsum", but the word break was in the middle, put on the first page, and on the second.

Note that wikitext markup (eg italics) has to go inside the "pre" and "post" parameters to render correctly.

Newlines, hyphens and dashes across pagebreaks
The default behavior for transclusion is to just add a space between the text of two pages (except when the page ends in a hyphen, when it is removed and no space is inserted), even when there should be a paragraph break, or when there should be no space at all. There are a some templates to assist in such cases.


 * Use page end hyphen or peh when the hyphen at the end of the page should be retained. See H:HYPHEN for more details.
 * Use unspaced page end or upe for other cases when there should not be a space between the pages, for example when one page starts with an unspaced em dash (—).
 * Place nop on a new line when the end of a page is also end of a paragraph.