parameters: (self, parameters)
return_statement: return templateParams
docstring: Build a dictionary with positional or name key to expanded parameters.
          :param parameters: the parts[1:] of a template, i.e. all except the title.
          :param depth: recusion depth.
docstring_summary: Build a dictionary with positional or name key to expanded parameters.
          :param parameters: the parts[1:] of a template, i.e. all except the title.
          :param depth: recusion depth.
docstring_tokens: Build a dictionary with positional or name key to expanded parameters . : param parameters : the parts [ 1 : ] of a template i . e . all except the title . : param depth : recusion depth .
function: def templateParams(self, parameters):
          """
          Build a dictionary with positional or name key to expanded parameters.
          :param parameters: the parts[1:] of a template, i.e. all except the title.
          :param depth: recusion depth.
          """
          templateParams = {}
  
          if not parameters:
              return templateParams
          logging.debug("<templateParams: %s", "|".join(parameters))
  
          # Parameters can be either named or unnamed. In the latter case, their
          # name is defined by their ordinal position (1, 2, 3, ...).
  
          unnamedParameterCounter = 0
  
          # It's legal for unnamed parameters to be skipped, in which case they
          # will get default values (if available) during actual instantiation.
          # That is {{template_name|a||c}} means parameter 1 gets
          # the value 'a', parameter 2 value is not defined, and parameter 3 gets
          # the value 'c'.  This case is correctly handled by function 'split',
          # and does not require any special handling.
          for param in parameters:
              # Spaces before or after a parameter value are normally ignored,
              # UNLESS the parameter contains a link (to prevent possible gluing
              # the link to the following text after template substitution)
  
              # Parameter values may contain "=" symbols, hence the parameter
              # name extends up to the first such symbol.
  
              # It is legal for a parameter to be specified several times, in
              # which case the last assignment takes precedence. Example:
              # "{{t|a|b|c|2=B}}" is equivalent to "{{t|a|B|c}}".
              # Therefore, we don't check if the parameter has been assigned a
              # value before, because anyway the last assignment should override
              # any previous ones.
              # FIXME: Don't use DOTALL here since parameters may be tags with
              # attributes, e.g. <div class="templatequotecite">
              # Parameters may span several lines, like:
              # {{Reflist|colwidth=30em|refs=
              # &lt;ref name=&quot;Goode&quot;&gt;Title&lt;/ref&gt;
  
              # The '=' might occurr within an HTML attribute:
              #   "&lt;ref name=value"
              # but we stop at first.
              m = re.match(" *([^=]*?) *=(.*)", param, re.DOTALL)
              if m:
                  # This is a named parameter.  This case also handles parameter
                  # assignments like "2=xxx", where the number of an unnamed
                  # parameter ("2") is specified explicitly - this is handled
                  # transparently.
  
                  parameterName = m.group(1).strip()
                  parameterValue = m.group(2)
  
                  if (
                      "]]" not in parameterValue
                  ):  # if the value does not contain a link, trim whitespace
                      parameterValue = parameterValue.strip()
                  templateParams[parameterName] = parameterValue
              else:
                  # this is an unnamed parameter
                  unnamedParameterCounter += 1
  
                  if (
                      "]]" not in param
                  ):  # if the value does not contain a link, trim whitespace
                      param = param.strip()
                  templateParams[str(unnamedParameterCounter)] = param
          logging.debug("   templateParams> %s", "|".join(templateParams.values()))
          return templateParams
function_tokens: def templateParams ( self , parameters ) : templateParams = { } if not parameters : return templateParams logging . debug ( "<templateParams: %s" , "|" . join ( parameters ) ) # Parameters can be either named or unnamed. In the latter case, their # name is defined by their ordinal position (1, 2, 3, ...). unnamedParameterCounter = 0 # It's legal for unnamed parameters to be skipped, in which case they # will get default values (if available) during actual instantiation. # That is {{template_name|a||c}} means parameter 1 gets # the value 'a', parameter 2 value is not defined, and parameter 3 gets # the value 'c'.  This case is correctly handled by function 'split', # and does not require any special handling. for param in parameters : # Spaces before or after a parameter value are normally ignored, # UNLESS the parameter contains a link (to prevent possible gluing # the link to the following text after template substitution) # Parameter values may contain "=" symbols, hence the parameter # name extends up to the first such symbol. # It is legal for a parameter to be specified several times, in # which case the last assignment takes precedence. Example: # "{{t|a|b|c|2=B}}" is equivalent to "{{t|a|B|c}}". # Therefore, we don't check if the parameter has been assigned a # value before, because anyway the last assignment should override # any previous ones. # FIXME: Don't use DOTALL here since parameters may be tags with # attributes, e.g. <div class="templatequotecite"> # Parameters may span several lines, like: # {{Reflist|colwidth=30em|refs= # &lt;ref name=&quot;Goode&quot;&gt;Title&lt;/ref&gt; # The '=' might occurr within an HTML attribute: #   "&lt;ref name=value" # but we stop at first. m = re . match ( " *([^=]*?) *=(.*)" , param , re . DOTALL ) if m : # This is a named parameter.  This case also handles parameter # assignments like "2=xxx", where the number of an unnamed # parameter ("2") is specified explicitly - this is handled # transparently. parameterName = m . group ( 1 ) . strip ( ) parameterValue = m . group ( 2 ) if ( "]]" not in parameterValue ) : # if the value does not contain a link, trim whitespace parameterValue = parameterValue . strip ( ) templateParams [ parameterName ] = parameterValue else : # this is an unnamed parameter unnamedParameterCounter += 1 if ( "]]" not in param ) : # if the value does not contain a link, trim whitespace param = param . strip ( ) templateParams [ str ( unnamedParameterCounter ) ] = param logging . debug ( "   templateParams> %s" , "|" . join ( templateParams . values ( ) ) ) return templateParams