Jump to content

Template talk:Lifespan

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Logic

[edit]

Version 1

[edit]

Revision

  1. Check brackets; if default (parentheses around full output) display opening bracket
  2. If the birth or death parameter is missing or empty, display error message, categorize the page, and proceed to closing bracket check
  3. Else (birth+death exist and not empty), if error checking (parameter err) is on, display any non-date parameter error messages and maintenance notices; continue
  4. Display optional content label ("lifespan: "). If parameter 'Prefix' exists suppress label; display error message if error-checking is on; continue
  5. Display optional birth prefix
  6. Display optional circa for birth (or for both birth & death)
  7. Display birth year or, if requirements/constraints are ignored display error message(s) and categorize the page; continue
  8. Display optional alternative birth year or, if requirements/constraints are ignored display error message(s) and categorize the page; continue
  9. Display optional 1st suffix to indicate era straddle (BC-AD or BCE-CE)
  10. Display date span separator per MOS:YEAR and MOS:YEARRANGE
  11. If prefixes are used, display the death prefix
  12. Display optional circa for death (or both birth & death)
  13. Display death year or, if requirements/constraints are ignored display error message(s) and categorize the page; continue
  14. Display optional alternative death year or, if requirements/constraints are ignored display error message(s) and categorize the page; continue
  15. Display optional date-span suffix (implied default is AD/CE, BC-AD and BCE-CE notations are functionally identical) or the 2nd suffix of era straddle
  16. Error-check date parameters relative to their suffix; display any error messages; continue
  17. If age range is processed:
    1. Check brackets: if around age only, disregard 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 only consider the suffix to calculate & display range, after checking whether birth and death occurred in the same year
    5. Add trailing static text "years"
  18. 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 death date), and the suffix
    5. Add trailing static text "years"
  19. End else (birth+death exist and not empty)
  20. If brackets are not removed, display closing bracket and exit, else exit

The category Category:Template Lifespan errors must be created before errors are trapped. It is commented out in code and fake-linked in the doc (and here). 172.254.202.90 (talk) 01:50, 20 December 2024 (UTC)[reply]

Edit revision to reflect current doc changes; no code edits.65.88.88.216 (talk) 20:22, 20 December 2024 (UTC)[reply]

Version 1.0.1

[edit]

Revision

Added prefix options to display abbreviations with or without tooltips; retained previous option for compatibility (undocumented).

65.88.88.216 (talk) 22:46, 21 December 2024 (UTC)[reply]

Version 1.0.1a

[edit]

Revision

Code: Added message for parameter ca error condition (uses temp param {{{YV}}}).
Doc: Added example re:above. 98.7.84.118 (talk) 14:47, 26 December 2024 (UTC)[reply]

Version 1.0.1b

[edit]

Revision

Code: Simplified error condition (removed temp param {{{YV}}}); added error messages to age component; trapped related expression errors with null message. 50.75.226.250 (talk) 22:47, 26 December 2024 (UTC)[reply]

Version 1.0.2

[edit]

Revision

Code: Trapped some errors re: era straddles. 68.174.124.254 (talk) 22:05, 31 December 2024 (UTC)[reply]

Version 1.0.3

[edit]

Revision

Code (not optimized special case): Year 0 (zero) handling as an optional error or maintenance condition.
Doc: Sync with code, updated with example, etc.

172.254.202.90 (talk) 15:43, 1 January 2025 (UTC)[reply]

Version 1.0.3a

[edit]

Revision

Code: minor copyedit, year 0 maintenance notice. 72.106.120.184 (talk) 18:50, 1 January 2025 (UTC)[reply]

Version 1.0.3b

[edit]

Revision

Code: rm superfluous error case (flagged elsewhere); etc. 98.7.84.118 (talk) 13:28, 2 January 2025 (UTC)[reply]

Version 1.0.3d

[edit]

Revision (partial revert to revision below)

Revision

Code: year 0 handling minor optimizations, rm superfluous case flagged elsewhere, add cases. 69.200.249.191 (talk) 17:02, 6 January 2025 (UTC)[reply]

had to roll back a section update as it omitted several cases. 65.88.88.70 (talk) 22:10, 6 January 2025 (UTC)[reply]

Version 1.0.3e

[edit]

Revision

Code: minor simplifications. 104.247.55.106 (talk) 02:01, 7 January 2025 (UTC)[reply]

updated revision to reflect comments. 98.7.84.118 (talk) 15:14, 7 January 2025 (UTC)[reply]