Doctor Who Cuttings Archive

Difference between revisions of "Template:InvertName"

From The Doctor Who Cuttings Archive
Jump to navigationJump to search
Line 1: Line 1:
{{#arraydefine:n|{{{author}}}|   | }}
+
{{#vardefine:temp | {{{author}}} }}
{{#arrayindex:n|-1|{{{author}}} }},
+
{{#vardefine:pos | {{#rpos:temp| }}
{{
+
{{#if:
  #loop: x
+
  {{#expr: pos > 0
  | 1
+
    | {{#vardefine:lastName  | {{#sub: temp | {{#expr: pos + 1 }} }} }}
  | {{#expr: {{#arraysize:n}} - 1 }}  
+
      {{#vardefine:firstName | {{#sub: temp | 0 | {{#expr: pos - 1 }} }} }}
  | {{#arrayindex:n|{{#var:x}}|}}
+
      lastName, firstName
 +
    | {{{author}}}
 +
  }}
 
}}
 
}}

Revision as of 12:39, 20 October 2013

{{#vardefine:pos | -1