Difference between revisions of "Template:Lead"

From Biowikifarm Metawiki
Jump to: navigation, search
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- Retrieving the id-parameter of the outer SingleAccessKey template from a variable depends on the "Variables" extension being installed. On Wikis where this is not the case, remove "{{#var:SingleAccessKeyID}}" (three times).
+
<noinclude>Version 3.1:  
  
The first column contain the lead number plus an anchor (id="") to which internal links may point. (For replace/explode of first parameter see below)
+
NEW: resultlink removed,
--><tr id="L{{#var:SingleAccessKeyID}}{{Trim|{{#replace: {{#explode:{{{1}}}|(|0}} |)|}}}}row" style="vertical-align:top;"><td id="L{{#var:SingleAccessKeyID}}{{Trim|{{#replace: {{#explode:{{{1}}}|(|0}} |)|}}}}" class="leadnr">{{Trim|{{#replace: {{#explode:{{{1|Lead number missing!}}}|(|0<!--end explode:-->}} |)| <!--end replace:-->}} <!--end lc/trim:-->}}</td><!--
+
NEW: resulttext deprecated, "result text" is preferred!
 +
NEW: resultqualifier deprecated, "result qualifier" is preferred!
 +
New: common names allowed (and should perhaps be preferred over commonnames! -- TODO: also allow common names in Key Start
  
* Fill the second column only if a backlink (= 2nd element in explode of first template parameter) exists; else output empty column
+
Previous new: Nested subkey. STATUS: Tested, result text and image j/k working
--><td>{{#if:{{#replace: {{#explode:{{{1}}}|(|1<!--end explode:-->}} |)| <!--end replace:-->}}|<!--
+
    then:
+
      link target:-->[[#L{{#replace: {{#explode:{{{1}}}|(|1<!--end explode:-->}} |)| <!--end replace:-->}}<!--
+
      link plain text:-->|({{#replace: {{#explode:{{{1}}}|(|1<!--end explode:-->}} |)| <!--end replace:-->}})]]&nbsp;<!--
+
    endif:-->}}</td><!--
+
  
* Next column is the main statement text:
+
New parameters: nested (the first lead number of a nested key that identifies the current lead as its parentlead. parentlead = identifying a lead as nested within the parentlead (the leads are indented, and the parentlead identifier become part of the nested lead id/next-lead values).
--><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><!--
+
  
* 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.
+
a) Simplified, no more image-no-resize-parameter (manually set size for very small images), no more link to next/result behind image, no more little metadata icons (which were necessary because of redirecting the main links. Javascript runs almost everywhere, former solution was very complicated and removed by javascript code! -- b) new image k, intended to be always displayed (no autohide) BELOW the statement text (for larger, wide in-key images). -- c) obsolete -- d) new parameter "resultqualifier=" for male/female/white form, etc.; may also be used for scientific names, if result is desired to link to the common name. -- c) Image numbering adjusted to simplify creating a decision-based template (one template covering all leads, like the decision horizontal template. Called by outer template, Collapsible/collapsed added, lead images in right sidebar (up to five primary, "image a" to "image e", images side-by-side), non-hideable below statement (2 images, "image j"/"image k") and hidable below (secondary, "image m" to "image r" etc, max 6 images, wrapping gallery style).
-->{{#ifexpr:{{#len:{{{3|}}}{{{taxon|}}}<!-- = both 3rd unnamed par. and taxon concatenated-->}}<5<!--
+
  -->|<!-- 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?
+
  -->{{#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><!--
+
  -->|<!-- ELSE: same row:--><td class="leadresult" colspan="2"><span style="background-color:#FFFFFF;">&nbsp;{{{3|}}}{{{taxon|}}}</span></td><!--
+
  -->}} }}<!--
+
--></tr><!--
+
/*** Any content in the fourth or fifth unnamed parameter is always an error and is reported: ***/
+
-->{{ #if: {{{4|}}}{{{5|}}} <!--
+
  -->| <tr><td style="color:red;font-weight:bold" colspan="5">This lead has an erroneous fourth or fifth parameter: {{ #if: {{{4|}}} | {{{4}}} }} {{ #if: {{{5|}}} | {{{5}}} }}. To add images or descriptions use <code><nowiki>|description=Your text|</nowiki></code> ''or'' <code><nowiki>|images=[[Image:YourImage.jpg|140px|Your Caption]]|</nowiki></code>.</td></tr><!--
+
:endif-->}}<!--
+
/*** Free-form text descriptions are in the optional parameter "description" ***/
+
-->{{ #if: {{{description|}}} <!--
+
  -->| <tr><td></td><td></td><td class="taxondescription" colspan="3">{{{description}}}</td></tr><!--
+
:endif-->}}<!--
+
/*** Images are in the named optional parameter "images" or "image" (both are accepted!) ***/
+
-->{{ #if: {{{images| {{{image|}}} }}} <!--
+
  -->| <tr><td></td><td></td><td class="leadimages" colspan="3">{{{images| {{{image}}} }}}</td></tr><!--
+
:endif-->}}<!--
+
--><noinclude>
+
{{Documentation}}
+
  
Development notes:  
+
PROCESS: a) Handle the subheading parameter directly (creating a visual separator (bold) above a couplet, usually summarizing identification progress and highlighting "sections" of a key). b) Error handling and combining detail text already occurs here. c) Call [[Template:Lead/Inner]], passing calculated fields like the parsed lead-ID to be used multiple times.
  
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 main documentation for all parts of the single-access key is under [[Template:Key Start/doc]]. Add only specific notes here.
  
The optional images (usually taxon images) are placed right aligned in a separate row, spanning all columns.
+
The first column contains the lead number plus an anchor (id="") to which internal links may point. Here and further below, the first Lead parameter is split into two parts using the Lead/SplitNumber template.
  
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).
+
Note: Retrieving the id-parameter of the earlier "Key Start" template from a variable depends on the "Variables" extension being installed. On Wiki installations where this is not the case, remove the template code "<nowiki>{{#var:decisiontreeID}}</nowiki>" (here, in Lead itself and Lead/SplitNumber).
  
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.
+
{{Documentation}}
 
+
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: {{#replace:{{{1}}}|)| }}.
+
  
Named parameters are: image, images, description. No 4th or 4th unnamed parameter exists
+
[[Category:Single-access key templates]]
  
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.
+
</noinclude><includeonly>{{Lead/Inner|
</noinclude>
+
subheading = {{{subheading|}}}|
 +
subheadingstyle = {{{subheadingstyle|}}}|
 +
keyID      ={{#var:decisiontreeID}}|
 +
leadID    ={{{parentlead|}}}{{Lead/SplitNumber|{{{1|99999}}}|0|noformatting=1}}|
 +
displayID  ={{Lead/SplitNumber|{{{1|Number missing!}}}|0}}|
 +
leadpart2  ={{Lead/SplitNumber|{{{1}}}|1}}|
 +
parentlead ={{{parentlead|}}}|
 +
nested    ={{Trim|{{{nested|}}}}}|
 +
statement  ={{{2|'''Lead statement missing!'''}}}|
 +
next      ={{Trim|{{{3|}}}}}|
 +
commonnames={{{commonnames|}}}{{{common names|}}}|
 +
resulttext ={{#if: {{{result text|}}}{{{resulttext|}}}|{{{result text|}}}{{{resulttext|}}}|<!--ELSE:-->{{{result|}}}}}|
 +
resultlink ={{Lead/StripFormatting|1={{{result|}}}}}|
 +
resultqualifier ={{{result qualifier|}}}{{{resultqualifier|}}}|
 +
errors    =<!--ERROR REPORTING: Any content in 4th and later unnamed parameters is an error.-->{{
 +
#if: {{{4|}}}{{{commonname|}}}{{{common name|}}}{{{image|}}}{{{images|}}}{{{synonym|}}}{{{remark|}}}{{{results|}}}<!--
 +
THEN:-->|Error: You may have an erroneous 4th unnamed parameter (vertical bar without a field name), or you may use "commonname/common name/remark/results/synonym/image/images" instead of "common names/remarks/result/synonyms/image a" etc. The content is: '''{{{4|}}} {{{5|}}} {{{commonname|}}} {{{common name|}}} {{{synonym|}}} {{{remark|}}} {{{results|}}} {{{image|}}} {{{images|}}}'''. To add descriptions use <code><nowiki>|description=Your text|</nowiki></code>; to add one or several synonyms use <code><nowiki>|synonmys=Synonym 1; Synonym 2|</nowiki></code>; to add images use <code><nowiki>|image 1a=Image:YourImage.jpg |caption 1a=Your Caption</nowiki></code> (images a to e are in the sidebar, j following below lead text, with j/k always visible and, images m to r in the "more"-information area below the lead).<!--
 +
END ERROR REPORTING.
 +
START DETAIL TEXT:-->}}|
 +
detailtext ={{
 +
#if: {{{synonyms|}}} |<span class="synonyms">(= {{{synonyms}}})</span><br />
 +
}}{{
 +
#if: {{{description|}}} |<span class="description">{{{description}}} </span>
 +
}}{{
 +
#if: {{{occurrence|}}} |<span class="occurrence">{{{occurrence}}} </span>
 +
}}{{
 +
#if: {{{remarks|}}} |<span class="remarks">{{{remarks}}} </span>
 +
}}<!--END DETAIL TEXT.-->|
 +
primary images width  ={{{primary images width|80}}}|
 +
primary images height ={{{primary images height|80}}}|
 +
image a        ={{{image a|}}}|
 +
label a        ={{{label a|}}}|
 +
caption a      ={{{caption a|}}}|
 +
image a width  ={{{image a width|{{{primary images width|80}}}}}}|
 +
image a height ={{{image a height|{{{primary images height|80}}}}}}|
 +
image b        ={{{image b|}}}|
 +
label b        ={{{label b|}}}|
 +
caption b      ={{{caption b|}}}|
 +
image b width  ={{{image b width|{{{primary images width|80}}}}}}|
 +
image b height ={{{image b height|{{{primary images height|80}}}}}}|
 +
image c        ={{{image c|}}}|
 +
label c        ={{{label c|}}}|
 +
caption c      ={{{caption c|}}}|
 +
image c width  ={{{image c width|{{{primary images width|80}}}}}}|
 +
image c height ={{{image c height|{{{primary images height|80}}}}}}|
 +
image d        ={{{image d|}}}|
 +
label d        ={{{label d|}}}|
 +
caption d      ={{{caption d|}}}|
 +
image d width  ={{{image d width|{{{primary images width|80}}}}}}|
 +
image d height ={{{image d height|{{{primary images height|80}}}}}}|
 +
image e        ={{{image e|}}}|
 +
label e        ={{{label e|}}}|
 +
caption e      ={{{caption e|}}}|
 +
image e width  ={{{image e width|{{{primary images width|80}}}}}}|
 +
image e height ={{{image e height|{{{primary images height|80}}}}}}|
 +
extra images width  ={{{extra images width|240}}}|
 +
extra images height ={{{extra images height|240}}}|
 +
image j        ={{{image j|}}}|
 +
label j        ={{{label j|}}}|
 +
caption j      ={{{caption j|}}}|
 +
image j width  ={{{image j width|{{{extra images width|650}}}}}}|
 +
image j height ={{{image j height|{{{extra images height|300}}}}}}|
 +
image k        ={{{image k|}}}|
 +
label k        ={{{label k|}}}|
 +
caption k      ={{{caption k|}}}|
 +
image k width  ={{{image k width|{{{extra images width|650}}}}}}|
 +
image k height ={{{image k height|{{{extra images height|300}}}}}}|
 +
image m        ={{{image m|}}}|
 +
label m        ={{{label m|}}}|
 +
caption m      ={{{caption m|}}}|
 +
image m width  ={{{image m width|{{{extra images width|200}}}}}}|
 +
image m height ={{{image m height|{{{extra images height|200}}}}}}|
 +
image n        ={{{image n|}}}|
 +
label n        ={{{label n|}}}|
 +
caption n      ={{{caption n|}}}|
 +
image n width  ={{{image n width|{{{extra images width|200}}}}}}|
 +
image n height ={{{image n height|{{{extra images height|200}}}}}}|
 +
image o        ={{{image o|}}}|
 +
label o        ={{{label o|}}}|
 +
caption o      ={{{caption o|}}}|
 +
image o width  ={{{image o width|{{{extra images width|200}}}}}}|
 +
image o height ={{{image o height|{{{extra images height|200}}}}}}|
 +
image p        ={{{image p|}}}|
 +
label p        ={{{label p|}}}|
 +
caption p      ={{{caption p|}}}|
 +
image p width  ={{{image p width|{{{extra images width|200}}}}}}|
 +
image p height ={{{image p height|{{{extra images height|200}}}}}}|
 +
image q        ={{{image q|}}}|
 +
label q        ={{{label q|}}}|
 +
caption q      ={{{caption q|}}}|
 +
image q width  ={{{image q width|{{{extra images width|200}}}}}}|
 +
image q height ={{{image q height|{{{extra images height|200}}}}}}|
 +
image r        ={{{image r|}}}|
 +
label r        ={{{label r|}}}|
 +
caption r      ={{{caption r|}}}|
 +
image r width  ={{{image r width|{{{extra images width|200}}}}}}|
 +
image r height ={{{image r height|{{{extra images height|200}}}}}}|
 +
captionlines ={{{captionlines|2}}}|
 +
imagesfooter ={{{imagesfooter|}}}
 +
}}</includeonly>

Latest revision as of 17:02, 6 March 2010

Version 3.1:

NEW: resultlink removed, NEW: resulttext deprecated, "result text" is preferred! NEW: resultqualifier deprecated, "result qualifier" is preferred! New: common names allowed (and should perhaps be preferred over commonnames! -- TODO: also allow common names in Key Start

Previous new: Nested subkey. STATUS: Tested, result text and image j/k working

New parameters: nested (the first lead number of a nested key that identifies the current lead as its parentlead. parentlead = identifying a lead as nested within the parentlead (the leads are indented, and the parentlead identifier become part of the nested lead id/next-lead values).

a) Simplified, no more image-no-resize-parameter (manually set size for very small images), no more link to next/result behind image, no more little metadata icons (which were necessary because of redirecting the main links. Javascript runs almost everywhere, former solution was very complicated and removed by javascript code! -- b) new image k, intended to be always displayed (no autohide) BELOW the statement text (for larger, wide in-key images). -- c) obsolete -- d) new parameter "resultqualifier=" for male/female/white form, etc.; may also be used for scientific names, if result is desired to link to the common name. -- c) Image numbering adjusted to simplify creating a decision-based template (one template covering all leads, like the decision horizontal template. Called by outer template, Collapsible/collapsed added, lead images in right sidebar (up to five primary, "image a" to "image e", images side-by-side), non-hideable below statement (2 images, "image j"/"image k") and hidable below (secondary, "image m" to "image r" etc, max 6 images, wrapping gallery style).

PROCESS: a) Handle the subheading parameter directly (creating a visual separator (bold) above a couplet, usually summarizing identification progress and highlighting "sections" of a key). b) Error handling and combining detail text already occurs here. c) Call Template:Lead/Inner, passing calculated fields like the parsed lead-ID to be used multiple times.

The main documentation for all parts of the single-access key is under Template:Key Start/doc. Add only specific notes here.

The first column contains the lead number plus an anchor (id="") to which internal links may point. Here and further below, the first Lead parameter is split into two parts using the Lead/SplitNumber template.

Note: Retrieving the id-parameter of the earlier "Key Start" template from a variable depends on the "Variables" extension being installed. On Wiki installations where this is not the case, remove the template code "{{#var:decisiontreeID}}" (here, in Lead itself and Lead/SplitNumber).

[edit] Template documentation

See Key Start for the main documentation.