Difference between revisions of "Template:Lead"

From Biowikifarm Metawiki
Jump to: navigation, search
Line 12: Line 12:
  
 
* Next column is the main statement text:
 
* Next column is the main statement text:
--><td class="lead" {{#ifexpr:{{#len:{{{3|}}}{{{taxon|}}}}}<5|colspan="2" width="90%" }}{{#ifexpr:{{#len:{{{3|}}}{{{taxon|}}}}}>30|colspan="3" }}><span style="background-color:#FFFFFF;">{{{2|Lead statement missing!}}}&nbsp;</span>
+
--><td class="lead" {{#ifexpr:{{#len:{{{3|}}}{{{taxon|}}}}}<5|colspan="2" width="90%" }}{{#ifexpr:{{#len:{{{3|}}}{{{taxon|}}}}}>300|colspan="3" }}><span style="background-color:#FFFFFF;">{{{2|Lead statement missing!}}}&nbsp;</span></td><!--
 
+
3: {{#len:{{{3|}}}}}
+
 
+
taxon: {{#len:{{{taxon|}}}}}
+
 
+
3taxon: {{#len:{{{3|}}}{{{taxon|}}}}}
+
</td><!--
+
  
 
* Next column is either a pointer to further leads or to a taxon/subkey. The first are autolinked, the second must already manually be linked if desired. NOTE: alternatively for taxon results, it is possible to have no 3rd unnamed parameter, and a "taxon" parameter instead.
 
* Next column is either a pointer to further leads or to a taxon/subkey. The first are autolinked, the second must already manually be linked if desired. NOTE: alternatively for taxon results, it is possible to have no 3rd unnamed parameter, and a "taxon" parameter instead.
Line 25: Line 18:
 
   -->|<!-- THEN: lead pointer, format as internal hyperlink:--><td class="leadresult" width="5em"><span style="background-color:#FFFFFF;">&nbsp;[[#L{{#var:SingleAccessKeyID}}{{Trim|{{{3}}} }}|{{Trim|{{{3|Lead pointer missing!}}} }}]]</span></td><!--
 
   -->|<!-- THEN: lead pointer, format as internal hyperlink:--><td class="leadresult" width="5em"><span style="background-color:#FFFFFF;">&nbsp;[[#L{{#var:SingleAccessKeyID}}{{Trim|{{{3}}} }}|{{Trim|{{{3|Lead pointer missing!}}} }}]]</span></td><!--
 
   -->|<!-- ELSE: taxon pointer; may contain links. Test size: same or separate row?
 
   -->|<!-- ELSE: taxon pointer; may contain links. Test size: same or separate row?
   -->{{#ifexpr:{{#len:{{{3|}}}{{{taxon|}}} }}>30<!--
+
   -->{{#ifexpr:{{#len:{{{3|}}}{{{taxon|}}} }}>300<!-- PROBLEM: WE ARE INTERESTED ONLY IN VISIBLE LENGTH (about 30), BUT THIS TEST LINK LENGTH, which may be a long http length... PERHAPS Some Sub(Pos( {{|}} ...????
 
   -->|<!-- THEN: separate row:--></tr><tr><td></td><td></td><td class="leadresult" colspan="3"><span style="background-color:#FFFFFF;">&nbsp;{{{3|}}}{{{taxon|}}}</span></td><!--
 
   -->|<!-- THEN: separate row:--></tr><tr><td></td><td></td><td class="leadresult" colspan="3"><span style="background-color:#FFFFFF;">&nbsp;{{{3|}}}{{{taxon|}}}</span></td><!--
 
   -->|<!-- ELSE: same row:--><td class="leadresult" colspan="2"><span style="background-color:#FFFFFF;">&nbsp;{{{3|}}}{{{taxon|}}}</span></td><!--
 
   -->|<!-- ELSE: same row:--><td class="leadresult" colspan="2"><span style="background-color:#FFFFFF;">&nbsp;{{{3|}}}{{{taxon|}}}</span></td><!--
Line 44: Line 37:
 
--><noinclude>
 
--><noinclude>
 
{{Documentation}}
 
{{Documentation}}
<!-- Development notes:  
+
 
 +
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.
 
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.
Line 61: Line 55:
  
 
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.
 
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.
 
TEMP: For comparison: here is some FRIDA code:
 
Main difference: FRIDA always places a taxon in a separate row, regardless of available space.
 
It may be worth testing the length of the statement, and depending on heuristics, do similarly for long statements!
 
<tr><td width="5%"><b>114</b></td>
 
    <td colspan="2" align="justify"><b> Upper face of leaves scabrid, matt. Lower face hairy or scabrid</b></td></tr>
 
<tr><td width="4%"></td>
 
    <td colspan="2" width="96%" align="right"><b><a href="#novo">Ulmus pumila L.</a></b></td></tr>
 
<tr><td width="4%"></td>
 
    <td align="justify"></td>
 
        <td align="right"><img src="http://dbiodbs.univ.trieste.it/quint/carso/foto/VR000880.jpg" width="200"></td></tr>
 
 
<tr><td width="5%"><b>115</b></td>
 
    <td width="90%" align="justify"><b>Small shubs &lt;2 m at maturity</b></td>
 
        <td width="5%" align="right"><b>116</b></td></tr>
 
<tr><td width="5%"><b>115</b></td>
 
    <td width="90%" align="justify"><b>Trees or high shrubs, &gt;2 m at maturity</b></td>
 
        <td width="5%" align="right"><b>117</b></td></tr>
 
 
 
</noinclude>
 
</noinclude>

Revision as of 00:38, 2 December 2008

<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>

[edit] Template documentation

See Key Start for the main documentation.

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.