Select Page

Template talk:Lifespan

Logic

Note: The category Category:Template Lifespan errors must be created in order to document and track non-trivial template errors. It is presently commented out in code and fake-linked in the doc (and here).
The current logic workflow list is directly below. The revision link to the current code version is under § Current code version.

Current logic workflow

Applicable to V. 1.2.4 and later.

  1. If the birth or death parameter is missing or empty, display notification, categorize the page, and exit
  2. Else (birth+death exist and not empty), check birth and death input for validity and display any notifications; continue
  3. Check globally-applicable alternative year options and display any notifications; continue
  4. If suffix is used, check date parameters relative to the suffix and optional era straddle; display any notifications; continue
  5. Optionally check for unrecognized parameters and non-date-parameter issues, and display any notifications; continue
  6. Check brackets; if default (parentheses around full output) display opening bracket
  7. Display optional content label ("lifespan: ")
  8. Display optional birth prefix
  9. Display optional circa for birth (or for both birth & death)
  10. Display birth year
  11. Display optional alternative birth year
  12. Display optional 1st suffix (implied default is AD/CE, BC/AD and BCE/CE notations are functionally identical) for alternative-year spans, or to apply era straddle (BC–AD or BCE–CE)
  13. Display date span separator per MOS:YEAR and MOS:YEARRANGE
  14. If prefixes are used, display the death prefix
  15. Display optional circa for death (or both birth & death)
  16. Display death year
  17. Display optional alternative death year
  18. Display optional date-span suffix or the 2nd suffix for alternative-year spans and era straddles
  19. If age range is processed:
    1. Check brackets; if around age only, suppress full-output bracket, add space and open age bracket; else add comma & space
    2. Check age label (default is "aged ")
    3. If it exists, pass circa to the age range
    4. If there are alternative years, calculate & display age range(s) relative to birth/death configuration and the suffix; else (no alternative years) only use the suffix to calculate & display range, after checking whether birth and death occurred in the same year
    5. Add trailing static text " years"
  20. If age in years is processed instead:
    1. Check brackets as in age range above
    2. Check age label
    3. If it exists, pass circa to the age
    4. Check whether birth and death occurred in the same year and display static text if so; else calculate & display the age considering the birthday (relative to the death date) and the suffix
    5. Add trailing static text " years"
  21. If brackets are not removed, display closing bracket
  22. End else (birth+death exist and not empty); exit

Current code version

Older code versions

Version 1.0.0

172.254.202.90 (talk) 01:50, 20 December 2024 (UTC)[reply]
-edit revision-id to reflect current doc changes; no code edits.65.88.88.216 (talk) 20:22, 20 December 2024 (UTC)[reply]

Version 1.0.1 to 1.2.4a

–updated revision-id to reflect comments. 98.7.84.118 (talk) 15:14, 7 January 2025 (UTC)[reply]
–updated revision-id to reflect minor hidden comment addition. 4.2.111.162 (talk) 21:01, 28 January 2025 (UTC)[reply]
–updated revision-id to reflect minor hidden comment addition. 204.19.162.3 (talk) 23:56, 23 February 2025 (UTC)[reply]
  • V. 1.0.11: Error messaging simplify & streamline; rm deprecated param option; additional hidden comments.
–documentation: section rewrites.
65.88.88.70 (talk) 19:36, 9 March 2025 (UTC)[reply]
–documentation update & sync. 65.88.88.75 (talk) 20:24, 17 March 2025 (UTC)[reply]
–documentation edits, update & sync. 98.7.84.118 (talk) 15:00, 24 March 2025 (UTC)[reply]

Incredibly complex template with limited usage...

Translcuded on only 13 pages. I don't really see the point. What's the rationale for creation? wbm1058 (talk) 03:15, 17 February 2025 (UTC)[reply]

The rationale is the same as with any other template. Do you know of any template that didn't start with 0 transclusions? The difference is that this template is coded by a professional, is thoroughly tested, it covers many use-cases, and has extensive error feedback. 50.74.109.2 (talk) 13:46, 19 February 2025 (UTC)[reply]
wbm1058, I agree, and this adds needless complexity to pages. Drmies (talk) 13:13, 3 April 2025 (UTC)[reply]
Please explain where the complexity is added, relative to any other template or module used on any page. All markup has overhead. 184.75.91.2 (talk) 12:30, 8 April 2025 (UTC)[reply]