Help:Page breaks

From Wikisource
(Redirected from H:PB)
Jump to: navigation, search
Page breaks
Shortcut:
H:PB
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 methods 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.

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
|}

Middle pages[edit]

Header
{{nop}}
{| class="class?" style="table styling here" (same as first page, or this page will render wrongly in the page view)
|-
Body
{{nop}}
|More table rows
|-
Footer
|}

Last page[edit]

Header
{{nop}}
{| class="class?" style="table styling here" (same as first page, or this page will render wrongly in the page view)
|-
Body
{{nop}}
|More table rows
|}

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>.