User:YBG/Living officeholders/doc

Note This describes a userspace draft intended to be implemented as and subtemplates. For an alternative implementation (no longer under active development), see, intended to be implemented as

Usage
where «office» is one of:
 * us-p for this table to be transcluded on Living presidents of the United States
 * usvp for this table to be transcluded on Living vice presidents of the United States
 * aupm for this table to be transcluded on Living prime ministers of Australia
 * nzpm for this table to be transcluded on Living prime ministers of New Zealand
 * ukpm for this table to be transcluded on Living prime ministers of the United Kingdom (not yet implemented)

Overview of pages
There are three types of templates involved in this system
 * 1) The main template (should not need any updating)
 * 2) Office-specific subtemplates (update when officeholder data changes)
 * Maintenance necessary when a living office holder dies
 * Modify by adding the death date and description
 * Modify by adding -N to the last row and then appending a new row with -N
 * Maintenance necessary when a new officeholder assumes office
 * Modify by adding a new block for the new officeholder
 * 1) ;* Modify by adding +N to the last row and then appending a new row with +N
 * Maintenance necessary to expand the system for a new type of officeholder:
 * Create for the new office with name and event information for all officeholders
 * Modify by adding a new section to display all of the data for the new office type.
 * Create for the new office with the header, footer and one call to  for each chronological period
 * Create or modify the page in article space, transcluding the main template
 * 1) Generic subtemplates (update when changing format)
 * Maintenance required to modify the format of all templates
 * Modify, and test it by previewing
 * Modify headers and footers if necessary
 * Maintenance required to modify the colors or style of the officeholder boxes
 * Modify and test it by previewing
 * Maintenance required to implement an idiosyncratic format for some but not all offices
 * Create a new that generates the desired format
 * Add test case(s) to and modify  until it works OK
 * Modify by (a) adjusting the headers and footers and (b) calling the new
 * Maintenance required to modify the format of all templates
 * Modify, and test it by previewing
 * Modify headers and footers if necessary
 * Maintenance required to modify the colors or style of the officeholder boxes
 * Modify and test it by previewing
 * Maintenance required to implement an idiosyncratic format for some but not all offices
 * Create a new that generates the desired format
 * Add test case(s) to and modify  until it works OK
 * Modify by (a) adjusting the headers and footers and (b) calling the new
 * Add test case(s) to and modify  until it works OK
 * Modify by (a) adjusting the headers and footers and (b) calling the new

Structure
This system of subtemplates includes:
 * - the main template
 * Called from article space with a single unnamed parameter to specify the type of officeholder.
 * Calls
 * - Header, footer, and row-by-row date for each office (us-p,usvp,aupm,nzpm,ukpm)
 * Called by the main template with no parameters
 * Calls once for each row of the table.  Header and footer may call  and
 * - formats a single row in the table. Alternate versions are available for «N» = 1 to 5.
 * Called by with multiple parameters:
 * fmt specifies the date format
 * job specifies the office so that the generic subtemplate knows which data to use
 * = us-p, usvp for rows in tables in the articles about the Living presidents and vice presidents of the United States.
 * = aupm, nzpm, ukpm for rows in the tables in the articles about the Living prime ministers of Australia, New Zealand, and the UK.
 * evt1: positive (negative) number for an accession (death) at the start of the period. +1 triggers column headers before row.
 * evt2: positive (negative) number for an accession (death) at the end of the period. Undefined defaults to (Present), triggers footers after row.
 * ev1a, ev2a: (optional) positive number for the mid-term accession following death of an officeholder
 * hours: (optional) number of hours in period. Overrides calculated time span. Used for the first of the two July 4, 1826 deaths
 * 1, 2, ... 10: numbers representing officeholders alive during the period (optional sign ignored)
 * Calls, ,
 * - displays a colored box that links to article for an officeholder
 * Called by and (for headers and footers) by
 * 1 the ordinal number of the officeholder (optionally signed)
 * 2 the code that specifies the office
 * Calls
 * - Provides office-specific data for other templates (us-p,usvp,aupm,nzpm,ukpm)
 * Called by and  to retrieve office-specific data.
 * 1 positive (negative) officeholder number for accession (death) info; either is OK for name
 * 2 date/descr date/description of the event, name (default) for the officeholder's name (i.e., WP article title)
 * Calls no other templates in this system
 * - provides +/&minus; signs consistently formatted based on the sign of the parameter
 * Called by and (for headers and footers) by
 * 1 optionally signed ordinal number of the officeholder
 * Calls no other templates in this system
 * - tests all living officeholder subtenplates
 * Called by no other templates
 * Calls every living officeholder subtemplate
 * - designed to test
 * Called by
 * row: row1, row2, etc. - the row variety to be tested.
 * Calls
 * - designed to test
 * Called by
 * row: row1, row2, etc. - the row variety to be tested.
 * Calls
 * Calls