Difference between revisions of "Template:As of"

From SVR Wiki
Jump to: navigation, search
m (correct link)
(better handling of deprecated format (for use as meta-template))
Line 7: Line 7:
 
## optional named parameter df=US produces American date format in displayed text
 
## optional named parameter df=US produces American date format in displayed text
 
## optional named parameter lc=on gives lower-case-first output
 
## optional named parameter lc=on gives lower-case-first output
 +
## optional named parameter url=[URL] gives statement reference
  
 
## displayed text ([A/a]s of [Start date] by default)
 
## displayed text ([A/a]s of [Start date] by default)
-->{{#if:{{{alt|}}}|{{{alt}}}|{{#ifeq:{{{lc}}}|{{{lc|}}}|a|A}}s of {{Start date|{{{1}}}|{{#if:{{{2|}}}|{{MONTHNUMBER|{{{2|}}}}}}}|{{{3|}}}|df={{{df|yes}}}}}}}<!--
+
-->{{#if: {{{alt|}}} | {{{alt}}} | {{#ifeq: {{{lc}}} | {{{lc|}}} | a | A }}s of {{#if: {{{3|}}} | {{Start date | {{{1}}} | {{MONTHNUMBER|{{{2}}}}} | {{{3}}} | df={{{df|yes}}} }} | {{#if: {{{2|}}} | {{MONTHNAME|{{{2}}}}} }} {{{1}}} }}}}<!--
  
 
## url inline banner (hidden by default)
 
## url inline banner (hidden by default)
Line 15: Line 16:
  
 
## disable categorisation outside main namespace
 
## disable categorisation outside main namespace
-->{{main other|<!--
+
-->{{main other|[[Category:Articles containing potentially dated statements <!--
  
## hidden link to 'as of' pages (checks for deprecated/incorrect usage)
+
## temporal category for template (word method)
-->{{#if: {{#ifexpr: {{{1}}} = 1 }} | [[As of {{{1}}}|<s />]] | <!--
+
-->{{#if: {{#ifexpr: {{{1}}} = 1 }} | {{#ifexpr: {{#time:Y|{{{1}}}}} > 2004 | from {{{1}}} | {{#ifexpr: {{#time:Y|{{{1}}}}} > 1989 | from {{#time:Y|{{{1}}}}} }}}} | <!--
  
## temporal category for template
+
## temporal category for template (parameter method)
--> {{#ifexpr: {{{1}}} > 2004 | [[Category:Articles containing potentially dated statements from {{#if:{{{2|}}} | {{MONTHNAME|{{{2}}}}} }} {{{1}}}]] | {{#ifexpr:{{{1}}} > 1989 | [[Category:Articles containing potentially dated statements from {{{1}}}]] | [[Category:Articles containing potentially dated statements]] }}}}}}<!--
+
-->{{#ifexpr: {{{1}}} > 2004 | from {{#if:{{{2|}}} | {{MONTHNAME|{{{2}}}}} }} {{{1}}} | {{#ifexpr:{{{1}}} > 1989 | from {{{1}}} }}}}}} ]]<!--
  
 
## global category for template
 
## global category for template

Revision as of 20:05, 9 August 2008

As of 1 May 2024 (2024-05-01)[ref]

Documentation icon Template documentation[view] [edit] [history] [purge]

Usage

The template {{as of}} is used to mark potentially dated statements, and will add an article to the appropriate hidden sub-category of Category:Articles containing potentially dated statements. This allows editors to catalogue statements that may become dated over time. The date used for a given statement should be the current date (for currently valid statements) or the date on which the cited reference was produced (for example, when using census data). Unlike the {{update after}} template, {{as of}} does not require the editor to give a full date. This template should not be substituted.

Note: This template MUST NOT be used in infoboxes which emit a microformat, as its emitted date markup will conflict with that.

This template does not generate a visible hyperlink in text where it is used.

Syntax

The template can be used in the following forms:

{{As of|year}}
{{As of|year|month}}
{{As of|year|month|day}}

Please do not use {{As of|{{CURRENTYEAR}}|{{CURRENTMONTH}}}} or similar; that defeats the point of the template.

Several additional named parameters can also be used (see below).

Parameters

Required

  • year (first parameter) – must be in full numerical format (yyyy)

Optional

  • month (second parameter) – full, abbreviated or numerical formats supported (mm recommended)
  • day (third parameter) – numerical format only, not included in link (dd)

Named

  • alt – optional; allows substitution of different wording and case for the visible text output (including the date); if present but no value defined, this parameter is ignored; if a value is defined, values for |df and |lc and |since parameters are ignored.
  • df – optional; allows use of American date format with |df=US.
  • lc – optional; if given any value at all (e.g. |lc=y) gives lower case "as of date", for use in mid-sentence.
  • since – optional; if given any value at all (e.g. |since=y) it changes "As of" to "Since". Use of |lc=y with |since=y gives "since date. Use of |alt= will replace the entire output, including the "Since", as it will with the default "As of".
  • url – optional; adds an inline external link (hidden by default) suggesting a webpage for future editors to check for updates to the statement; use the full URL with no spaces. See Wikipedia:As of for displaying links.

Examples

{{As of|2024}} – As of 2024
{{As of|2024|05}} – As of May 2024
{{As of|2024|05|1}} – As of 1 May 2024
{{As of|2024|05|1|df=US}} – As of May 1, 2024
{{As of|2024|05|1|lc=y}} – as of 1 May 2024
{{As of|2010|4|1|alt=as of the [[2010 United States Census]]}} – as of the 2010 United States Census
{{As of|2024|05|url=http://en.wikipedia.org/}} returns:
for logged in users, with links displayed (see Wikipedia:As of) – As of MayScript error: No such module "String".2024[ref]
for all other users – As of MayScript error: No such module "String".2024
{{As of|2024|05|1|df=US|since=y}} – Since May 1, 2024
{{As of|2024|05|1|lc=y|since=y}} – since 1 May 2024

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools.

As of

<templatedata>{ "description": "A template used to mark potentially dated statements, and will add an article to the appropriate hidden sub-category of Category:Articles containing potentially dated statements. This allows editors to catalogue statements that may become dated over time.", "params": {

 "1": {
   "label": "Year",
   "description": "The year the statement is valid to. Must be in full numerical format (yyyy)",
   "type": "number",
   "required": true
 },
 "2": {
   "label": "Month",
   "description": "The month the statement is valid to. Full, abbreviated or numerical formats supported (mm recommended)",
   "type" : "string/line",
   "required": false
 },
 "3": {
   "label": "Day",
   "description": "The day the statement is valid to (not included in link). Numerical format only (dd)",
   "type": "number",
   "required": false
 },
 "alt": {
   "label": "Alternate wording",
   "description": "Use different wording for the visible text output; if set, values for 'Date format' (df) and 'Lower case' (lc) parameters are ignored",
   "type": "string/line",
   "required": false
 },
 "df": {
   "label": "Date format",
   "description": "Set to US to use U.S. date format (mdy) (default is dmy)",
   "type": "string/line",
   "default": "US",
   "required": false
 },
 "lc": {
   "label": "Lower case",
   "description": "Specify y to use lower case",
   "type": "string/line",
   "required":false
 },
 "since": {
   "label": "Since",
   "description": "Specify y to replace 'as of' with 'since'.",
   "type": "string/line",
   "required": false
 },
 "url": {
   "label": "URL",
   "description": "A URL for an inline external link (hidden by default) suggesting a webpage for future editors to check for updates to the statement; use the full URL with no spaces",
   "type": "string/line",
   "required": false
 }

}} </templatedata>

See also