Template:Link-to-family-comma-seperated-list

From CPU Grave Yard

Description

If you have a string with commas and you want to link for each value separately with added family. Will work with single value or list. Will work with comma or comma-space separation.

If there is a link already in place, then it return the original text without linking or categorizing.

Usage

  • {{Link-to-family-comma-seperated-list|TEXT}}


Examples

  • {{Link-to-family-comma-seperated-list|alpha,beta,gamma}}
  • {{Link-to-family-comma-seperated-list|alpha, beta, gamma}}
  • {{Link-to-family-comma-seperated-list|alpha}}
  • {{Link-to-family-comma-seperated-list|alpha, [[beta]], gamma}}
    • Result: alpha, beta, gamma

Notes

Requirements

  • Extension:Loops
  • Extension:Variables
  • Extension:ParserFunctions
  • Extension:RegexFunction
  • Template:detect-link

Pseudo code

if link is already there
  return original text
else
  set first value
  while (if current value is not empty)
    print linked value
    if not last value
      print comma 
    set to next value and loop back
    done

See Also

</noinclude