CINXE.COM
Manual:Parser functions - MediaWiki
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-disabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref--excluded vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Manual:Parser functions - MediaWiki</title> <script>(function(){var className="client-js vector-feature-language-in-header-disabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref--excluded vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )mediawikiwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""], "wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"73358fe0-b3bf-479a-bf14-886ccbdeb70c","wgCanonicalNamespace":"Manual","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":100,"wgPageName":"Manual:Parser_functions","wgTitle":"Parser functions","wgCurRevisionId":6846788,"wgRevisionId":6846788,"wgArticleId":17997,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["MediaWiki development","Parser extensions","Wiki markup","Customization techniques","Sample code"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Manual:Parser_functions","wgRelevantArticleId":17997,"wgIsProbablyEditable":false,"wgRelevantPageIsProbablyEditable":false,"wgRestrictionEdit":["autoconfirmed"],"wgRestrictionMove":["autoconfirmed"],"wgNoticeProject":"mediawiki", "wgCiteReferencePreviewsActive":true,"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":20000,"wgInternalRedirectTargetUrl":"/wiki/Manual:Parser_functions","wgTranslatePageTranslation":"source","wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"personal","wgULSisCompactLinksEnabled":true,"wgVector2022LanguageInHeader":false,"wgULSisLanguageSelectorEmpty":false,"wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"]};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.translate.tag.languages":"ready","ext.pygments":"ready", "skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.translate.edit.documentation.styles":"ready","ext.translate":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.pt":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["mediawiki.action.view.redirect","ext.pygments.view","site","mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.translate.pagetranslation.uls","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.compactlinks","ext.uls.interface","ext.checkUser.clientHints"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&modules=ext.pygments%2Ctranslate%2CwikimediaBadges%7Cext.translate.edit.documentation.styles%7Cext.translate.tag.languages%7Cext.uls.pt%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.5"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:site_name" content="MediaWiki"> <meta property="og:title" content="Manual:Parser functions - MediaWiki"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//m.mediawiki.org/wiki/Manual:Parser_functions"> <link rel="apple-touch-icon" href="/static/apple-touch/mediawiki.png"> <link rel="icon" href="/static/favicon/mediawiki.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="MediaWiki (en)"> <link rel="EditURI" type="application/rsd+xml" href="//www.mediawiki.org/w/api.php?action=rsd"> <link rel="canonical" href="https://www.mediawiki.org/wiki/Manual:Parser_functions"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"> <link rel="alternate" type="application/atom+xml" title="MediaWiki Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-100 ns-subject page-Manual_Parser_functions rootpage-Manual_Parser_functions skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/MediaWiki" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-mw-download" class="mw-list-item"><a href="/wiki/Download"><span>Get MediaWiki</span></a></li><li id="n-mw-extensions" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Category:Extensions"><span>Get extensions</span></a></li><li id="n-blog-text" class="mw-list-item"><a href="https://techblog.wikimedia.org/"><span>Tech blog</span></a></li><li id="n-mw-contribute" class="mw-list-item"><a href="/wiki/Special:MyLanguage/How_to_contribute"><span>Contribute</span></a></li> </ul> </div> </div> <div id="p-support" class="vector-menu mw-portlet mw-portlet-support" > <div class="vector-menu-heading"> Support </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Help:Contents" title="The place to find out"><span>User help</span></a></li><li id="n-mw-faq" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Manual:FAQ"><span>FAQ</span></a></li><li id="n-mw-manual" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Manual:Contents"><span>Technical manual</span></a></li><li id="n-mw-supportdesk" class="mw-list-item"><a href="/wiki/Project:Support_desk"><span>Support desk</span></a></li><li id="n-mw-communication" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Communication"><span>Communication</span></a></li> </ul> </div> </div> <div id="p-development" class="vector-menu mw-portlet mw-portlet-development" > <div class="vector-menu-heading"> Development </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mw-developerportal" class="mw-list-item"><a href="https://developer.wikimedia.org/"><span>Developer portal</span></a></li><li id="n-svn-statistics" class="mw-list-item"><a href="/wiki/Development_statistics"><span>Code statistics</span></a></li> </ul> </div> </div> <div id="p-mediawiki.org" class="vector-menu mw-portlet mw-portlet-mediawiki_org" > <div class="vector-menu-heading"> mediawiki.org </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-portal" class="mw-list-item"><a href="/wiki/Project:Help" title="About the project, what you can do, where to find things"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes in the wiki [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-mw-translate" class="mw-list-item"><a href="/wiki/Special:LanguageStats"><span>Translate content</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Load a random page [x]" accesskey="x"><span>Random page</span></a></li><li id="n-mw-discussion" class="mw-list-item"><a href="/wiki/Project:Village_Pump"><span>Village pump</span></a></li><li id="n-Sandboxlink-portlet-label" class="mw-list-item"><a href="/wiki/Project:Sandbox"><span>Sandbox</span></a></li> </ul> </div> </div> <div id="p-lang" class="vector-menu mw-portlet mw-portlet-lang" > <div class="vector-menu-heading"> In other languages </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-add wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:NewItem?site=mediawikiwiki&page=Manual%3AParser+functions" title="Add interlanguage links" class="wbc-editpage">Add links</a></span></div> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/MediaWiki" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/mediawikiwiki.svg" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="MediaWiki" src="/static/images/mobile/copyright/mediawikiwiki-wordmark.svg" style="width: 7.5em; height: 1.125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search MediaWiki [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search MediaWiki" aria-label="Search MediaWiki" autocapitalize="sentences" title="Search MediaWiki [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-uls" class="mw-list-item active user-links-collapsible-item"><a data-mw="interface" href="#" class="uls-trigger cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet"><span class="vector-icon mw-ui-icon-wikimedia-language mw-ui-icon-wikimedia-wikimedia-language"></span> <span>English</span></a> </li> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page's font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=www.mediawiki.org&uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&returnto=Manual%3AParser+functions" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&returnto=Manual%3AParser+functions" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="More options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=www.mediawiki.org&uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&returnto=Manual%3AParser+functions" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&returnto=Manual%3AParser+functions" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">Beginning</div> </a> </li> <li id="toc-Description" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Description"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Description</span> </div> </a> <ul id="toc-Description-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Simple_example" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Simple_example"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Simple example</span> </div> </a> <button aria-controls="toc-Simple_example-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Simple example subsection</span> </button> <ul id="toc-Simple_example-sublist" class="vector-toc-list"> <li id="toc-Within_LocalSettings.php" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Within_LocalSettings.php"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.1</span> <span>Within LocalSettings.php</span> </div> </a> <ul id="toc-Within_LocalSettings.php-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Longer_functions" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Longer_functions"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.2</span> <span>Longer functions</span> </div> </a> <ul id="toc-Longer_functions-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Parser_interface" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Parser_interface"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Parser interface</span> </div> </a> <button aria-controls="toc-Parser_interface-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Parser interface subsection</span> </button> <ul id="toc-Parser_interface-sublist" class="vector-toc-list"> <li id="toc-Controlling_the_parsing_of_output" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Controlling_the_parsing_of_output"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.1</span> <span>Controlling the parsing of output</span> </div> </a> <ul id="toc-Controlling_the_parsing_of_output-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Naming" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Naming"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.2</span> <span>Naming</span> </div> </a> <ul id="toc-Naming-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-The_setFunctionHook_hook" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#The_setFunctionHook_hook"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.3</span> <span>The setFunctionHook hook</span> </div> </a> <ul id="toc-The_setFunctionHook_hook-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Expensive_parser_functions" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Expensive_parser_functions"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4</span> <span>Expensive parser functions</span> </div> </a> <ul id="toc-Expensive_parser_functions-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Named_parameters" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Named_parameters"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Named parameters</span> </div> </a> <ul id="toc-Named_parameters-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-namespace">Manual</span><span class="mw-page-title-separator">:</span><span class="mw-page-title-main">Parser functions</span></h1> <div class="mw-indicators"> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-manual" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Manual:Parser_functions" title="View the subject page [c]" accesskey="c"><span>Manual</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Manual_talk:Parser_functions" rel="discussion" title="Discussion about the content page [t]" accesskey="t"><span>Discussion</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Manual:Parser_functions"><span>Read</span></a></li><li id="ca-viewsource" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Manual:Parser_functions&action=edit" title="This page is protected. You can view its source [e]" accesskey="e"><span>View source</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Manual:Parser_functions&action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Manual:Parser_functions"><span>Read</span></a></li><li id="ca-more-viewsource" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Manual:Parser_functions&action=edit"><span>View source</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Manual:Parser_functions&action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Manual:Parser_functions" title="A list of all wiki pages that link here [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Manual:Parser_functions" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="//commons.wikimedia.org/wiki/Special:UploadWizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Manual:Parser_functions&oldid=6846788" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Manual:Parser_functions&action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&page=Manual%3AParser_functions&id=6846788&wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FManual%3AParser_functions"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FManual%3AParser_functions"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-create_a_book" class="mw-list-item"><a href="/w/index.php?title=Special:Book&bookcmd=book_creator&referer=Manual%3AParser+functions"><span>Create a book</span></a></li><li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&page=Manual%3AParser_functions&action=show-download-screen"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Manual:Parser_functions&printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects emptyPortlet" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div id="siteSub" class="noprint">From mediawiki.org</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-pt-translate-header noprint nomobile" dir="ltr" lang="en"><a href="/w/index.php?title=Special:Translate&group=page-Manual%3AParser+functions&action=page&filter=&action_source=translate_page" title="Special:Translate">Translate this page</a></div><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="mw-pt-languages noprint navigation-not-searchable" lang="en" dir="ltr"><div class="mw-pt-languages-label">Languages:</div><ul class="mw-pt-languages-list"><li><a href="/wiki/Manual:Parser_functions/id" class="mw-pt-progress mw-pt-progress--med" title="Pedoman:Fungsi parser (17% translated)" lang="id" dir="ltr">Bahasa Indonesia</a></li> <li><a href="/wiki/Manual:Parser_functions/de" class="mw-pt-progress mw-pt-progress--med" title="Manual:Parser-Funktionen (34% translated)" lang="de" dir="ltr">Deutsch</a></li> <li><span class="mw-pt-languages-ui mw-pt-languages-selected mw-pt-progress mw-pt-progress--complete" lang="en" dir="ltr">English</span></li> <li><a href="/wiki/Manual:Parser_functions/eo" class="mw-pt-progress mw-pt-progress--low" title="Manlibro:Sintaksanalizilaj funkcioj (7% translated)" lang="eo" dir="ltr">Esperanto</a></li> <li><a href="/wiki/Manual:Parser_functions/dtp" class="mw-pt-progress mw-pt-progress--low" title="Manual:Parser functions/dtp (4% translated)" lang="dtp" dir="ltr">Kadazandusun</a></li> <li><a href="/wiki/Manual:Parser_functions/nl" class="mw-pt-progress mw-pt-progress--complete" title="Handboek:Parserfuncties (100% translated)" lang="nl" dir="ltr">Nederlands</a></li> <li><a href="/wiki/Manual:Parser_functions/vi" class="mw-pt-progress mw-pt-progress--med" title="Hướng dẫn:Hàm phân tích cú pháp (32% translated)" lang="vi" dir="ltr">Tiếng Việt</a></li> <li><a href="/wiki/Manual:Parser_functions/tr" class="mw-pt-progress mw-pt-progress--med" title="Manual:Ayrıştırıcı işlevleri (40% translated)" lang="tr" dir="ltr">Türkçe</a></li> <li><a href="/wiki/Manual:Parser_functions/da" class="mw-pt-progress mw-pt-progress--med" title="Manual:Parser functions/da (25% translated)" lang="da" dir="ltr">dansk</a></li> <li><a href="/wiki/Manual:Parser_functions/es" class="mw-pt-progress mw-pt-progress--complete" title="Manual:Funciones del analizador sintáctico (100% translated)" lang="es" dir="ltr">español</a></li> <li><a href="/wiki/Manual:Parser_functions/fr" class="mw-pt-progress mw-pt-progress--complete" title="Fonctions d'analyse (100% translated)" lang="fr" dir="ltr">français</a></li> <li><a href="/wiki/Manual:Parser_functions/pl" class="mw-pt-progress mw-pt-progress--low" title="Podręcznik:Funkcje parsera (6% translated)" lang="pl" dir="ltr">polski</a></li> <li><a href="/wiki/Manual:Parser_functions/pt" class="mw-pt-progress mw-pt-progress--low" title="Manual:Funções do Analisador (12% translated)" lang="pt" dir="ltr">português</a></li> <li><a href="/wiki/Manual:Parser_functions/pt-br" class="mw-pt-progress mw-pt-progress--low" title="Manual:Funções do analisador sintático (4% translated)" lang="pt-BR" dir="ltr">português do Brasil</a></li> <li><a href="/wiki/Manual:Parser_functions/sv" class="mw-pt-progress mw-pt-progress--low" title="Manual:Parserfunktioner (1% translated)" lang="sv" dir="ltr">svenska</a></li> <li><a href="/wiki/Manual:Parser_functions/cs" class="mw-pt-progress mw-pt-progress--complete" title="Příručka:Parsovací funkce (100% translated)" lang="cs" dir="ltr">čeština</a></li> <li><a href="/wiki/Manual:Parser_functions/ru" class="mw-pt-progress mw-pt-progress--med" title="Руководство:Функции парсера (66% translated)" lang="ru" dir="ltr">русский</a></li> <li><a href="/wiki/Manual:Parser_functions/ar" class="mw-pt-progress mw-pt-progress--complete" title="دليل:دوال المحلل اللغوي (100% translated)" lang="ar" dir="rtl">العربية</a></li> <li><a href="/wiki/Manual:Parser_functions/th" class="mw-pt-progress mw-pt-progress--low" title="คู่มือการใช้:พาร์เซอร์ฟังก์ชัน (3% translated)" lang="th" dir="ltr">ไทย</a></li> <li><a href="/wiki/Manual:Parser_functions/zh" class="mw-pt-progress mw-pt-progress--med" title="Manual:解析器函数 (37% translated)" lang="zh" dir="ltr">中文</a></li> <li><a href="/wiki/Manual:Parser_functions/ja" class="mw-pt-progress mw-pt-progress--med" title="Manual:パーサー関数 (63% translated)" lang="ja" dir="ltr">日本語</a></li> <li><a href="/wiki/Manual:Parser_functions/ko" class="mw-pt-progress mw-pt-progress--low" title="메뉴얼:파서 함수 (10% translated)" lang="ko" dir="ltr">한국어</a></li></ul></div> <style data-mw-deduplicate="TemplateStyles:r6651103">.mw-parser-output .nmbox{background:#f8f9fa;border:1px solid #AAA;box-sizing:border-box;margin:2px 0;padding:0}.mw-parser-output .nmbox *{box-sizing:border-box}.mw-parser-output .nmbox-header{background:#eaecf0;padding:4px 0.5em;font-weight:bold;text-align:center;white-space:nowrap}.mw-parser-output .nmbox .mbox-image{display:inline-block;padding-right:1em}.mw-parser-output .nmbox-text{border-top:1px solid #AAA;width:100%;padding:4px 0.5em}@media screen and (min-width:768px){.mw-parser-output .nmbox-header{display:table-cell;border-right:1px solid #AAA;width:1%}.mw-parser-output .nmbox-text{border-top:none;display:table-cell}}@media screen{html.skin-theme-clientpref-night .mw-parser-output .nmbox-header,html.skin-theme-clientpref-night .mw-parser-output .nmbox{background:transparent;color:inherit}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .nmbox-header,html.skin-theme-clientpref-os .mw-parser-output .nmbox{background:transparent;color:inherit}}</style> <div class="nmbox noprint mw-content-ltr"><div class="nmbox-header"><div class="nmbox-image mbox-image"><span class="skin-invert" typeof="mw:File"><a href="/wiki/Special:MyLanguage/Manual:Extensions" title="Special:MyLanguage/Manual:Extensions"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/f/fb/OOjs_UI_icon_puzzle-ltr.svg/20px-OOjs_UI_icon_puzzle-ltr.svg.png" decoding="async" width="20" height="20" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/f/fb/OOjs_UI_icon_puzzle-ltr.svg/30px-OOjs_UI_icon_puzzle-ltr.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/f/fb/OOjs_UI_icon_puzzle-ltr.svg/40px-OOjs_UI_icon_puzzle-ltr.svg.png 2x" data-file-width="20" data-file-height="20" /></a></span></div><b><a href="/wiki/Special:MyLanguage/Manual:Extensions" title="Special:MyLanguage/Manual:Extensions">Extensions:</a><span style="display:none"><a href="/wiki/Manual:Extensions" title="Manual:Extensions"> </a></span></b> </div> <div class="nmbox-text mbox-text"><style data-mw-deduplicate="TemplateStyles:r6387430">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li,.mw-parser-output .hlist .mw-empty-elt{display:none}.mw-parser-output .hlist dt:after{content:": "}.mw-parser-output .hlist dd:after,.mw-parser-output .hlist li:after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child:after,.mw-parser-output .hlist dt:last-child:after,.mw-parser-output .hlist li:last-child:after{content:none}.mw-parser-output .hlist dd dd:first-child:before,.mw-parser-output .hlist dd dt:first-child:before,.mw-parser-output .hlist dd li:first-child:before,.mw-parser-output .hlist dt dd:first-child:before,.mw-parser-output .hlist dt dt:first-child:before,.mw-parser-output .hlist dt li:first-child:before,.mw-parser-output .hlist li dd:first-child:before,.mw-parser-output .hlist li dt:first-child:before,.mw-parser-output .hlist li li:first-child:before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child:after,.mw-parser-output .hlist dd dt:last-child:after,.mw-parser-output .hlist dd li:last-child:after,.mw-parser-output .hlist dt dd:last-child:after,.mw-parser-output .hlist dt dt:last-child:after,.mw-parser-output .hlist dt li:last-child:after,.mw-parser-output .hlist li dd:last-child:after,.mw-parser-output .hlist li dt:last-child:after,.mw-parser-output .hlist li li:last-child:after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li:before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child:before,.mw-parser-output .hlist dt ol>li:first-child:before,.mw-parser-output .hlist li ol>li:first-child:before{content:" ("counter(listitem)"\a0 "}</style><div class="hlist"> <ul><li><a href="/wiki/Special:MyLanguage/Manual:Developing_extensions" title="Special:MyLanguage/Manual:Developing extensions">Development</a><span style="display:none"><a href="/wiki/Manual:Developing_extensions" title="Manual:Developing extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Tag_extensions" title="Special:MyLanguage/Manual:Tag extensions">Tag extensions</a><span style="display:none"><a href="/wiki/Manual:Tag_extensions" title="Manual:Tag extensions"> </a></span></li> <li><b><a href="/wiki/Special:MyLanguage/Manual:Parser_functions" title="Special:MyLanguage/Manual:Parser functions">Parser functions</a></b><span style="display:none"><a class="mw-selflink selflink"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Hooks" title="Special:MyLanguage/Manual:Hooks">Hooks</a><span style="display:none"><a href="/wiki/Manual:Hooks" title="Manual:Hooks"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Special_pages" title="Special:MyLanguage/Manual:Special pages">Special pages</a><span style="display:none"><a href="/wiki/Manual:Special_pages" title="Manual:Special pages"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Skins" title="Special:MyLanguage/Manual:Skins">Skins</a><span style="display:none"><a href="/wiki/Manual:Skins" title="Manual:Skins"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Magic_words" title="Special:MyLanguage/Manual:Magic words">Magic words</a><span style="display:none"><a href="/wiki/Manual:Magic_words" title="Manual:Magic words"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/API:Extensions" title="Special:MyLanguage/API:Extensions">API</a><span style="display:none"><a href="/wiki/API:Extensions" title="API:Extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Page_content_models" title="Special:MyLanguage/Manual:Page content models">Content models</a><span style="display:none"><a href="/wiki/Manual:Page_content_models" title="Manual:Page content models"> </a></span></li></ul> </div></div> </div> <figure class="mw-halign-right" typeof="mw:File"><a href="/wiki/File:MediaWiki-extensions-icon.svg" class="mw-file-description"><img alt="MediaWiki extensions" src="//upload.wikimedia.org/wikipedia/commons/thumb/2/23/MediaWiki-extensions-icon.svg/125px-MediaWiki-extensions-icon.svg.png" decoding="async" width="125" height="84" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/2/23/MediaWiki-extensions-icon.svg/188px-MediaWiki-extensions-icon.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/2/23/MediaWiki-extensions-icon.svg/250px-MediaWiki-extensions-icon.svg.png 2x" data-file-width="686" data-file-height="463" /></a><figcaption></figcaption></figure> <p>Parser functions, added in MediaWiki 1.7, are a type of extension that integrate closely with the parser. The phrase "parser function" should not be confused with <a href="/wiki/Special:MyLanguage/Extension:ParserFunctions" title="Special:MyLanguage/Extension:ParserFunctions">Extension:ParserFunctions</a><span style="display:none"><a href="/wiki/Extension:ParserFunctions" title="Extension:ParserFunctions"> </a></span>, which is a collection of simple parser functions. (See <a href="/wiki/Special:MyLanguage/Help:Extension:ParserFunctions" title="Special:MyLanguage/Help:Extension:ParserFunctions">Help:Extension:ParserFunctions</a><span style="display:none"><a href="/wiki/Help:Extension:ParserFunctions" title="Help:Extension:ParserFunctions"> </a></span> for those.) </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Description">Description</h2></div> <p>Whereas a <a href="/wiki/Special:MyLanguage/Manual:Tag_extensions" title="Special:MyLanguage/Manual:Tag extensions">tag extension</a> is expected to take unprocessed text and return HTML to the browser, a parser function can 'interact' with other wiki elements in the page. For example, the output of a parser function could be used as a <a href="/wiki/Special:MyLanguage/Help:Templates#Parameters" title="Special:MyLanguage/Help:Templates">template parameter</a> or in the construction of a <a href="/wiki/Special:MyLanguage/Help:Link" title="Special:MyLanguage/Help:Link">link</a>. </p><p>The typical syntax for a parser function is: </p> <blockquote><p> {{ #functionname: param1 | param2 | param3 }} </p></blockquote> <p>For more information, see <span class="plainlinks"><a class="external text" href="https://doc.wikimedia.org/mediawiki-core/master/php/classParser.html#a501ce7bb8f461a1b5fbd9f05970cab67">the documentation</a></span> for <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="nx">Parser</span><span class="o">::</span><span class="na">setFunctionHook</span> <span class="p">(</span> <span class="nv">$id</span><span class="p">,</span> <span class="nv">$callback</span><span class="p">,</span> <span class="nv">$flags</span> <span class="o">=</span> <span class="mi">0</span> <span class="p">)</span></code>. This documentation states: </p> <dl><dd>The callback function should have the form: <dl><dd><code>function myParserFunction( $parser, $arg1, $arg2, $arg3 ) { ... }</code></dd></dl></dd> <dd>Or with <code>SFH_OBJECT_ARGS</code>: <dl><dd><code>function myParserFunction( $parser, $frame, $args ) { ... }</code></dd></dl></dd></dl> <p>The first variant of the call passes all arguments as plain text. The second passes all arguments as an array of <a href="/wiki/Special:MyLanguage/Manual:PPNode.php" title="Special:MyLanguage/Manual:PPNode.php">PPNode</a><span style="display:none"><a href="/wiki/Manual:PPNode.php" title="Manual:PPNode.php"> </a></span>s, except for the first (<code>$args[0]</code>), which is currently text, though this may change in the future. These represent the unexpanded wikitext. The <code><a href="/wiki/Special:MyLanguage/Manual:PPFrame.php" title="Special:MyLanguage/Manual:PPFrame.php">$frame</a><span style="display:none"><a href="/wiki/Manual:PPFrame.php" title="Manual:PPFrame.php"> </a></span></code> parameter can be used to expand these arguments as needed. This is commonly used for conditional processing so that only the <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code> case is evaluated with an <code>if-</code> or <code>switch-like</code> parser function. The frame object can also climb up the document tree to get information about the caller and has functions to determine and manage call depth, time-to-live, and whether the result of the parser function is volatile. </p><p>Creating a parser function is slightly more complicated than creating a new tag because the function name must be a <a href="/wiki/Special:MyLanguage/Help:Magic_words" title="Special:MyLanguage/Help:Magic words">magic word</a>, a keyword that supports aliases and localization. </p> <div class="mw-heading mw-heading2"><h2 id="Simple_example">Simple example</h2></div> <p>Below is an example of an extension that creates a parser function. </p><p>The registration goes into <b>extension.json</b> and the code into <b>src/ExampleExtensionHooks.php</b> respectively: </p> <table class="wikitable"> <tbody><tr> <th>Standard: </th> <th>Using the HookHandler interface: </th></tr> <tr> <td colspan="2"><b>extension.json</b> </td></tr> <tr> <td><div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ExampleExtension"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"author"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Me"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.0.0"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://www.mediawiki.org/wiki/Extension:ExampleExtension"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"descriptionmsg"</span><span class="p">:</span><span class="w"> </span><span class="s2">"exampleextension-desc"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"license-name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"GPL-2.0-or-later"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"parserhook"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"MessagesDirs"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ExampleExtension"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="s2">"i18n"</span> <span class="w"> </span><span class="p">]</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">"AutoloadClasses"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ExampleExtensionHooks"</span><span class="p">:</span><span class="w"> </span><span class="s2">"src/ExampleExtensionHooks.php"</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">"ExtensionMessagesFiles"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ExampleExtensionMagic"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ExampleExtension.i18n.php"</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">"Hooks"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ParserFirstCallInit"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ExampleExtensionHooks::onParserFirstCallInit"</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">"manifest_version"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span> <span class="p">}</span> </pre></div> </td> <td> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{</span> <span class="w"> </span><span class="nt">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ExampleExtension"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"author"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Me"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.0.0"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://www.mediawiki.org/wiki/Extension:ExampleExtension"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"descriptionmsg"</span><span class="p">:</span><span class="w"> </span><span class="s2">"exampleextension-desc"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"license-name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"GPL-2.0-or-later"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"parserhook"</span><span class="p">,</span> <span class="w"> </span><span class="nt">"MessagesDirs"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ExampleExtension"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span> <span class="w"> </span><span class="s2">"i18n"</span> <span class="w"> </span><span class="p">]</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">"AutoloadClasses"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ExampleExtensionHooks"</span><span class="p">:</span><span class="w"> </span><span class="s2">"src/ExampleExtensionHooks.php"</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">"ExtensionMessagesFiles"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ExampleExtensionMagic"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ExampleExtension.i18n.php"</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">"Hooks"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ParserFirstCallInit"</span><span class="p">:</span><span class="w"> </span><span class="s2">"onParserFirstCallInit"</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">"HookHandlers"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ExampleExtensionHooks"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"class"</span><span class="p">:</span><span class="w"> </span><span class="s2">"MediaWiki\\Extension\\ExampleExtension\\Hooks"</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">},</span> <span class="w"> </span><span class="nt">"manifest_version"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span> <span class="p">}</span> </pre></div> </td></tr> <tr> <td colspan="2"><b>ExampleExtensionHooks.php</b> </td></tr> <tr> <td><div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?php</span> <span class="k">class</span> <span class="nc">ExampleExtensionHooks</span> <span class="p">{</span> <span class="c1">// Register any render callbacks with the parser</span> <span class="k">public</span> <span class="k">static</span> <span class="k">function</span> <span class="nf">onParserFirstCallInit</span><span class="p">(</span> <span class="nx">Parser</span> <span class="nv">$parser</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// Create a function hook associating the <code>example</code> magic word with renderExample()</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">setFunctionHook</span><span class="p">(</span> <span class="s1">'example'</span><span class="p">,</span> <span class="p">[</span> <span class="nx">self</span><span class="o">::</span><span class="na">class</span><span class="p">,</span> <span class="s1">'renderExample'</span> <span class="p">]</span> <span class="p">);</span> <span class="p">}</span> <span class="c1">// Render the output of {{#example:}}.</span> <span class="k">public</span> <span class="k">static</span> <span class="k">function</span> <span class="nf">renderExample</span><span class="p">(</span> <span class="nx">Parser</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nv">$param1</span> <span class="o">=</span> <span class="s1">''</span><span class="p">,</span> <span class="nv">$param2</span> <span class="o">=</span> <span class="s1">''</span><span class="p">,</span> <span class="nv">$param3</span> <span class="o">=</span> <span class="s1">''</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// The input parameters are wikitext with templates expanded.</span> <span class="c1">// The output should be wikitext too.</span> <span class="nv">$output</span> <span class="o">=</span> <span class="s2">"param1 is </span><span class="si">$param1</span><span class="s2"> and param2 is </span><span class="si">$param2</span><span class="s2"> and param3 is </span><span class="si">$param3</span><span class="s2">"</span><span class="p">;</span> <span class="k">return</span> <span class="nv">$output</span><span class="p">;</span> <span class="p">}</span> <span class="p">}</span> </pre></div> </td> <td><div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?php</span> <span class="k">class</span> <span class="nc">ExampleExtensionHooks</span> <span class="k">implements</span> <span class="nx">ParserFirstCallInitHook</span> <span class="p">{</span> <span class="c1">// Register any render callbacks with the parser</span> <span class="k">public</span> <span class="k">function</span> <span class="nf">onParserFirstCallInit</span><span class="p">(</span> <span class="nv">$parser</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// Create a function hook associating the <code>example</code> magic word with renderExample()</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">setFunctionHook</span><span class="p">(</span> <span class="s1">'example'</span><span class="p">,</span> <span class="p">[</span> <span class="nv">$this</span><span class="p">,</span> <span class="s1">'renderExample'</span> <span class="p">]</span> <span class="p">);</span> <span class="p">}</span> <span class="c1">// Render the output of {{#example:}}.</span> <span class="k">public</span> <span class="k">function</span> <span class="nf">renderExample</span><span class="p">(</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nv">$param1</span> <span class="o">=</span> <span class="s1">''</span><span class="p">,</span> <span class="nv">$param2</span> <span class="o">=</span> <span class="s1">''</span><span class="p">,</span> <span class="nv">$param3</span> <span class="o">=</span> <span class="s1">''</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// The input parameters are wikitext with templates expanded.</span> <span class="c1">// The output should be wikitext too.</span> <span class="nv">$output</span> <span class="o">=</span> <span class="s2">"param1 is </span><span class="si">$param1</span><span class="s2"> and param2 is </span><span class="si">$param2</span><span class="s2"> and param3 is </span><span class="si">$param3</span><span class="s2">"</span><span class="p">;</span> <span class="k">return</span> <span class="nv">$output</span><span class="p">;</span> <span class="p">}</span> <span class="p">}</span> </pre></div> </td></tr></tbody></table> <p>Another file, <b>ExampleExtension.i18n.php</b>, in your extension directory (Not in the src/ subdirectory) should contain: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?php</span> <span class="sd">/**</span> <span class="sd"> * @license GPL-2.0-or-later</span> <span class="sd"> * @author Your Name (YourUserName)</span> <span class="sd"> */</span> <span class="nv">$magicWords</span> <span class="o">=</span> <span class="p">[];</span> <span class="sd">/** English</span> <span class="sd"> * @author Your Name (YourUserName)</span> <span class="sd"> */</span> <span class="nv">$magicWords</span><span class="p">[</span><span class="s1">'en'</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">'example'</span> <span class="o">=></span> <span class="p">[</span> <span class="mi">0</span><span class="p">,</span> <span class="s1">'example'</span> <span class="p">],</span> <span class="p">];</span> </pre></div> <p>With this extension enabled, </p> <ul><li>{{#example: hello | hi | hey}}</li></ul> <p>produces: </p> <ul><li>param1 is hello and param2 is hi and param3 is hey</li></ul> <style data-mw-deduplicate="TemplateStyles:r6651107">.mw-parser-output .note{background-position:left 7px top 50%;padding:0.5em 0.5em 0.5em 40px;margin:0.5em 0;overflow:hidden;background-color:#f8f9fa;color:#333;background-repeat:no-repeat;border:1px solid #ddd}.mw-parser-output .note-inline{display:inline-block;vertical-align:middle}.mw-parser-output .note-info{background-color:#eaf3ff;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/e/ec/OOjs_UI_icon_information-progressive.svg");background-size:25px;border-color:#a3caff;padding-left:40px;min-height:25px}.mw-parser-output .note-reminder{background-color:#fff9ea;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/a/a8/OOjs_UI_icon_lightbulb-yellow.svg");background-size:25px;border-color:#fc3;min-height:25px}.mw-parser-output .note-warn{background-color:#fff9ea;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/3/3b/OOjs_UI_icon_alert-warning.svg");background-size:25px;border-color:#fc3;min-height:25px}.mw-parser-output .note-error{background-color:#fee7e6;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/b/bf/OOjs_UI_icon_notice-destructive.svg");background-size:25px;border-color:#c33;min-height:25px}@media screen{html.skin-theme-clientpref-night .mw-parser-output .note{background-color:transparent;color:inherit}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .note{background-color:transparent;color:inherit}}</style><div role="note" class="note note-info">This magicWords array is not optional. If it is omitted, the parser function simply will not work; the {{#example: hello | hi}} will be rendered as though the extension were not installed. If only the language-specific array is initialized and not the magicWords array itself, this can cause localization errors as translations from other extensions leak into yours. You can associate magic words inline in PHP rather than through a i18n file. This is useful when defining hooks in <code>LocalSettings.php</code> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nx">MediaWiki\MediaWikiServices</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-></span><span class="na">getContentLanguage</span><span class="p">()</span><span class="o">-></span><span class="na">mMagicExtensions</span><span class="p">[</span><span class="s1">'wikicodeToHtml'</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'MAG_CUSTOM'</span><span class="p">,</span> <span class="s1">'custom'</span><span class="p">];</span> </pre></div></div> <div class="mw-heading mw-heading3"><h3 id="Within_LocalSettings.php">Within LocalSettings.php</h3></div> <p>Magic words and their handling parser functions can be defined entirely in LocalSettings.php. </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="nv">$wgHooks</span><span class="p">[</span><span class="s1">'ParserFirstCallInit'</span><span class="p">][]</span> <span class="o">=</span> <span class="k">function</span> <span class="p">(</span> <span class="nx">Parser</span> <span class="nv">$parser</span> <span class="p">)</span> <span class="p">{</span> <span class="nx">MediaWiki\MediaWikiServices</span><span class="o">::</span><span class="na">getInstance</span><span class="p">()</span><span class="o">-></span><span class="na">getContentLanguage</span><span class="p">()</span><span class="o">-></span><span class="na">mMagicExtensions</span><span class="p">[</span><span class="s1">'wikicodeToHtml'</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'wikicodeToHtml'</span><span class="p">,</span> <span class="s1">'wikicodeToHtml'</span><span class="p">];</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">setFunctionHook</span><span class="p">(</span> <span class="s1">'wikicodeToHtml'</span><span class="p">,</span> <span class="s1">'wikicodeToHtml'</span> <span class="p">);</span> <span class="p">};</span> <span class="k">function</span> <span class="nf">wikicodeToHtml</span><span class="p">(</span> <span class="nx">Parser</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nv">$code</span> <span class="o">=</span> <span class="s1">''</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$title</span> <span class="o">=</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">getTitle</span><span class="p">();</span> <span class="nv">$options</span> <span class="o">=</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">Options</span><span class="p">();</span> <span class="nv">$options</span><span class="o">-></span><span class="na">enableLimitReport</span><span class="p">(</span><span class="k">false</span><span class="p">);</span> <span class="nv">$parser</span> <span class="o">=</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">getFreshParser</span><span class="p">();</span> <span class="k">return</span> <span class="p">[</span><span class="nv">$parser</span><span class="o">-></span><span class="na">parse</span><span class="p">(</span><span class="nv">$code</span><span class="p">,</span> <span class="nv">$title</span><span class="p">,</span> <span class="nv">$options</span><span class="p">)</span><span class="o">-></span><span class="na">getText</span><span class="p">(),</span> <span class="s1">'isHTML'</span> <span class="o">=></span> <span class="k">true</span><span class="p">];</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Longer_functions">Longer functions</h3></div> <p>For longer functions, you may want to split the hook functions out to a _body.php or .hooks.php file and make them static functions of a class. Then you can load the class with <a href="/wiki/Special:MyLanguage/Manual:$wgAutoloadClasses" title="Special:MyLanguage/Manual:$wgAutoloadClasses">$wgAutoloadClasses</a><span style="display:none"><a href="/wiki/Manual:$wgAutoloadClasses" title="Manual:$wgAutoloadClasses"> </a></span> and call the static functions in the hooks; e.g.: </p><p>Put this in your <code>extension.json</code> file: </p> <div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"><pre><span></span><span class="nt">"Hooks"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ParserFirstCallInit"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ExampleExtensionHooks::onParserFirstCallInit"</span> <span class="p">},</span> <span class="nt">"AutoloadClasses"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="nt">"ExampleExtensionHooks"</span><span class="p">:</span><span class="w"> </span><span class="s2">"src/ExampleExtensionHooks.php"</span> <span class="p">}</span> </pre></div> <ul><li><small>See: <a href="/wiki/Special:MyLanguage/Manual:Hooks#Writing_an_event_handler" title="Special:MyLanguage/Manual:Hooks">writing an event handler</a> for other styles.</small></li></ul> <p>Then put this in your <code>src/ExampleExtensionHooks.php</code> file: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">class</span> <span class="nc">ExampleExtensionHooks</span> <span class="p">{</span> <span class="k">public</span> <span class="k">static</span> <span class="k">function</span> <span class="nf">onParserFirstCallInit</span><span class="p">(</span> <span class="nx">Parser</span> <span class="nv">$parser</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">setFunctionHook</span><span class="p">(</span> <span class="s1">'example'</span><span class="p">,</span> <span class="p">[</span> <span class="nx">self</span><span class="o">::</span><span class="na">class</span><span class="p">,</span> <span class="s1">'renderExample'</span> <span class="p">]</span> <span class="p">);</span> <span class="p">}</span> <span class="p">}</span> </pre></div> <p><br /> </p> <div class="mw-heading mw-heading2"><h2 id="Parser_interface">Parser interface</h2></div> <div class="mw-heading mw-heading3"><h3 id="Controlling_the_parsing_of_output">Controlling the parsing of output</h3></div> <p>To have the wikitext returned by your parser function be fully parsed (including expansion of templates), set the <code>noparse</code> option to <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">false</span></code> when returning: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">return</span> <span class="p">[</span> <span class="nv">$output</span><span class="p">,</span> <span class="s1">'noparse'</span> <span class="o">=></span> <span class="k">false</span> <span class="p">];</span> </pre></div> <p>It seems the default value for <code>noparse</code> changed from <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">false</span></code> to <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code>, at least in some situations, sometime around version 1.12. </p><p>Conversely, to have your parser function return HTML that remains unparsed, rather than returning wikitext, use this: </p> <div class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">return</span> <span class="p">[</span> <span class="nv">$output</span><span class="p">,</span> <span class="s1">'noparse'</span> <span class="o">=></span> <span class="k">true</span><span class="p">,</span> <span class="s1">'isHTML'</span> <span class="o">=></span> <span class="k">true</span> <span class="p">];</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Naming">Naming</h3></div> <p>By default, MW adds a hash character (number sign, <code>#</code>) to the name of each parser function. To suppress that addition (and obtain a parser function with no <code>#</code> prefix), include the <i>SFH_NO_HASH</i> constant in the optional flags argument to setFunctionHook, as described <a href="#The_setFunctionHook_hook">below</a>. </p><p>When choosing a name without a hash prefix, note that transclusion of a page with a name starting with that function name followed by a colon is no longer possible. In particular, avoid function names equal to a namespace name. In the case that interwiki transclusion <a class="external autonumber" href="https://lists.wikimedia.org/hyperkitty/list/mediawiki-l@lists.wikimedia.org/thread/3M53FBQ66B4EZNU6XMJQRFG3TVCW7WQO/">[1]</a> is enabled, also avoid function names equal to an interwiki prefix. </p> <div class="mw-heading mw-heading3"><h3 id="The_setFunctionHook_hook">The setFunctionHook hook</h3></div> <p>For more details of the interface into the parser, see the documentation for setFunctionHook in includes/Parser.php. Here's a (possibly dated) copy of those comments: </p><p><b>function setFunctionHook( $id, $callback, $flags = 0 )</b> </p><p><b>Parameters:</b> </p> <ul><li>string $id - The magic word ID</li> <li>mixed $callback - The callback function (and object) to use</li> <li>integer $flags - Optional. Values:</li></ul> <dl><dd><ul><li><i>SFH_NO_HASH</i> (1) constant if you call the function without <code>#</code>.</li> <li><i>SFH_OBJECT_ARGS</i> (2) if you pass a PPFrame object and array of arguments instead of a series of function arguments, for which <a href="#Description">see above</a>.</li> <li>Defaults to 0 (no flags).</li></ul></dd></dl> <p><b>Return value:</b> The old callback function for this name, if any </p><p>Create a function, e.g., <code>{{#sum:1|2|3}}</code>. The callback function should have the form: </p> <div style="overflow:auto;" class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">function</span> <span class="nf">myParserFunction</span><span class="p">(</span> <span class="nv">$parser</span><span class="p">,</span> <span class="nv">$arg1</span><span class="p">,</span> <span class="nv">$arg2</span><span class="p">,</span> <span class="nv">$arg3</span> <span class="p">)</span> <span class="p">{</span> <span class="o">...</span> <span class="p">}</span> </pre></div> <p>The callback may either return the text result of the function, or an array with the text in element 0, and a number of flags in the other elements. The names of the flags are specified in the keys. Valid flags are: </p> <table class="wikitable"> <tbody><tr> <th>Name</th> <th>Type</th> <th>Default </th> <th>Description </th></tr> <tr> <td>found</td> <td>Boolean</td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code> </td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code> if the text returned is valid and processing of the template must stop. </td></tr> <tr> <td>text</td> <td>?</td> <td>? </td> <td>The text to return from the function. If isChildObj or isLocalObj are specified, this should be a DOM node instead. </td></tr> <tr> <td>noparse</td> <td>Boolean</td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code> </td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code> if text should not be preprocessed to a DOM tree, e.g. unsafe HTML tags should not be stripped, etc. </td></tr> <tr> <td>isHTML</td> <td>Boolean</td> <td>? </td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code> if the returned text is HTML and must be armoured against wikitext transformation. <a href="/wiki/Manual_talk:Parser_functions#isHTML_-_almost_but_not_entirely" title="Manual talk:Parser functions">But see discussion</a> </td></tr> <tr> <td>nowiki</td> <td>Boolean</td> <td>usually <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">false</span></code> </td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code> if wiki markup in the return value (text) should be escaped. </td></tr> <tr> <td>isChildObj</td> <td>Boolean</td> <td>? </td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code> if the text is a DOM node needing expansion in a child frame. </td></tr> <tr> <td>isLocalObj</td> <td>Boolean</td> <td>? </td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code> if the text is a DOM node needing expansion in the current frame. The default value depends on other values and outcomes. </td></tr> <tr> <td>preprocessFlags</td> <td>?</td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">false</span></code> </td> <td>Optional <a href="/wiki/Special:MyLanguage/Manual:PPFrame.php" title="Special:MyLanguage/Manual:PPFrame.php">PPFrame</a><span style="display:none"><a href="/wiki/Manual:PPFrame.php" title="Manual:PPFrame.php"> </a></span> flags to use when parsing the returned text. This only applies when noparse is <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">false</span></code>. </td></tr> <tr> <td>title</td> <td>?</td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">false</span></code> </td> <td>The <a href="/wiki/Special:MyLanguage/Manual:Title.php" title="Special:MyLanguage/Manual:Title.php">Title</a><span style="display:none"><a href="/wiki/Manual:Title.php" title="Manual:Title.php"> </a></span> object where the text came from. </td></tr> <tr> <td>forceRawInterwiki</td> <td>Boolean</td> <td>? </td> <td><code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">true</span></code> if interwiki transclusion must be forced to be done in raw mode and not rendered. </td></tr></tbody></table> <div class="mw-heading mw-heading3"><h3 id="Expensive_parser_functions">Expensive parser functions</h3></div> <p>Some parser functions represent a significant use of a wiki's resources and should be marked as "expensive". The number of expensive parser functions on any given page is limited by the <a href="/wiki/Special:MyLanguage/Manual:$wgExpensiveParserFunctionLimit" title="Special:MyLanguage/Manual:$wgExpensiveParserFunctionLimit">$wgExpensiveParserFunctionLimit</a><span style="display:none"><a href="/wiki/Manual:$wgExpensiveParserFunctionLimit" title="Manual:$wgExpensiveParserFunctionLimit"> </a></span> setting. What counts as expensive is left up to the function itself, but typically, anything that is likely to cause a delay that extends beyond simple processing of data should be considered. This includes things like database reads and writes, launching a shell script synchronously, or file manipulation. On the other hand, not all such functions should necessarily be tagged. Semantic MediaWiki, for example, only marks a percentage of its database reads as expensive. This is due to the fact that on certain data-intensive pages, it could easily overflow the normal expensive parser function limits. In cases like this, the potential for noticeably slower performance that doesn't get flagged as expensive is a trade-off to having the functionality that SMW offers. </p><p>To mark your parser function as expensive, from within the body of the function's code, use <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><span class="nv">$result</span> <span class="o">=</span> <span class="nv">$parser</span><span class="o">-></span><span class="na">incrementExpensiveFunctionCount</span><span class="p">();</span></code>. The return value will be <code class="mw-highlight mw-highlight-lang-php mw-content-ltr" style="" dir="ltr"><span class="k">false</span></code> if the expensive function limit has been reached or exceeded. </p> <div class="mw-heading mw-heading2"><h2 id="Named_parameters">Named parameters</h2></div> <p>Parser functions do not support named parameters the way templates and tag extensions do, but it is occasionally useful to fake it. Users are often accustomed to using vertical bars ( <code>|</code> ) to separate arguments, so it's nice to be able to do that in the parser function context, too. Here's a simple example of how to accomplish this: </p> <div style="overflow:auto;" class="mw-highlight mw-highlight-lang-php mw-content-ltr" dir="ltr"><pre><span></span><span class="k">function</span> <span class="nf">ExampleExtensionRenderParserFunction</span><span class="p">(</span> <span class="o">&</span><span class="nv">$parser</span> <span class="p">)</span> <span class="p">{</span> <span class="c1">// Suppose the user invoked the parser function like so:</span> <span class="c1">// {{#myparserfunction: foo=bar | apple=orange | banana }}</span> <span class="nv">$options</span> <span class="o">=</span> <span class="nx">extractOptions</span><span class="p">(</span> <span class="nb">array_slice</span><span class="p">(</span> <span class="nb">func_get_args</span><span class="p">(),</span> <span class="mi">1</span> <span class="p">)</span> <span class="p">);</span> <span class="c1">// Now you've got an array that looks like this:</span> <span class="c1">// [foo] => 'bar'</span> <span class="c1">// [apple] => 'orange'</span> <span class="c1">// [banana] => true</span> <span class="c1">// Continue writing your code...</span> <span class="p">}</span> <span class="sd">/**</span> <span class="sd"> * Converts an array of values in form [0] => "name=value"</span> <span class="sd"> * into a real associative array in form [name] => value</span> <span class="sd"> * If no = is provided, true is assumed like this: [name] => true</span> <span class="sd"> *</span> <span class="sd"> * @param array string $options</span> <span class="sd"> * @return array $results</span> <span class="sd"> */</span> <span class="k">function</span> <span class="nf">extractOptions</span><span class="p">(</span> <span class="k">array</span> <span class="nv">$options</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$results</span> <span class="o">=</span> <span class="p">[];</span> <span class="k">foreach</span> <span class="p">(</span> <span class="nv">$options</span> <span class="k">as</span> <span class="nv">$option</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$pair</span> <span class="o">=</span> <span class="nb">array_map</span><span class="p">(</span> <span class="s1">'trim'</span><span class="p">,</span> <span class="nb">explode</span><span class="p">(</span> <span class="s1">'='</span><span class="p">,</span> <span class="nv">$option</span><span class="p">,</span> <span class="mi">2</span> <span class="p">)</span> <span class="p">);</span> <span class="k">if</span> <span class="p">(</span> <span class="nb">count</span><span class="p">(</span> <span class="nv">$pair</span> <span class="p">)</span> <span class="o">===</span> <span class="mi">2</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$results</span><span class="p">[</span> <span class="nv">$pair</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="p">]</span> <span class="o">=</span> <span class="nv">$pair</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span> <span class="p">}</span> <span class="k">if</span> <span class="p">(</span> <span class="nb">count</span><span class="p">(</span> <span class="nv">$pair</span> <span class="p">)</span> <span class="o">===</span> <span class="mi">1</span> <span class="p">)</span> <span class="p">{</span> <span class="nv">$results</span><span class="p">[</span> <span class="nv">$pair</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="p">]</span> <span class="o">=</span> <span class="k">true</span><span class="p">;</span> <span class="p">}</span> <span class="p">}</span> <span class="k">return</span> <span class="nv">$results</span><span class="p">;</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div> <p>General and related guides: </p> <ul><li><a href="/wiki/Special:MyLanguage/Manual:Developing_extensions" title="Special:MyLanguage/Manual:Developing extensions">Manual:Developing extensions</a><span style="display:none"><a href="/wiki/Manual:Developing_extensions" title="Manual:Developing extensions"> </a></span>, or for more general information about extensions, see <a href="/wiki/Special:MyLanguage/Manual:Extensions" title="Special:MyLanguage/Manual:Extensions">Manual:Extensions</a><span style="display:none"><a href="/wiki/Manual:Extensions" title="Manual:Extensions"> </a></span> and <a href="/wiki/Special:MyLanguage/Extensions_FAQ" title="Special:MyLanguage/Extensions FAQ">Extensions FAQ</a><span style="display:none"><a href="/wiki/Extensions_FAQ" title="Extensions FAQ"> </a></span>.</li> <li><a href="/wiki/Special:MyLanguage/Manual:Tag_extensions" title="Special:MyLanguage/Manual:Tag extensions">Manual:Tag extensions</a><span style="display:none"><a href="/wiki/Manual:Tag_extensions" title="Manual:Tag extensions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Magic_words" title="Special:MyLanguage/Manual:Magic words">Manual:Magic words</a><span style="display:none"><a href="/wiki/Manual:Magic_words" title="Manual:Magic words"> </a></span></li></ul> <p>Code: </p> <ul><li><a href="/wiki/Special:MyLanguage/Manual:Parser.php" title="Special:MyLanguage/Manual:Parser.php">Manual:Parser.php</a><span style="display:none"><a href="/wiki/Manual:Parser.php" title="Manual:Parser.php"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Manual:Hooks/ParserFirstCallInit" title="Special:MyLanguage/Manual:Hooks/ParserFirstCallInit">Manual:Hooks/ParserFirstCallInit</a><span style="display:none"><a href="/wiki/Manual:Hooks/ParserFirstCallInit" title="Manual:Hooks/ParserFirstCallInit"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Parser_function_hooks" title="Special:MyLanguage/Parser function hooks">Parser function hooks</a><span style="display:none"><a href="/wiki/Parser_function_hooks" title="Parser function hooks"> </a></span> - an (incomplete) list of parser functions provided by core and extensions</li> <li>The <a rel="nofollow" class="external text" href="https://github.com/JeroenDeDauw/ParserHooks#parserhooks">Parser Hooks</a> PHP library, which provides an object orientated interface for declarative parser hooks</li> <li><a href="/wiki/Special:MyLanguage/Manual:Extension_data" title="Special:MyLanguage/Manual:Extension data">Manual:Extension data</a><span style="display:none"><a href="/wiki/Manual:Extension_data" title="Manual:Extension data"> </a></span></li></ul> <p>Examples: </p> <ul><li>The <a href="/wiki/Special:MyLanguage/Extension:ParserFunctions" title="Special:MyLanguage/Extension:ParserFunctions">ParserFunctions extension</a> is a well-known collection of parser functions.</li> <li><a href="/wiki/Special:MyLanguage/Help:Extension:ParserFunctions" title="Special:MyLanguage/Help:Extension:ParserFunctions">Help:Extension:ParserFunctions</a><span style="display:none"><a href="/wiki/Help:Extension:ParserFunctions" title="Help:Extension:ParserFunctions"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/:Category:Parser_function_extensions" title="Special:MyLanguage/:Category:Parser function extensions">Category:Parser function extensions</a><span style="display:none">[[::Category:Parser function extensions| ]]</span></li></ul> <!-- NewPP limit report Parsed by mw‐web.eqiad.main‐565d46677b‐zj9p5 Cached time: 20241128121255 Cache expiry: 2592000 Reduced expiry: false Complications: [show‐toc] CPU time usage: 0.321 seconds Real time usage: 0.466 seconds Preprocessor visited node count: 3660/1000000 Post‐expand include size: 25344/2097152 bytes Template argument size: 14912/2097152 bytes Highest expansion depth: 18/100 Expensive parser function count: 67/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 36458/5000000 bytes Lua time usage: 0.037/10.000 seconds Lua memory usage: 1189100/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 236.607 1 -total 57.74% 136.606 29 Template:Ll 34.85% 82.465 1 Template:ExtensionTypes 33.31% 78.809 1 Template:Nmbox 22.50% 53.229 58 Template:Translatable 18.78% 44.424 30 Template:Pagelang 17.49% 41.373 1 Template:Flatlist 9.24% 21.867 11 Template:TNTN 9.09% 21.500 19 Template:Phpi 7.93% 18.754 19 Template:Inline-code --> <!-- Saved in parser cache with key mediawikiwiki:pcache:17997:|#|:idhash:canonical and timestamp 20241128121255 and revision id 6846788. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1&useformat=desktop" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://www.mediawiki.org/w/index.php?title=Manual:Parser_functions&oldid=6846788">https://www.mediawiki.org/w/index.php?title=Manual:Parser_functions&oldid=6846788</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Special:Categories" title="Special:Categories">Categories</a>: <ul><li><a href="/wiki/Category:MediaWiki_development" title="Category:MediaWiki development">MediaWiki development</a></li><li><a href="/wiki/Category:Parser_extensions" title="Category:Parser extensions">Parser extensions</a></li><li><a href="/wiki/Category:Wiki_markup" title="Category:Wiki markup">Wiki markup</a></li><li><a href="/wiki/Category:Customization_techniques" title="Category:Customization techniques">Customization techniques</a></li><li><a href="/wiki/Category:Sample_code" title="Category:Sample code">Sample code</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 9 November 2024, at 14:01.</li> <li id="footer-info-copyright">Text is available under the <a rel="nofollow" class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-ShareAlike License</a>; additional terms may apply. Text in <a class="external text" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents">the Help: namespace</a> is available under the <a rel="nofollow" class="external text" href="https://creativecommons.org/publicdomain/zero/1.0/">Creative Commons CC0 License</a>. By using this site, you agree to the <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use">Terms of Use</a> and <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy Policy</a>.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Project:About">About mediawiki.org</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Project:General_disclaimer">Disclaimers</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/www.mediawiki.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//m.mediawiki.org/w/index.php?title=Manual:Parser_functions&mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-5c59558b9d-7cbn4","wgBackendResponseTime":121,"wgPageParseReport":{"limitreport":{"cputime":"0.321","walltime":"0.466","ppvisitednodes":{"value":3660,"limit":1000000},"postexpandincludesize":{"value":25344,"limit":2097152},"templateargumentsize":{"value":14912,"limit":2097152},"expansiondepth":{"value":18,"limit":100},"expensivefunctioncount":{"value":67,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":36458,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 236.607 1 -total"," 57.74% 136.606 29 Template:Ll"," 34.85% 82.465 1 Template:ExtensionTypes"," 33.31% 78.809 1 Template:Nmbox"," 22.50% 53.229 58 Template:Translatable"," 18.78% 44.424 30 Template:Pagelang"," 17.49% 41.373 1 Template:Flatlist"," 9.24% 21.867 11 Template:TNTN"," 9.09% 21.500 19 Template:Phpi"," 7.93% 18.754 19 Template:Inline-code"]},"scribunto":{"limitreport-timeusage":{"value":"0.037","limit":"10.000"},"limitreport-memusage":{"value":1189100,"limit":52428800}},"cachereport":{"origin":"mw-web.eqiad.main-565d46677b-zj9p5","timestamp":"20241128121255","ttl":2592000,"transientcontent":false}}});});</script> </body> </html>