Template:ASST/doc

This template aids building magic word templates for interactive assistants, by parsing the current page name according to certain assistant-page naming conventions.

Usage
Call this template within the magic word, specifying a template to pass the parse information to. There are three ways to use a specified name instead of the current page name, using unnamed parameters.
 * &mdash; required &mdash; the template to which to pass the parse information. Omit prefix.
 * Specify the name of a page that is part of an assistant.
 * Specify the name of a global assistant (without the  prefix).
 * Specify the parent page of a local assistant, and the name of the assistant (without the  prefix).

The following parameters are passed to ; any other named parameters passed to here are passed through to   via Module:TScope.
 * &mdash; The field of the page name that starts with.
 * &mdash; The namespace of the page name; no colon.
 * &mdash; The part of the page name after, if any; no leading slash.
 * &mdash; The entire page name that was parsed.
 * &mdash; The part of the page name before, if not  .  No trailing slash.

This template is designed so it can be substituted (via ) as well as transcluded (though this won't help if the template named by parameter   doesn't also support substitution).

Internals
Magic word templates that use undefined cannot call each other, as it would cause undefined to call itself; however, the client subtemplates  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 /parse, along with additional information gathered through subtemplate /find.

With no unnamed parameters, uses the name of the current page. With one unnamed parameter, if it has multiple fields or an  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 &mdash;where an assistant name is specified instead of a page name&mdash; are provided because without them, the magic word templates would not relieve the user of having to continually recreate the assistant-page-naming conventions.