Template:Lead
<tr id="L{{{1}}}row" style="vertical-align:top;"><td id="L{{{1}}}" class="leadnr">Lead number missing!</td><td></td><td class="lead" colspan="2" width="90%">Lead statement missing! </td><td class="leadresult" width="5em"> [[#L{{{3}}}|Lead pointer missing!]]</td></tr>
Development notes:
This is a 5-column table, where col.1 = lead number, col.2 = optional backlink, col.3 = statement, col.4 = assigned to left or right for overlap, col.5 = lead pointer or taxon.
The optional images (usually taxon images) are placed right aligned in a separate row, spanning all columns.
The code makes a distinction between terminal (taxon) and ongoing leads, which is made heuristically based on length of parameter 3 (up to 4 characters a lead-pointer is assumed).
The distinction influences the markup in the final column (kind of link) and the position of the colspan attribute. The colspan assigns column 4 either to the left or right column, allowing some overlap between long statement lines and long taxon names. To function, at least one row must use are real td cell with a defined width for column 4; currently this is achieved by adding an empty row as the last row in the table.
The span with white background are an experiment to provide on the one hand lead dots (by means of a background graphic defined on the class td.lead) and on the other hand have the text normally on top.
The first parameter may be a simple lead number "1", a number plus lead-code (1a, 1b, 1*, 1', 1", etc.) or a number with a backlink in round parenthesis: "2 (1)". We need to parse out the round brackets. First split the string at the "(" using explode, then remove ")" by replacing: {{{1}}}.
Named parameters are: image, images, description. No 4th or 4th unnamed parameter exists
Lead pointers: anchors must start with letter, therefore L prefixed, also id added to support multiple keys on a single wiki page. Note: no real trim function is present, but a custom template does the job.