Help:Page breaks

From Wikisource
Jump to navigation Jump to search
Page breaks
This page explains solutions to common problems relating to text being broken across pages in the Page: namespace.

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

Templates across page breaks[edit]

If you have a template that spans a page break, you cannot just put the opening of the template (eg {{fine block| 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.

Method[edit]

First page[edit]

Body
{{fine block/s}}
First page text
Footer
{{fine block/e}}

Middle pages[edit]

Header
{{fine block/s}}
Body
Middle page text
Footer
{{fine block/e}}

Last page[edit]

Header
{{fine block/s}}
Body
Last page text
{{fine block/e}}

Templates that use this system[edit]

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:

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[edit]

Tables split over pages are done the same way as the split templates above, using the table syntax of {| and |} instead of {{template/s}} and {{template/e}}. 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[edit]

First page[edit]

Body
{| class="class?" style="table styling here"
|-
|Table contents
Footer
<!-- Include this blank line --> 
|}

Middle pages[edit]

Header
{| class="class?" style="table styling here" (same as first page, or this page will render wrongly in the page view)
|-<!-- Trailing row marker needed if using header/ribbon rows  -->
Body
<!-- Include this blank line --> 
|-
|More table rows
Footer
<!-- Include this blank line --> 
|}

Last page[edit]

Header
{| class="class?" style="table styling here" (same as first page, or this page will render wrongly in the page view)
|-<!-- Trailing row marker needed if using header/ribbon rows  -->
Body
<!-- Include this blank line --> 
|-
|More table rows
|}

Footer content beneath a table which crosses pages[edit]

Distinct from but related to the above is the case where footer content ought to appear (typically a footnote or page number) beneath a "first" or "middle" component of a multi-page-crossing table. The following code looks like it ought to work but in fact fails:

First page Middle page
Body
{| class="class?" style="table styling here"
|-
|Table contents
Footer
|}
<references/>
Header
{| class="class?" style="table styling here" (same as first page, or this page will render wrongly in the page view)
Body
{{nopt}}
|-
|More table rows
Footer
|}
<references/>

Under the current software the footnotes are frustratingly rendered above the top of the table instead of where you might expect them to appear.

Method[edit]

The solution is to insert a a comment line into the footer just above the |} like this (The line feeds are important.)

First page Middle page
Body
{| class="class?" style="table styling here"
|-
|Table contents
Footer
<!-- Include this blank line --> 
|}
<references/>
Header
{| class="class?" style="table styling here" (same as first page, or this page will render wrongly in the page view)
Body
<!-- Include this blank line --> 
|-
|More table rows
Footer
<!-- Include this blank line --> 
|}
<references/>

Footnotes across page breaks[edit]

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.

Method[edit]

First page[edit]

Body
Lorem ipsum dolor sit amet,<ref name="p76">dolorem ipsum, quia dolor sit amet,</ref>
Footer
{{smallrefs}}

Subsequent pages[edit]

Body
…est laborum.<ref follow="p76">consectetur, adipisci velit…</ref>
Footer
{{smallrefs}}

Potential problems[edit]

  • The <ref name=…> can be anything, but the use of the page number is preferred.
  • Normally the <ref follow=…> 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 wrapping the second and subsequent paragraphs with the HTML paragraph tags <p>…</p>.

Newlines across pagebreaks[edit]

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.
  • Place {{nop}} on a new line when the end of a page is also end of a paragraph.