User:Musiconeologist/sdtest
- Text in code section of template, before generated SD.
- Text in code section of template, after generated SD.
for test purposes
|
---|
Here is a call to the template from the /doc page:
If the SD in the code section of the template doesn't use |
Setup and purpose
[edit]This template and its /doc page each have more than one short description. The aim is to test possible locations for short descriptions of templates, in particular those which add a short description on the page where they are used.
The /doc page has two SDs:
- one for itself
- one for transclusion to the template page.
The template page has five SDs:
- one before the code section
- one in the code section
- one between the code section and the documentation
- one in the documentation, transcluded from the /doc page
- one after the documentation.
Behaviour
[edit]- On either page, the last SD that doesn't use
|noreplace
and isn't betweenincludeonly
tags is the one displayed.
- (expected behaviour)
- On either page, Shortdesc Helper shows the correct SD, and shows an Edit button.
- (shouldn't show button if there are multiple SDs, since the one it displays isn't necessarily the one it edits)
- Editing with Shortdesc Helper replaces the first SD regardless of whether that's the one displayed, removing
|noreplace
from it if present. This is true even if the first SD is betweenincludeonly
tags.
- (should edit the correct one or refuse to edit, and should preserve
|noreplace)
- (should edit the correct one or refuse to edit, and should preserve
- If the /doc page includes a call to the template, and the SD from the code section doesn't use
|noreplace
, then
- —the code section SD is displayed for the /doc page, and
- —unless the one after {{Documentation}} is allowed to override it, it is also displayed for the template page.
- (expected behaviour, since on both pages it's now the last one in the documentation)
Comments
[edit]Shortdesc helper
[edit]- For templates which set a short description, the first SD on the template page is likely to be the one in the code section. It will have
|noreplace
so it can be overridden on pages that use the template. - Shortdesc Helper will replace this with a new SD that no longer uses
|noreplace
, but will appear to be editing the one displayed for the template. - After the edit, the template will still have its old SD, but pages using the template will now show the new one, which their local SDs will no longer override. To the user, it will just look as though the edit wasn't saved.
Possible workaround: put a default/dummy SD before the code section. Shortdesc Helper will now change that one, instead of damaging the one for transclusion. It can be overridden, if desired, by another one further down or on the /doc page.
Suggested scheme
[edit]Assuming template sections are in the usual order, the structure below should work for templates that both set a short description and have one.
Template page
- Default SD before the code section, between
noinclude
tags. This will be overridden by one transcluded from the /doc page, but its presence will protect the one in the code section from Shortdesc Helper edits. - SD in code section, with
|noreplace
, for transcluding to pages using the template.
Documentation page
Either a single SD at the top, to be shown for both pages, or
- SD for the /doc page, between
noinclude
tags, followed by - SD for the template, between
includeonly
tags.
The SDs need to be this way round, so any Shortdesc Helper edits are to the correct one.
Summary
- For safety, templates that set a SD also need one at the start of the page.
- If both pages set a SD for the template page, the one on the /doc page takes precedence.
- Shortdesc Helper shouldn't be used to edit template SDs, even if it offers to.