Difference between revisions of "Template:Has person"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | {{#ifeq:{{{link|}}}|none|{{#if:{{{surname|}}}|<!--has surname--> | + | {{#ifeq:{{{link|}}}|none|{{#if:{{{surname|}}}|<!--has surname-->[[:Category:{{{surname|}}}]]|<!--doesn't have surname-->{{#if:{{{alt|}}}|<!--no surname and alt exists-->{{#if:{{{first name|}}}|<!--no surname and alt exists with first name-->[[Category:{{{|last name|}}}]]|{{#if:{{#explode:{{{name}}}| |2}}|<!--show third word-->[[Category:{{#explode:{{{name}}}| |2}}]]|<!--has less than three words show the second word-->[[Category:{{#explode:{{{name|}}}| |1}}]] }}}}|<!--no surname and no alt-->{{#if:{{{first name|}}}|<!--no surname and alt exists with first name-->[[Category:{{{|last name|}}}]]|{{#if:{{#explode:{{{name}}}| |2}}|<!--show third word-->[[Category:{{#explode:{{{name}}}| |2}}]]|<!--has less than three words show the second word-->[[Category:{{#explode:{{{name|}}}| |1}}]] }} }} }} }}<!--set has person stuff-->{{#if:{{{name|}}}|{{#set:has person={{{name|}}} }}|{{#set:has person={{#if:{{{first name|}}}|{{{first name|}}}|<!--show nothing-->}}{{#if:{{{middle name|}}}| {{{middle name|}}}|<!--show nothing-->}}{{#if:{{{last name|}}}| {{{last name|}}}|<!--show nothing-->}}{{#if:{{{suffix|}}}| {{{suffix|}}}|<!--show nothing-->}}{{#if: {{{id|}}}| ({{{id|}}})|<!--show nothing-->}} }} }}|{{#if:{{{name|}}}|<!--name given-->{{#if:{{{alt|}}}|<!--name and alt given-->[[{{{name|}}}{{#!:|}}{{{alt|}}}]]|<!--name but no alt-->[[{{{name|}}}]]}}|<!--no name given-->{{#if:{{{alt|}}}|<!--no name. with alt given-->[[{{#if:{{{first name|}}}|{{{first name|}}}|<!--show nothing-->}}{{#if:{{{middle name|}}}| {{{middle name|}}}|<!--show nothing-->}}{{#if:{{{last name|}}}| {{{last name|}}}|<!--show nothing-->}}{{#if:{{{suffix|}}}| {{{suffix|}}}|<!--show nothing-->}}{{#if: {{{id|}}}| ({{{id|}}})|<!--show nothing-->}}{{#!:|}}{{{alt|}}}]]|<!--no name no alt-->[[{{#if:{{{first name|}}}|{{{first name|}}}|<!--show nothing-->}}{{#if:{{{middle name|}}}| {{{middle name|}}}|<!--show nothing-->}}{{#if:{{{last name|}}}| {{{last name|}}}|<!--show nothing-->}}{{#if:{{{suffix|}}}| {{{suffix|}}}|<!--show nothing-->}}{{#if: {{{id|}}}| ({{{id|}}})|<!--show nothing-->}}]]}}}}{{#if:{{{surname|}}}|<!--has surname-->[[Category:{{{surname|}}}]]|<!--doesn't have surname-->{{#if:{{{alt|}}}|<!--no surname and alt exists-->{{#if:{{{first name|}}}|<!--no surname and alt exists with first name-->[[Category:{{{|last name|}}}]]|{{#if:{{#explode:{{{name}}}| |2}}|<!--show third word-->[[Category:{{#explode:{{{name}}}| |2}}]]|<!--has less than three words show the second word-->[[Category:{{#explode:{{{name|}}}| |1}}]] }} }}|<!--no surname and no alt-->{{#if:{{{first name|}}}|<!--no surname and alt exists with first name-->[[Category:{{{last name|}}}]]|{{#if:{{#explode:{{{name}}}| |2}}|<!--show third word-->[[Category:{{#explode:{{{name}}}| |2}}]]|<!--has less than three words show the second word-->[[Category:{{#explode:{{{name|}}}| |1}}]] }} }} }} }}{{#if:{{{name|}}}|{{#set:has person={{{name|}}} }}|{{#set:has person={{#if:{{{first name|}}}|{{{first name|}}}|<!--show nothing-->}}{{#if:{{{middle name|}}}| {{{middle name|}}}|<!--show nothing-->}}{{#if:{{{last name|}}}| {{{last name|}}}|<!--show nothing-->}}{{#if:{{{suffix|}}}| {{{suffix|}}}|<!--show nothing-->}}{{#if: {{{id|}}}| ({{{id|}}})|<!--show nothing-->}} }} }} }}<noinclude>{{documentation}}</noinclude> |
+ | <!--define the name--> | ||
+ | {{#vardefine:full name|{{#if:{{{first name|}}}{{{middle name|}}}{{{last name}}}{{{id|}}}|{{{first name|}}} {{{middle name|}}} {{{last name}}} {{{id|}}} | {{{name|}}} }} '''testing the variable {{#var:full name}}''' | ||
+ | |||
+ | <!--outline --> | ||
{{#switch: {{{link|}}} | {{#switch: {{{link|}}} | ||
− | |none = {{# | + | |<!--link = none-->none = {{#if {{{alt|}}} |
− | + | |alt exists | |
− | |#default = | + | |alt doesn't exist }} |
+ | |<!--link != none -->#default = {{#if {{{alt|}}} | ||
+ | |alt exists | ||
+ | |alt doesn't exist }} | ||
}} | }} |
Revision as of 09:10, 17 February 2019
[[]][[Category:]]
The purpose of this template is to add a has person::name semantic property. It will split first and last names, and add a
has surnamesemantic property.
Usage
{{has person |name={{{name}}} |alt={{{alt}}} }}
- name = the full name of the individual i.e. john smith.
- alt = alternate text to be displayed. i.e. john rather than john smith. (good for transcriptions)
- first
- middle
- last
- id
- link
- surname
- gen
Templates Used
{{#vardefine:full name|{{{last name}}} testing the variable
{{#if
|alt exists |alt doesn't exist }}