Template:Temporary wikitext/doc: Difference between revisions

From Wikipedia, the free encyclopedia

Content deleted Content added


 

Line 53: Line 53:

The {{para|since}} and {{para|until}} parameters accept the same syntax that the {{mwl|#time}} parser function understands.

The {{para|since}} and {{para|until}} parameters accept the same syntax that the {{mwl|#time}} parser function understands.

The special parameters {{para|pre-unsubst}} and {{para|post-unsubst}} can be used to set two custom texts to prepend and append in transclusion mode when the expiration time has passed but no one has edited the page again yet. They can be used to add null-edit links or tracing categories. If the page is edited after the expiration time they will be lost. For instance:

* <syntaxhighlight lang=”wikitext” inline>{{safesubst:Temporary wikitext|Foo|Bar|until=2025-10-09 18:57:43|post-unsubst=<sup>&#91;[[Special:EditPage/{{#invoke:params|self}}|null edit required]]&#93;</sup>}}</syntaxhighlight>

*: ↳ {{Temporary wikitext|Foo|Bar|until=2025-10-09 18:57:43|post-unsubst=<sup>&#91;[[Special:EditPage/{{#invoke:params|self}}|null edit required]]&#93;</sup>}}

== Parameter usage ==

== Parameter usage ==

Line 105: Line 110:

“default”: “now + 1 week”,

“default”: “now + 1 week”,

“example”: “2022-02-17 13:21:44”

“example”: “2022-02-17 13:21:44”

},

“pre-unsubst”: {

“label”: “Prepend unsubstituted”,

“description”: “Text to prepend in transclusion mode to the permanent wikitext until someone edits the page.”,

“type”: “string”,

“required”: false,

“example”: “[[Category:Pages requiring a null edit]]”

},

“post-unsubst”: {

“label”: “Append unsubstituted”,

“description”: “Text to append in transclusion mode to the permanent wikitext until someone edits the page.”,

“type”: “string”,

“required”: false,

“example”: “<sup>&#91;[[Special:EditPage/{{#invoke:params|self}}|null edit required]]&#93;</sup>”

}

}

}

}


Latest revision as of 15:09, 10 October 2025

This substitution shows a wikitext in transclusion mode for a certain amount of time, then the transclusion permanently disappears leaving room to another custom wikitext (substituted). If the permanent wikitext is not given, the substitution simply disappears leaving no traces.

Syntax
{{subst:temporarily|[temporary wikitext]|[permanent wikitext]|[time number]|[time unit]|[since=time]|[until=time]}}

If not specified, the time defaults to one week. And so, the following wikitext,

<!-- Once resolved, please remove this -->{{subst:temporarily|{{WQA in progress}}|{{Stale}}}}

the first week will display

then will forever display

Stale

The change will happen in transclusion mode until someone edits the page after the first week; at that point the only code left will be <!-- Once resolved, please remove this -->{{Stale}}

Imagining that the present time is 2024-10-09 15:57:43, the following examples behave as follows:

  • {{subst:temporarily|Foo|Bar|3|hours}} immediately after save
    ↳ Foo
    ↳ (saved wikitext) {{safesubst:Temporary wikitext|Foo|Bar|until=2025-10-09 18:57:43}}
  • {{subst:temporarily|Foo|Bar|3|hours}} saving again three hours after the first save
    ↳ Bar
    ↳ (saved wikitext) Bar
  • {{subst:temporarily|Foo|Bar|1|year|since=2024-10-09 18:57:43}}
    ↳ Foo
    ↳ (saved wikitext) {{safesubst:Temporary wikitext|Foo|Bar|until=2025-10-09 15:59:34}}
  • {{subst:temporarily|Foo|Bar|-1|hours|since=2030-01-01 00:00:00}}
    ↳ Foo
    ↳ (saved wikitext) {{safesubst:Temporary wikitext|Foo|Bar|until=2029-12-31 23:00:00}}
  • {{subst:temporarily|Foo|Bar|until=2022-02-17 13:21:44}}
    ↳ Bar
    ↳ (saved wikitext) Bar
  • {{subst:temporarily|Foo|Bar|until=1957-02-17 21:17:19 + 100 years - 2 weeks + 12 seconds}}
    ↳ Foo
    ↳ (saved wikitext) {{safesubst:Temporary wikitext|Foo|Bar|until=2057-02-03 21:17:31}}
  • {{subst:temporarily|Foo|Bar}}
    ↳ Foo
    ↳ (saved wikitext) {{safesubst:Temporary wikitext|Foo|Bar|until=2025-10-16 15:57:43}}
  • {{subst:temporarily|Foo}}
    ↳ Foo
    ↳ (saved wikitext) {{safesubst:Temporary wikitext|Foo|until=2025-10-16 15:57:43}}

The |since= and |until= parameters accept the same syntax that the {{#time}} parser function understands.

The special parameters |pre-unsubst= and |post-unsubst= can be used to set two custom texts to prepend and append in transclusion mode when the expiration time has passed but no one has edited the page again yet. They can be used to add null-edit links or tracing categories. If the page is edited after the expiration time they will be lost. For instance:

  • {{safesubst:Temporary wikitext|Foo|Bar|until=2025-10-09 18:57:43|post-unsubst=<sup>&#91;[[Special:EditPage/{{#invoke:params|self}}|null edit required]]&#93;</sup>}}
    ↳ Bar[null edit required]

This substitution shows a wikitext for a certain amount of time, then the transclusion permanently disappears leaving room to another custom wikitext.

Template parameters

This template prefers inline formatting of parameters.

Parameter Description Type Status
Temporary wikitext 1

Wikitext to show before the expiration time

Example
Foo
Content optional
Permanent wikitext 2

Wikitext to show after the expiration time

Example
Bar
Content optional
Time number 3

The numeric part of the time

Default
1
Example
17
Number optional
Time unit 4

The unit part of the time – possible units are: ‘second’, ‘seconds’, ‘minute’, ‘minutes’, ‘hour’, ‘hours’, ‘week’, ‘weeks’, ‘day’, ‘days’, ‘month’, ‘months’, ‘year’, ‘years’

Default
week
Example
minute
String optional
Since since

To which time the ‘|1=’ and ‘|2=’ parameters must be added (written according to the same syntax that the {{#time}} parser function understands) – if the ‘|1=’ parameter is missing this parameter is ignored

Default
now
Example
2024-10-09 18:57:43
String optional
Until until

Up to which time the ‘|1=’ parameter must be shown (written according to the same syntax that the {{#time}} parser function understands) – if the ‘|3=’ parameter is given this parameter is ignored

Default
now + 1 week
Example
2022-02-17 13:21:44
String optional
Prepend unsubstituted pre-unsubst

Text to prepend in transclusion mode to the permanent wikitext until someone edits the page.

Example
[[Category:Pages requiring a null edit]]
String optional
Append unsubstituted post-unsubst

Text to append in transclusion mode to the permanent wikitext until someone edits the page.

Example
<sup>&#91;[[Special:EditPage/{{#invoke:params|self}}|null edit required]]&#93;</sup>
String optional

Helper subtemplates

[edit]

Leave a Comment

Your email address will not be published. Required fields are marked *

Exit mobile version