Jump to content

User:YBG/Living officeholders/doc

From Wikipedia, the free encyclopedia

Note This describes a userspace draft intended to be implemented as {{Living officeholders}} and subtemplates. For an alternative implementation (no longer under active development), see {{User:YBG/Living officeholders row}}, intended to be implemented as {{Living officeholders row}}

Usage[edit]

{{User:YBG/Living officeholders|«office»}}

where «office» is one of:

Overview of pages[edit]

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 {{.../«office»}} by adding the death date and description
    • Modify {{.../«office»-table}} by adding |evt2=-N to the last row and then appending a new row with |evt1=-N
    Maintenance necessary when a new officeholder assumes office
    • Modify {{.../«office»}} by adding a new block for the new officeholder
    • Modify {{.../«office»-table}} by adding |evt2=+N to the last row and then appending a new row with |evt1=+N
    Maintenance necessary to expand the system for a new type of officeholder:
    • Create {{.../«office»}} for the new office with name and event information for all officeholders
    • Modify {{.../testcases}} by adding a new section to display all of the data for the new office type.
    • Create {{.../«office»-table}} for the new office with the header, footer and one call to {{.../row}} for each chronological period
    • Create or modify the page in article space, transcluding the main template
  3. Generic subtemplates (update when changing format)
    Maintenance required to modify the format of all templates
    • Modify {{.../row}}, and test it by previewing {{.../testcases}}
    • Modify {{.../«office»-table}} headers and footers if necessary
    Maintenance required to modify the colors or style of the officeholder boxes
    Maintenance required to implement an idiosyncratic format for some but not all offices
    • Create a new {{.../rowN}} that generates the desired format
    • Add test case(s) to {{.../testcases#Row}} and modify {{.../rowN}} until it works OK
    • Modify {{.../«office»-table}} by (a) adjusting the headers and footers and (b) calling the new {{.../rowN}}

Structure[edit]

This system of subtemplates includes:

  • {{User:YBG/Living officeholders}} - the main template
    Called from article space with a single unnamed parameter to specify the type of officeholder.
    Calls {{.../«office»-table}}
  • {{User:YBG/Living officeholders/«office»-table}} - 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 {{.../row}} once for each row of the table. Header and footer may call {{.../plusminus}} and {{.../box}}
  • {{User:YBG/Living officeholders/row}} - formats a single row in the table. Alternate versions {{.../row«N»}} are available for «N» = 1 to 5.
    Called by {{.../«office»-table}} with multiple parameters:
    • |fmt= specifies the date format
    • |job= specifies the office so that the generic {{.../row}} 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. |evt1=+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 {{.../«office»}}, {{.../box}}, {{.../plusminus}}
  • {{User:YBG/Living officeholders/box}} - displays a colored box that links to article for an officeholder
    Called by {{.../row}} and (for headers and footers) by {{.../«office»-table}}
    • |1= the ordinal number of the officeholder (optionally signed)
    • |2= the code that specifies the office
    Calls {{.../«office»}}
  • {{User:YBG/Living officeholders/«office»}} - Provides office-specific data for other templates (us-p,usvp,aupm,nzpm,ukpm)
    Called by {{.../row}} and {{.../box}} 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
  • {{User:YBG/Living officeholders/plusminus}} - provides +/− signs consistently formatted based on the sign of the parameter
    Called by {{.../row}} and (for headers and footers) by {{.../«office»-table}}
    • |1= optionally signed ordinal number of the officeholder
    Calls no other templates in this system
  • {{User:YBG/Living officeholders/testcases}} - tests all living officeholder subtenplates
    Called by no other templates
    Calls every living officeholder subtemplate
  • {{User:YBG/Living officeholders/testcases/row}} - designed to test {{.../row}}
    Called by {{.../testcases}}
    • |row=: row1, row2, etc. - the row variety to be tested.
    Calls {{.../row«N»}}