Purpose

edit

Assist in building header template and <pages /> block in main namespace. Enters chapter and page numbers so you don't have to. Takes chapter number in url and uses it to look up page range for "from" and "to" attributes in <pages /> block. Also uses chapter number to make wikilinks to previous and next chapters in header template.

Dependencies

edit

Relies on Scribunto Lua Module:Chapterpage to look up page numbers of chapters, which in turn relies on "Module:Tabular data," which looks up data in .tab files in commons.wikimedia.org.

Usage

edit

Create a JSON file that stores your TOC information, and store it as a .tab file in the Data namespace at commons.wikimedia.org. The file cannot be uploaded. The JSON text must be pasted into a text entry box on the edit page. Each row should have the chapter number and first page of chapter. This should be the page number printed on the page of the physical book. Fields should be named "chapter" and "page". An example .tab file can be found here: https://commons.wikimedia.org/wiki/Data:Signswondersgodw0000wood.tab.

Parameters

edit

Call the template with the following parameters. The chapter number should come from {{SUBPAGENAME}} which will probably need the chapter number parsed out of it. For example, if the subpage name is "Chapter 1" then you can obtain just the number with:

{{#invoke:String|sublength|s= {{SUBPAGENAME}} |i= 8 }}
<pre>

Pageoffset is the difference between the page number in the page namespace and the number printed in the physical book. Parameter "data" is the name of the page in the "Data" namespace at Wikimedia Commons. Also include the author and index.

<pre>
{{Chapterpage
| chapter = {{#invoke:String|sublength|s= {{SUBPAGENAME}} |i= 8 }}
| pageoffset = 6
| author = Maria Woodworth-Etter
| data = Signswondersgodw0000wood.tab
| index = Signswondersgodw0000wood.djvu
}}

Limitations

edit

This template is for works that have chapter numbers and page numbers. This template will not work for works that have different kinds of numbering systems for articles and sections, like in nature catalogs and works that have chapter names but not numbers.