Template:DPL parameter.nowordbreak

From DynamicPageList3 Manual
Revision as of 05:30, 4 April 2022 by imported>FrozenPlum (Move docs to this page since it may be an exported/imported template, and we don't need the documentation modules etc to go with it.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

[[{{{%PAGE%}}}#{{{name}}}|{{{name}}}]] || {{#vardefine:n|50}}{{#vardefine:text|}}{{#vardefine:sub|{{#sub:{{#var:text}}|0|{{#var:n}} }} }}{{#vardefine:n+|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:sub+|{{#sub:{{#var:text}}|0|{{#var:n+}} }} }}{{#rmatch:{{#var:sub}}|/[\W0-9]$/|{{#var:sub}}|{{#rmatch:{{#var:sub+}}|/[\W0-9]$/|{{#var:sub}}|{{#rmatch:{{#var:sub}}|/^(.*[\s]).*$/|$1|{{#var:sub}}}}}}}}

This template is a surrogate template (also called a 'phantom template') example that formats one result/line of DPL output. DPL then reuses and applies the surrogate template's formatting to each result/line in the output.

Surrogate/phantom templates are used by setting the template name in includepage = {templatename}.suffix (changing the suffix to whatever is descriptive of template purpose).

Naming the surrogate/phantom template after its parent, and then adding a descriptive suffix on the end, ensures both the parent and surrogate are easily found, and their relationship to each other understood. This style of naming them is particularly useful when looking in the Templates category.

See Also

  • [[Template:{{#explode:DPL parameter.nowordbreak|.}}]] (the template this surrogate provides per-result output formatting for).