Help:Parser functions

From USApedia
(Redirected from Parser functions)
Help
Getting Started
Picking a UsernameTeach Yourself Wiki
Policies and guidelines
USApedia:Copyrights
The USApedia Interface
Left NavigationToolbox Discussion/Talk PageEdit & HistorySearchLog in & Create an Account
Editing USApedia
Creating a new pageCreating your user page • Editors (Visual/Enhanced) • Editing toolbarCheat SheetMagic wordsTable of Contents
Links
Internal linkExternal linkInterWiki linkCategory link Reference links
Images and Media
File Upload Guidelines for USApediaHow to upload new versions of filesImage mapNaming Conventions for FilesUpload documents
Tracking Changes
Recent Edits on USApediaArticle historyReverting to an earlier versionWatchlistHow to add a page to your watchlist
Asking Questions
Using talk pagesHelp:CommentStreams
Resources and Lists
Categories InfoboxHelp:Templates
Account settings and maintenance
Change your preferences Confirm your email address
Technical information
The MediaWiki softwareParser functions
All topics
view · talk · edit
Help:Extension:ParserFunctions on Mediawiki

Parser functions (a type of magic word, along with behavior switches and variables) are features of wikitext that enable various instructions to be given to the MediaWiki software to produce variable output, as is often required in templates.

Basic parser functions are detailed at Mediawikiwiki:Help:Magic words#Parser functions. Additional parser functions are added by the ParserFunctions extension, and are detailed at Mediawikiwiki:Help:Extension:ParserFunctions.

Examples

{{#time: F j, Y}} will show the current date: January 23, 2025. Other common formats for displaying a date include:

  • {{#time: n/j/y}}: 1/23/25,
  • {{#time: m/d/Y}}: 01/23/2025 (with zero padding added, if necessary, to make the month and day each 2 digits long, and a 4-digit year), and
  • {{#time: Y-m-d}}: 2025-01-23.
  • {{#time: Y F d H:i:s}}: 2025 January 23 04:08:55
  • {{#timel: Y F d H:i:s}}: 2025 January 22 23:08:55

{{#ifexpr: 1 > 0 | yes | no }} can compare values: yes

{{#ifeq: {{#time: D}} | Fri | TGIF!}} will display a message only on Fridays:

{{#switch: {{#time: D}} | Fri=TGIF! | Sat=Weekend | Sun=Weekend | #default=Where's my coffee?}} will display a different message on different days: Where's my coffee?

Navbox

Template:USApedia