Template:Dialog/preview/doc

Usage
Placing this template on a dialog page indicates &mdash; when viewing the dialog page via dialog action do verb view &mdash; that incoming dialog parameter  should be parsed as wiki markup, and the result displayed in place of each call to this template. The parsed text is template-expanded as if the text were on the page named by dialog parameter  if provided, otherwise as if the text were on the dialog page (affecting magic words such as  ).

Ordinarily, buttons within the preview are disabled. Non-blank optional template parameter  overrides this default for all buttons in this preview. The default can also be overridden for an individual button using an optional template parameter to dialog/button.

Ordinarily, template parameters in the  text are not substituted for by incoming dialog parameters. Non-blank dialog parameter &mdash; which must be specified via dialog/init since it is local &mdash; is taken to be an  -separated list of dialog parameters that if present should be substituted into the   text.

The  text cannot set up an operational dialog/preview or dialog/init; those templates if called would not have their dialog effects. Dialog fields are initialized with values of incoming dialog parameters regardless of whether the fields occur within a preview.

Internals
The dialog facilities deliberately do not, at this writing, provide a fully general way to access a dialog parameter whose name is computed dynamically; as a general design principle, the facilities seek to foster a style of dialog markup where things are succinctly specified using a few broad strokes, and therefore seek to avoid the sort of massively-empowering, fine-scale primitive computational operations that would be desirable in a traditional general-purpose programming language. Although the substitution of dialog parameters for template parameters in the  text can be simulated via dialog/psub, computing both the names of the template parameters to be substituted for and the values to be substituted in, there would still be no way to access arbitrary dialog parameters whose names are not hardcoded into the stored dialog page. The use of dialog parameter enables the preview to access arbitrary dialog parameters determined at view time, while bringing the dependency out in the open by requiring an explicit declaration via dialog/init, avoiding gratuitous access by substituting only parameters explicitly whitelisted, and avoiding obfuscated nesting by limiting dependencies to a single level per page applied to an entire text (rather than to some particular parameter buried somewhere in the markup).