Help:Extension:ParserFunctions/mr

The विस्तार(एक्सटेंशन) provides ten additional parser functions to supplement the "जादुई शब्द", which are already present in मिडियाविकि. All the पृथकक उपयोगिता provided by this विस्तार take the form:
 *  

#expr: #करण:
This function evaluates a mathematical expression आणि returns the calculated value.


 *  

The available operators are listed to the right, in order of precedence. पहा for more details of the function of each operator. The accuracy आणि format of the result returned will vary depending on the operating system of the server running the wiki, आणि the number format of the site language.

When evaluating using boolean algebra, zero evaluates to false आणि any nonzero value, positive or negative, evaluates to true:


 *   &rarr; 
 *   &rarr; 

An empty input expression returns an empty string. Invalid expressions return one of several error messages, which can be caught using the #iferror: function:


 *   &rarr;  
 *  </tt> &rarr; 
 *  </tt> &rarr; 

#if: #जर:

 *  </tt>

This function tests whether the first parameter is 'non-empty'. It evaluates to false if the test string is empty or contains only whitespace characters (space, newline, etc).


 *  </tt> &rarr; 
 *  </tt> &rarr; 
 *  </tt> &rarr; 
 *  </tt> &rarr; 

The test string is always interpreted as pure text, so mathematical expressions are not evaluated:


 *  </tt> &rarr; 

Either or both the return values may be omitted:


 *  </tt> &rarr;  
 *  </tt> &rarr;  
 *  </tt> &rarr;  

पहा Help:Parser functions in templates for more examples of this parser function.

#ifeq: #जरसम:
This parser function compares two strings आणि determines whether they are identical.


 *  </tt>

If both strings are valid numerical values, the strings are compared numerically:


 *  </tt> &rarr; 
 *  </tt> &rarr; 

Otherwise the comparison is made as text; this comparison is case sensitive:


 *  </tt> &rarr; 
 *  </tt> &rarr; 
 * <tt> </tt> &rarr; 

#iferror: #जरत्रुटी:
This function takes an input string आणि returns one of two results; the function evaluates to <tt>true</tt> if the input string contains an HTML object with <tt>class="error"</tt>, as generated by other पृथकक उपयोगिता such as <tt>#expr:</tt>, <tt>#time:</tt> आणि <tt>#rel2abs:</tt>, template errors such as loops आणि recursions, आणि other 'failsoft' parser errors.


 * <tt> </tt>

One or both of the return strings can be omitted. If the <tt>correct</tt> string is omitted, the <tt>test string</tt> is returned if it is not erroneous. If the <tt>error</tt> string is also omitted, an empty string is returned on an error:


 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr;  
 * <tt> </tt> &rarr;  

#ifexpr: #जरकरण:
This function evaluates a mathematical expression आणि returns one of two strings depending on the boolean value of the result:


 * <tt> </tt>

The <tt>expression</tt> input is evaluated exactly as for <tt>#expr:</tt> above, with the same operators being available. The output is then evaluated as a boolean expression. This function is equivalent to one using <tt>#ifeq:</tt> आणि <tt>#expr:</tt> only:


 * <tt> </tt>

An empty input expression evaluates to false:


 * <tt> </tt> &rarr; 

Either or both the return values may be omitted; no output is given when the appropriate branch is left empty:


 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr;  
 * <tt> </tt> &rarr;  
 * <tt> </tt> &rarr;  

#ifexist: #जरअसेल: #जरआहे:
This function takes an input string, interprets it as a page title, आणि returns one of two values depending on whether or not the page exists on the local wiki.


 * <tt> </tt>

The function evaluates to <tt>true</tt> if the page exists, whether it contains content, is visibly blank (contains meta-data such as category links or जादुई शब्द, but no visible content), is blank, or is a redirect. Only pages that are redlinked evaluate to false, including if the page used to exist but has been deleted.


 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 

The function evaluates to true for system messages that have been customised, आणि for special pages that are defined by the software.


 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr;
 * <tt> </tt> &rarr;

<tt>#ifexist:</tt> is considered an "expensive parser function", only a limited number of which can be included on any one page (including functions inside transcluded templates). When this limit is exceeded, the page is categorised into Category:, आणि any further <tt>#ifexist:</tt> functions automatically return false, whether the target page exists or not.

If a page checks a target using <tt>#ifexist:</tt>, then that page will appear in the list for the target page. So if the code <tt> </tt> were included live on this page, /Foo will list.

On wikis using a shared media repository, <tt>#ifexist:</tt> can be used to check if a file has been uploaded to the repository, but not to the wiki itself:
 * <tt> </tt>  &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 

If a local description page has been created for the file, the result is exists for all of the above.

#rel2abs:
This function converts a relative file path into an absolute filepath.


 * <tt> </tt>
 * <tt> </tt>

Within the <tt>path</tt> input, the following syntax is valid:
 * &rarr; the current level
 * &rarr; "go up one level"
 * &rarr; "go down one level into the subdirectory /foo"

If the <tt>base path</tt> is not specified, the full page name of the page will be used instead:


 * <tt> </tt> &rarr; '''
 * <tt> </tt> &rarr; '''
 * <tt> </tt> &rarr; '''
 * <tt> </tt> &rarr; '''

Invalid syntax, such as <tt>/.</tt> or <tt>/./</tt>, is ignored. Since no more than two consecutive full stops are permitted, sequences such as these can be used to separate successive statements:


 * <tt> </tt> &rarr; '''
 * <tt> </tt> &rarr; '''
 * <tt> </tt> &rarr; '''
 * <tt> </tt> &rarr; '''

