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

භාවිතය

සංස්කරණය

Call 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 prefix Template:.

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 with Assistant:.
  • space — The namespace of the page name; no colon.
  • subpage — The part of the page name after name, if any; no leading slash.
  • full — The entire page name that was parsed.
  • parent — The part of the page name before name, if not Wikibooks:. 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).

page name parse information

Wikibooks:Assistant:Breadboard

name: Assistant:Breadboard
space: විකිපොත්
subpage:
full:   Wikibooks:Assistant:Breadboard
parent:

Template:Assistant:Dwim/foo/bar

name: Assistant:Dwim
space: සැකිල්ල
subpage: foo/bar
full:   Template:Assistant:Dwim/foo/bar
parent:

Category:Assistant:Dwim/quux/baz

name: Assistant:Dwim
space: ප්‍රවර්ගය
subpage: quux/baz
full:   Category:Assistant:Dwim/quux/baz
parent:

User:Pi zero/Assistant:Dwim/fnord

name: Assistant:Dwim
space: පරිශීලක
subpage: fnord
full:   User:Pi zero/Assistant:Dwim/fnord
parent: පරිශීලක:Pi zero

Breadboard

name: Assistant:Breadboard
space: විකිපොත්
subpage:
full:   Wikibooks:Assistant:Breadboard
parent:

Wikibooks:Reference desk/query
Citation

name: Assistant:Citation
space: විකිපොත්
subpage:
full:   Wikibooks:Reference desk/query/Assistant:Citation
parent: විකිපොත්:Reference desk/query

Magic 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.

"https://si.wikibooks.org/w/index.php?title=සැකිල්ල:ASST/doc&oldid=27861" වෙතින් සම්ප්‍රවේශනය කෙරිණි