Template:IsNew: Difference between revisions

From ChoralWiki
Jump to navigation Jump to search
m (fixed documentation)
(doc updated)
Line 1: Line 1:
<includeonly>{{#if:{{{1|}}}|{{#ifexpr:{{#time:Ymd | {{{1|1900-01-01}}} }} > {{#time:Ymd | -{{{range|90 days}}}}} |yes|no}}|no}}</includeonly><noinclude>
<includeonly>{{#if:{{{1|}}}|{{#ifexpr:{{#time:Ymd | {{{1|1900-01-01}}} }} > {{#time:Ymd | -{{{range|90 days}}}}} |yes|no}}|no}}</includeonly><noinclude>
{{DisplayBox|bgcolor=g|text=
{{DisplayBox|title=Documentation|text=
<center><big>'''Documentation'''</big></center>


;Usage: <tt><nowiki>{{</nowiki>IsNew{{!}}''<yyyy-mm-dd>''<nowiki>}}</nowiki></tt>
;Usage: {{tl|IsNew|''<yyyy-mm-dd>''}}
:<tt><nowiki>{{</nowiki>IsNew{{!}}''<yyyy-mm-dd>''{{!}}range=''<nn days>''<nowiki>}}</nowiki></tt>
:{{tl|IsNew|''<yyyy-mm-dd>''|range{{=}}''<nn days>''}}


The template returns "yes" or "no" depending upon whether the date passed is within the range of the current date.  In the first case the range defaults to 90 days, but in the second case it is given explicitly.
The template returns "yes" or "no" depending upon whether the date passed is within the range of the current date.  In the first case the range defaults to 90 days, but in the second case it is given explicitly.
Line 12: Line 11:
#* Show an icon ([[Image:NewScore.gif]]) in front of the edition's CPDL#
#* Show an icon ([[Image:NewScore.gif]]) in front of the edition's CPDL#
#* Insert the page in which it is contained in category {{CiteCat|New works}}
#* Insert the page in which it is contained in category {{CiteCat|New works}}
# If the date passed (''yyyy-mm-dd'') falls inside the alternate date range value (currently 10 days), a "yes" is returned, forcing the template NewWork to
# If the date passed (''yyyy-mm-dd'') falls inside the alternate date range value (currently 30 days), a "yes" is returned, forcing the template NewWork to
#* Categorize the page in the "Category:Posted ''yyyy-mm-dd''"
#* Categorize the page in categories [[:Category:Posted editions by day of month|Posted on day ''dd'']] and [[:Category:Posted editions by month|Posted in ''Month'']]
}}[[Category:Templates]]</noinclude>
}}
 
[[Category:Templates]]</noinclude>

Revision as of 16:27, 28 January 2015


Documentation
Usage
{{IsNew|<yyyy-mm-dd>}}
{{IsNew|<yyyy-mm-dd>|range=<nn days>}}

The template returns "yes" or "no" depending upon whether the date passed is within the range of the current date. In the first case the range defaults to 90 days, but in the second case it is given explicitly.

This template affects the behaviour of template NewWork in two ways:

  1. If the date passed as parameter falls inside this template's default date range (currently 90 days), a "yes" is returned, forcing the template NewWork to:
    • Show an icon (NewScore.gif) in front of the edition's CPDL#
    • Insert the page in which it is contained in category New works
  2. If the date passed (yyyy-mm-dd) falls inside the alternate date range value (currently 30 days), a "yes" is returned, forcing the template NewWork to