Template:ASST/doc
This is a documentation subpage for Template:ASST (see that page for the template itself). It contains usage information, categories and other content that is not part of the original template page. |
This template aids building magic word templates for interactive assistants, by parsing the current page name according to certain assistant-page naming conventions.
Usage
editCall this template within the magic word, specifying a template to pass the parse information to.
t
— required — the template to which to pass the parse information. Omit prefixTemplate:
.
There are three ways to use a specified name instead of the current page name, using unnamed parameters.
- Specify the name of a page that is part of an assistant.
- Specify the name of a global assistant (without the
Assistant:
prefix). - Specify the parent page of a local assistant, and the name of the assistant (without the
Assistant:
prefix).
The following parameters are passed to t
; any other named parameters passed to here are passed through to t
via Module:TScope#drop.
name
— The field of the page name that starts withAssistant:
.space
— The namespace of the page name; no colon.subpage
— The part of the page name aftername
, if any; no leading slash.full
— The entire page name that was parsed.parent
— The part of the page name beforename
, if notWikinews:
. No trailing slash.
This template is designed so it can be substituted (via subst:
) as well as transcluded (though this won't help if the template named by parameter t
doesn't also support substitution).
Examples
editpage name | parse information |
---|---|
|
name: |
|
name: |
|
name: |
|
name: |
|
name: |
|
name: |
Internals
editMagic word templates that use {{ASST}} cannot call each other, as it would cause {{ASST}} to call itself; however, the client subtemplates t
can call each other.
The main template is mostly concerned with figuring out what page name is to be parsed; the page name is then passed to subtemplate {{ASST/parse}}, along with additional information gathered through subtemplate {{ASST/find}}.
With no unnamed parameters, uses the name of the current page. With one unnamed parameter, if it has multiple fields or an Assistant:
prefix, it's taken to be the page name, otherwise it's the global assistant name and is used to derive a suitable page name. With two unnamed parameters, the second must be suitable as a local assistant name, and both parameters are used to derive a suitable page name.
The alternative parameter arrangements —where an assistant name is specified instead of a page name— are provided because without them, the magic word templates would not relieve the user of having to continually recreate the assistant-page-naming conventions.
See also
edit- {{AssistantCat}}
- {{ASSTCATEGORY}}
- {{ASSTDOC}}, {{ASSTDOCLINK}}, {{ASSTDOCHEADING}}
- {{ASSTROOT}}, {{ASSTROOTLINK}}
- {{ASSTSUB}}
- {{ASSTTEMPLATE}}
- {{ASSTTEXT}}
- {{ASST/example}}
- {{ASST/prefix?}}
- {{ASST/weight}}