Bureaucrats, Moderators (CommentStreams), Interface administrators, Push subscription managers, Suppressors, Administrators
4,120
edits
(try echo) |
|||
Line 362: | Line 362: | ||
* Description - Enhance parser with logical functions | * Description - Enhance parser with logical functions | ||
* Test - Ensure [[parser functions]] are working | * Test - Ensure [[parser functions]] are working | ||
** Examples | ** Examples | ||
*** The number of calendar days between 1 December 2010 and today is: 2949 | *** The number of calendar days between 1 December 2010 and today is: 2949 | ||
*** Additional [[Help:Parser functions#Examples|Examples]] are shown below using [[Labeled Section Transclusion]], provided it is working. | *** Additional [[Help:Parser functions#Examples|Examples]] are shown below using [[Labeled Section Transclusion]], provided it is working. | ||
*<code><nowiki>{{#time: F j, Y}}</nowiki></code> will show the current date: {{#time: F j, Y}}. Other common formats for displaying a date include: | *<code><nowiki>{{#time: F j, Y}}</nowiki></code> will show the current date: {{#time: F j, Y}}. Other common formats for displaying a date include: | ||
** <code><nowiki>{{#time: n/j/y}}</nowiki></code>: {{#time: n/j/y}}, | ** <code><nowiki>{{#time: n/j/y}}</nowiki></code>: {{#time: n/j/y}}, | ||
** <code><nowiki>{{#time: m/d/Y}}</nowiki></code>: {{#time: m/d/Y}} (with zero padding added, if necessary, to make the month and day each 2 digits long, and a 4-digit year), and | ** <code><nowiki>{{#time: m/d/Y}}</nowiki></code>: {{#time: m/d/Y}} (with zero padding added, if necessary, to make the month and day each 2 digits long, and a 4-digit year), and | ||
** <code><nowiki>{{#time: Y-m-d}}</nowiki></code>: {{#time: Y-m-d}}. | ** <code><nowiki>{{#time: Y-m-d}}</nowiki></code>: {{#time: Y-m-d}}. | ||
** <code><nowiki>{{#time: Y F d H:i:s}}</nowiki></code>: {{#time: Y F d H:i:s}} | ** <code><nowiki>{{#time: Y F d H:i:s}}</nowiki></code>: {{#time: Y F d H:i:s}} | ||
** <code><nowiki>{{#timel: Y F d H:i:s}}</nowiki></code>: {{#timel: Y F d H:i:s}} | ** <code><nowiki>{{#timel: Y F d H:i:s}}</nowiki></code>: {{#timel: Y F d H:i:s}} | ||
** <code><nowiki>{{#ifexpr: 1 > 0 | yes | no }}</nowiki></code> can compare values: {{#ifexpr: 1 > 0 | yes | no }} | ** <code><nowiki>{{#ifexpr: 1 > 0 | yes | no }}</nowiki></code> can compare values: {{#ifexpr: 1 > 0 | yes | no }} | ||
** <code><nowiki>{{#ifeq: {{#time: D}} | Fri | TGIF!}}</nowiki></code> will display a message only on Fridays: {{#ifeq: {{#time: D}} | Fri | TGIF!}} | ** <code><nowiki>{{#ifeq: {{#time: D}} | Fri | TGIF!}}</nowiki></code> will display a message only on Fridays: {{#ifeq: {{#time: D}} | Fri | TGIF!}} | ||
** <code><nowiki>{{#switch: {{#time: D}} | Fri=TGIF! | Sat=Weekend | Sun=Weekend | #default=Where's my coffee?}}</nowiki></code> will display a different message on different days: {{#switch: {{#time: D}} | Fri=TGIF! | Sat=Weekend | Sun=Weekend | #default=Where's my coffee?}} | ** <code><nowiki>{{#switch: {{#time: D}} | Fri=TGIF! | Sat=Weekend | Sun=Weekend | #default=Where's my coffee?}}</nowiki></code> will display a different message on different days: {{#switch: {{#time: D}} | Fri=TGIF! | Sat=Weekend | Sun=Weekend | #default=Where's my coffee?}} | ||