Help:IfEq parser

From Ballotpedia
Jump to: navigation, search

If-equal parsers are used to create commands that will post certain information on a wiki page if and only if parameters are specifically filled out.

If-equal Parser basics

  • Establish what happens if a certain parameter is defined as a specific word or text line.
  • Useful for choosing to include or not include lines on a table, for changing colors of tables based on party etc.
  • Unlike If parser, requires a specific input to operate properly.
  • Example: Note the infoboxes for the Eleventh Circuit and the Third Circuit and the Vacancy Warning Page. The Color changes are based on a given range of numbers. (Actually an #ifexpr but the same idea)

IfEq parser code

The code on the template page reads:
{{#ifeq: {{{Parameter|}}} | REQUIRED PARAMETER DEFINITION| WHAT WILL RENDER IF DEFINED | WHAT WILL RENDER IF UNDEFINED }}
[1]



The template code example is:
{{#ifeq: {{{Parameter}}} | Say Hi | Hello World | Good bye world }}



The Template call:
{{Template name|Parameter = Say Hi}} versus {{Template name}} or {{Template name|Parameter = No/Yes/Hello }}



The result:
Hello World versus Good bye world

Advanced IfEq-parser notes

  • Ifeq parsers are most useful to limiting information on templates to only information that has a specific response. This can provide a convenient check for entering information properly.
  • Ifeq parsers can be used to alter information if it is entered with a specific formatting.
  • Ifeq parsers are case sensitive so please be aware that this can cause an error.

References