Template:TOC mlink
This template uses Lua: |
Short usage summary: {{TOC link|Page NS number|Subpage name|Link text}}
About
This template create a link depending on the context of transclusion. It should be used only in a Page:*. It creates either a link to a given page number (in Page:* numbering) passed in parameter 1, or a link (parameter 3) to a subpage name (parameter 2) of a book. This template can also be used outside tables of contents (e.g. "See p. 243").
The process of adding such templates has pretty much been abandoned as it is of low value in the production space (see talk).
Example: Take the book whose title is Transactions of the Geological Society, 1st series, vol. 1 in the main space, the corresponding page names are [[Page:Transactions of the Geological Society, 1st series, vol. 1.djvu/xxxx]] where xxxx is the page number in the djvu file; these pages may have a different number on the scanned book, for instance page #203 in the djvu file may be the scan of p. 191 in the scanned book; so in order to show 191 you write this:
{{TOC link|203|On the Wrekin and on the Great Coal-field of Shropshire|191}}
- In Page:Transactions of the Geological Society, 1st series, vol. 1.djvu/425 the created link is [[Page:Transactions of the Geological Society, 1st series, vol. 1.djvu/203|191]].
- When this page is transcluded in main namespace, the created link is [[../On the Wrekin and on the Great Coal-field of Shropshire#191|191]]. (see Transactions of the Geological Society, 1st series, vol. 1/Index).
- Transclusion of a page using this template work also from an Index: page but only if the name of the index is identical to the name of the djvu file, in this case the created link is identical to #1.
- Parameter 3 is used as anchor, typically this is used in context like (see p. 123) to allow links with anchor from a book to itself.
- If you would like a link with complex formatting like italics, which cannot be used in links, the optional parameter 4 is used. Parameter 4 will function as the link text, and parameter 3 will function as the link target (i.e. parameter 3 does not have the italic text, and parameter 4 does). An example of this is here, for Chapters 4 & 16, where some words are italic.
- Notes:
- that the name of an index must always be the same as the name of the corresponding djvu file; a renaming will be necessary if the names are different, though this is only needed if you want to link from a transcluded Page: in an Index:
- formatting of text style, eg. small capitals, needs to wrap around the outside of the template, not be placed inside the template
Rationale
- Using relative links allow to rename works without creating link through redirect, both page in main (top-level page and sub-page should be renamed as a whole) or the djvu and its subpages can be renamed without maintenance burden
- Avoiding relative links directly in Page:, which create a blue link when transcluded in main but a red link in Page:
- It avoids a link to Page: in main which can confuse readers if they don't understand what namespace and transclusion are.
- It allows a short way to express a link from a work to itself.
See also
- {{TOC mlink}}
- {{Scan page link}}: for auto-offset page links
- {{Scan page link 2}}: for page links that cannot be auto-offset (e.g. roman numerals)
- {{Scan page link 3}}: for page links that are not auto-offset, and allow linking to mainspace chapter
- {{Auto TOC link}}: adds an automatic link to the correct chapter in mainspace, for ease of use when large numbers of links are required
- {{TOC line}} and {{Dotted TOC line}}: have inbuilt pagenum and positionoffset parameters
- {{TOC page listing}} and {{Dotted TOC page listing}}: have inbuilt pagenum and positionoffset parameters
- {{Double link}}: for any link that varies when in Page: and the mainspace
- {{Namespace link}}: for links that vary between any namespaces