Wikinoticias:Asistente/context/uso

.


This is a dialog-based framing Asistente to support context-sensitive templates in displaying a page.

Access primary page [[Plantilla:OBJECTPAGENAME]] via dialog view. The Asistente allows certain templates, specified to the Asistente, to request context sensitive information, which the Asistente provides to them by adding template parameters to the template calls. The templates must be called directly by the displayed page (rather than being called by some other template that's called by the displayed page).

Access: viewable.

Inputs:

  • subject — required; name of the page to display.
  • context-templates — optional; what templates have requested what parameters; a wikilisp list of lists of strings.
  • context-whitelist — optional; what parameters are allowable as requests; a wikilisp list of strings.
  • context-blacklist — optional; parameters disallowed as requests; a wikilisp list of strings.
  • context-transform — optional; template to modify the raw wiki markup of the page to display.
  • Other parameters that may have been provided for use-on-request by templates.
  • context-delta-templates — optional; things to add to context-templates
  • context-delta-whitelist — optional; things to add to context-whitelist
  • context-delta-blacklist — optional; things to add to context-blacklist

The delta parameters are applied first. They make it possible for a button to direct modifications to the primary parameters without having access to their previous values.

The context-whitelist is a list of dialog-parameter names that are meant to be permitted requests; parameters actually whitelisted are these, plus some automatically added (see below), minus any excluded by context-blacklist. The resulting whitelist is used both to filter parameter-requests from templates before adding them to context-templates, and to initialize local-preview-parameters.

Each context-templates item is a list of strings where the first is the name of a template, and each additional string is the name of a dialog parameter that has been requested by the template and was whitelisted at the time it was requested.

The following parameters are automatically whitelisted, regardless of whether they appear on context-whitelist, unless excluded by context-blacklist.

  • context-subject — name of the target page; duplicates subject.
  • USERNAME — account name of the current user.
  • USER-GROUPS — list of groups the current user belongs to, separated by spaces.

Although SUBJECT-CONTENT is available, it isn't whitelisted by default because for large pages it can be quite expensive to inject multiple copies of the raw wiki markup of the page, so should require some deliberation.

The target page content, transformed per context-transform and then augmented per context-templates, is presented via {{Diálogo/preview}}, with local-preview-parameters initialized according to the computed whitelist.

See also

editar