Wikipedia:Lua/Modul/PageTree/en
Wikipedia:Lua Modul PageTree en
| Vorlagenprogrammierung | Diskussionen | Lua | Unterseiten | |||
| Modul | Deutsch | English
|
Modul: | Dokumentation | ||
PageTree – Module for presentation and administration of wiki pages within a hierarchical structure.
From one unique page definition varoious consistent presentations may be retrieved:
- Uncollapsed path to a certain page, as might be shown in linkboxes, together with neighbouring entries
- List of all pages
- „Sitemap“ with complete tree structure
Page structure is defined by a sub module.
Functions for templates
All functions (except failsafe) have one mandatory parameter with the identifier of structure. More named parameters may be applied.
The return value is a string according to the request and current page name; even empty or error message.
- all
- List all entries as (non hierarchical) list in alphabetical order.
- Parameters:
light lineup list lazy stamped suppress - check
- Check all entries (for existence of page) if link target.
- Parameters:
linked– Is every redirect declared asshift? - path
- Show path to current page, also related sister entries in given order.
- Parameters:
lazy segment - subpages
- Show sequence of subpages.
- Parameters:
subpager– Pass sequence to that template. - tree
- Show all entries as tree structure in given order.
- Parameters:
list lazy segment stamped suppress - failsafe
- Version identifier (local):
2024-04-02 - Optional parameter:
1– required version, or keywordwikidata
- Returns:
- (empty), if minimal version condition not matched
- local version otherwise, or registered on Wikidata (
2024-04-02) whenwikidataor local if not found there
Parameters on function call
- 1
- Identifier of structure
- mandatory parameter
- lazy
- Use more neutral list bullet.
- Default:
#in total view,*onpath - Neutral:
*or: - level
- Do not show sub pages.
- Default: show sub pages.
- light
- Show complete view
allwithout prefix. - Default: Preced with prefix.
- lineup
- Show complete view
allcontinously without list bullet. - Default: List, one line per entry.
- linked
- Show redirects (
shift). - Default: No redirects included.
- list
- List all.
- Default: Entries marked by
list=falsein structures omitted. - segment
- Begin
pathat alternative root element. - If beginning with
/then evaluated relative tostart. - stamped
- Date/time format, for parser function
#timeetc. - suppress
- Omit page names matching this pattern.
- subpager
- Name of a template for subpages.
subpager=Subpage
Parameter names beginning with l are regarded as true if set to 1.
Definition of a structure
The definition is expected by a sub module, where the identifier has been appended to Module:PageTree/ root.
Format of sub module
- The sub module has to match the mw.loadData() conditions.
- A table is to be returned.
The following components might be delivered in that table:
- stamp
- Date/time according to ISO 8601
- start
- Prefix; replace leading
/in page names - sub
- Identifier of a sub-sub module relative to current sub module; without leading
/ - The sub-sub module will be imported consecutively by exacly the same rules.
- Repeated declarations by sub-sub module will be resolved as follows:
- pages
- List of page entries as table – each according to page entry format
Format or a page entry
A page entry may be contained in the table pages by one of three modes:
- string
"pagename"
- Named element with further details
["pagename"] = { detailA= ... }- A named element is required to contain a
truevalue instead of the string with page name. That is the root element.
- table with details; page name is
seedelement.{ seed="Seitenname", detailA= ... }
Every page name must not occur more than once in a pages table.
Every entry may contain the following properties:
- seed
- Page name as string; or
trueon root element. - mandatory parameter
- If missing but named element the element identifier will be used.
- If element not a table but string that one will be used as page name.
- If beginning with
/then linked relative tostart. - shift
- Target of a redirect
- If beginning with
/then linked relative tostart. - show
- Displayed link title
- Default: Last sub page segment; else page title without namespace.
- suffix
- Additional text after linked page
- super
- Higher page in hierachy; string or
true. - If beginning with
/then linked relative tostart. - Default: next higher page before
/. - less
path– do not show deeper levels.- Default: show.
- list
- Suppress presentation by default if not requested explicitly by
list=true. - Default: show.
- Assignment:
list=false - loose
- Mark orphaned root element.
all– if also marked bylist=falsethen ignorepath– show for current page, even if otherwise marked bylist=false.subpages– do not show for current page, if not recurring to a deklared root element.
- Default: show element.
- Assignment:
loose=true - index
- Numerical sort order.
- Default: alphabetical by page name or link title, respectively.
Functions for Lua modules (API)
There are two functions for test and management purpose:
- p.test(args)
argsare the arguments passed by#invokeotherwise in template syntax. Moreover can (must) be provided:args.self– use as current page nameargs.series– identifier of structure in place of 1.args.service– type of action; name of functionargs.suite– path to module; here:Modul:PageTree
Parameter names beginning with l are expecting boolean values.
args.hideis a table, whose entries aresuppress.
- p.failsafe(atleast)
-
- atleast
optional
nil or required version or"wikidata"
- atleast
- returns: string or false
Usage
General library; no limitations.
Dependencies
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.