#switch: #कळ:, #सांगकळ:, #असेलतरसांग:, #असलेतरसांग:, #स्वीच:,
This function compares one input value against several test cases, returning an associated string if a match is found.

The <tt>default result</tt> is returned if no <tt>case</tt> string matches the <tt>comparison string</tt>. In this syntax, the default result must be the last parameter आणि must not contain a raw equals sign. Alternatively, the default result may be explicitly declared with a case string of "<tt>#default</tt>"; default results declared in this way may be placed anywhere within the function:


 * <tt> </tt> &rarr; 

If no match is made, no content is added. It is possible to have 'fall through' values, where several <tt>case</tt> strings return the same <tt>result</tt> string. This minimises duplication.

Here cases 2, 3 आणि 4 all return <tt>result2</tt>; cases 6 आणि 7 both return <tt>result4</tt>

As with <tt>#ifeq:</tt>, the comparison is made numerically if both the comparison string आणि the case string being tested are numeric; or as case-sensitive string otherwise. A <tt>case</tt> string may be empty:
 * <tt> </tt> &rarr; 

Once a match is found, subsequent <tt>cases</tt> are ignored:
 * <tt> </tt> &rarr; 

#time: वेळ
This parser function takes a date आणि/or time construct आणि formats it according to the syntax given. A date/time object can be specified; the default is the value of the जादुई शब्द <tt> </tt> – that is, the time the page was last rendered into HTML.


 * <tt> </tt>
 * <tt> </tt>

The list of accepted formatting codes is given in the table to the right. Any character in the formatting string that is not recognised is passed through unaltered. There are also two ways to escape characters within the formatting string: In addition, the digraph <tt>xx</tt> is interpreted as a single literal "x".
 * 1) A backslash followed by a formatting character is interpreted as a single literal character
 * 2) characters enclosed in double quotes are considered literal characters, आणि the quotes are removed


 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 

The <tt>date/time object</tt> can be in any format accepted by PHP's strtotime function. Both absolute (eg <tt>20 December 2000</tt>) आणि relative (eg <tt>+20 hours</tt>) times are accepted.

Full or partial absolute dates can be specified; the function will 'fill in' parts of the date that are not specified using the current values:


 * <tt> </tt> &rarr; '''

A four-digit number is interpreted as hours आणि minutes if possible, आणि otherwise as year: <tt> </tt> &rarr; ''' Input is treated as a time rather than a year. <tt> </tt> &rarr; ''' Since 19:60 is no valid time, 1960 is treated as a year.

A six-digit number is interpreted as hours, minutes आणि seconds if possible, but otherwise as an error (not, for instance, a year आणि month): <tt> </tt> &rarr; ''' Input is treated as a time rather than a year+month code. <tt> </tt> &rarr; ''' Although 19:60:09 is no valid time, 196009 is not interpreted as September 1960.

The function performs a certain amount of date mathematics:


 * <tt> </tt> &rarr; '''
 * <tt> </tt> &rarr; '''
 * <tt> </tt> &rarr; '''
 * <tt> </tt> &rarr; '''

#timel: वेळस्था
This function is identical to <tt> </tt>, except that it uses the local time of the wiki (as set in ) when no date is given.


 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 

#titleparts: शीर्षकखंड, टाइटलपार्ट्स
This function separates a pagetitle into segments based on slashes, then returns some of those segments as output.


 * <tt> </tt>

If the <tt>number of segments</tt> parameter is not specified, it defaults to "0", which returns all the segments. If the <tt>first segment</tt> parameter is not specified or is "0", it defaults to "1":


 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr; 

Negative values are accepted for both values. Negative values for <tt>number of segments</tt> effectively 'strips' segments from the end of the string. Negative values for <tt>first segment</tt> translates to "add this value to the total number of segments", loosely equivalent to "count from the right":


 * <tt> </tt> &rarr; 
 * <tt> </tt> &rarr;  
 * <tt> </tt> &rarr;   Strips one segment from the end of the string, then returns the second segment आणि beyond

The string is split a maximum of 25 times; further slashes are ignored. The string is also limited to 255 characters, as it is treated as a page title:


 * <tt> </tt> &rarr; 

Substitution पर्यायिता
पृथकक उपयोगिता can be substituted by prefixing the hash character with <tt>subst:</tt>:


 * <tt> </tt> &rarr; the code <tt>    </tt> will be inserted in the wikitext since the page  exists.

Tables सारण्या
पृथकक उपयोगिता will mangle wikitable syntax, treating all the raw pipe characters as parameter divisors. To avoid this, most wikis create the template    :! with its contents only a raw pipe character. This 'hides' the pipe from the मिडियाविकि parser, ensuring that it is not considered until after all the templates आणि variables on a page have been expanded. Alternatively, raw HTML table syntax can be used, although this is less intuitive आणि more error-prone.

Stripping whitespace व्हाईटस्पेस स्ट्रिपींग
Whitespace, including newlines, tabs, आणि spaces, is stripped from the beginning आणि end of all the parameters of these पृथकक उपयोगिता. If this is not desirable, adding any non-whitespace characters (including the HTML encoding for a whitespace character, invisible Unicode characters such as the zero-width space or direction marks, or sequences recognised आणि stripped by the मिडियाविकि parser such as <tt>  </tt>) will prevent further stripping:


 * &rarr; 


 * &rarr; 


 * &rarr; 

हे सुद्धा पहा

 * Help:Parser functions in templates