Template:NewWork: Difference between revisions

From ChoralWiki
Jump to navigation Jump to search
(returning to another type of absolute date categories - relative dates didn't work as expected)
(Documentation updated)
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{switch|{{IsNew|{{{1|1901-01-01}}}}}
<includeonly>{{#ifeq: {{IsNew|{{{1|1901-01-01}}}}}
|case: yes={{filepath:NewScore.gif}} [[Category:New works| {{{1|1901-01-01}}}]] {{switch|{{IsNew|{{{1|1901-01-01}}}|range=30 days}}
| yes |{{filepath:NewScore.gif}} &nbsp;[[Category:New works| {{{1|1901-01-01}}}]] {{#ifeq: {{IsNew|{{{1|1901-01-01}}}|range=30 days}}
|case: yes=[[Category:Posted on day {{#time:j|{{{1|1901-01-01}}} }}]] {{switch|{{#expr:({{#time:U|today}} - {{#time:U| {{{1|1901-01-01}}} }}) / 86400}}
| yes |[[Category:New works in the past 30 days| {{{1|1901-01-01}}}]][[Category:Posted in {{#time:F|{{{1|1901-01-01}}} }}]]<span style="display:none">[[Posted on {{{1|an unknown date}}}]]</span>
|case: 0=[[Category:Posted today]]
}} }}</includeonly><noinclude>{{prot-temp}}
|case: 1=[[Category:Posted yesterday]]
{{DisplayBox|title=Documentation|text=
|default=[[Category:Posted {{#expr:({{#time:U|today}} - {{#time:U| {{{1|1901-01-01}}} }}) / 86400}} days ago]]
 
;Usage: {{tl|NewWork|''<yyyy-mm-dd>''}}
 
This template is affected by the behaviour of template {{CiteTemp|IsNew}} in two ways:
# If the date passed as parameter falls inside that template's default date range (currently 90 days), then NewWork will:
#* 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}}
# If the date passed (''yyyy-mm-dd'') falls inside the alternate date range value (currently 30 days), then NewWork will
#* Insert the page in categories {{CiteCat|New works in the past 30 days}} (for the {{CiteCW|Multi-Category Search}}) and [[:Category:Posted editions by month|Posted in ''Month'']] (for the {{CiteCW|LatestScores}} list that is displayed on the Main page)
}}
}}
|default=
}} <small>(Posted {{{1|1901-01-01}}})</small> &nbsp;
|default=
}}</includeonly><noinclude>{{prot-temp}}


[[Category:Templates]]</noinclude>
[[Category:Templates]]</noinclude>

Revision as of 15:05, 1 November 2018

Documentation
Usage
{{NewWork|<yyyy-mm-dd>}}

This template is affected by the behaviour of template IsNew in two ways:

  1. If the date passed as parameter falls inside that template's default date range (currently 90 days), then NewWork will:
    • 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), then NewWork will