Difference between revisions of "Template:Lead/Inner"
From Biowikifarm Metawiki
Line 1: | Line 1: | ||
− | <noinclude>Version 3. | + | <noinclude>Version 3.6. NEW: length estimate based on resulttext instead of resultlink (for empty result!!!) |
+ | Previous changes: | ||
+ | a) nested works now on parents with backlinks and alternatives (1 and 1*, 1 and 1'). 1 and 1- NEEDS TESTING! | ||
+ | b) result text+ empty result supported (non-linking result). | ||
+ | d) nowrap on result/qualifier reworked! | ||
+ | d) result=http:... now works. | ||
+ | e) Nested subkey ok. Resultqualifier no longer in () | ||
'''See [[Template:Key Start/doc| Key Start]] for the main documentation.''' | '''See [[Template:Key Start/doc| Key Start]] for the main documentation.''' | ||
Line 5: | Line 11: | ||
[[Category:Single-access key templates]] | [[Category:Single-access key templates]] | ||
− | </noinclude><includeonly><!-- | + | </noinclude><includeonly><!-- |
// Creating additional space before starting a new couplet (but not between leads of the same couplet). Both this and truly unique id attributes on leads depend on "Extension:Variables" for saving the current couplet number to compare with previous to determine the position where a new couplet starts.-->{{ | // Creating additional space before starting a new couplet (but not between leads of the same couplet). Both this and truly unique id attributes on leads depend on "Extension:Variables" for saving the current couplet number to compare with previous to determine the position where a new couplet starts.-->{{ | ||
#ifeq:{{{leadID}}}|{{#var:decisiontreePreviousCouplet}}<!-- | #ifeq:{{{leadID}}}|{{#var:decisiontreePreviousCouplet}}<!-- | ||
− | THEN 2nd lead | + | THEN (2nd/3rd/etc lead in a couplet:)-->|{{#vardefine:decisiontreeAlternative|{{ |
#expr:{{#var:decisiontreeAlternative}}+1}} | #expr:{{#var:decisiontreeAlternative}}+1}} | ||
− | }}<tr id="L{{{keyID}}}_{{{leadID}}}_{{#var:decisiontreeAlternative}}_row" class="dt-row">{{ | + | }}<tr id="L{{{keyID}}}_{{{leadID}}}_{{#var:decisiontreeAlternative}}_row" class="dt-row"><!-- |
− | #if:{{{parentlead}}}|<!--then insert two columns--><td></td><td></td> | + | -->{{#if:{{{parentlead}}}|<!--then insert two columns--><td></td><td></td><!-- |
− | }}<td class="dt-nodeid">{{{displayID}}}</td><!-- | + | -->}}<td class="dt-nodeid">{{{displayID}}}</td><!-- |
− | ELSE first lead:-->|{{# | + | ELSE (first lead):-->|{{ |
− | # | + | #if:{{{parentlead}}}{{#ifeq:0|{{#var:decisiontreePreviousCouplet}}|FIRSTCOUPLET|}}<!-- |
− | <tr class="dt-hspacer"><td colspan="6"></td></tr>}}{{ | + | then: no spacer row for nested subkey rows or before first couplet-->|<!-- |
+ | else: insert spacer -->|<tr class="dt-hspacer"><td colspan="6"></td></tr> | ||
+ | }}{{#vardefine:decisiontreePreviousCouplet|{{{leadID}}}}}{{#vardefine:decisiontreeAlternative|1}}{{ | ||
#if: {{{subheading}}}| | #if: {{{subheading}}}| | ||
<tr class="dt-subheading"><td colspan="6" style="font-weight:bold;padding:0.5em 0.75em 0.3em 0.75em; {{ | <tr class="dt-subheading"><td colspan="6" style="font-weight:bold;padding:0.5em 0.75em 0.3em 0.75em; {{ | ||
Line 28: | Line 36: | ||
| #default = {{{subheadingstyle}}} | | #default = {{{subheadingstyle}}} | ||
}}">{{{subheading}}}</td></tr> | }}">{{{subheading}}}</td></tr> | ||
− | <tr class="dt-hspacer"><td></td></tr><!-- | + | <tr class="dt-hspacer"><td></td></tr><!-- |
// END if subheading. | // END if subheading. | ||
// Next column is lead id. However, if parentlead is filled, it is indented 2 columns (and the normal colspan=3 in 3rd col. is removed) | // Next column is lead id. However, if parentlead is filled, it is indented 2 columns (and the normal colspan=3 in 3rd col. is removed) | ||
Line 34: | Line 42: | ||
#if:{{{parentlead}}}|<!--then insert two columns--><td></td><td></td> | #if:{{{parentlead}}}|<!--then insert two columns--><td></td><td></td> | ||
}}<td id="L{{{keyID}}}_{{{leadID}}}" class="dt-nodeid">{{{displayID}}}</td> | }}<td id="L{{{keyID}}}_{{{leadID}}}" class="dt-nodeid">{{{displayID}}}</td> | ||
− | }}<!-- | + | }}<!-- |
// Second column contains either backlink or lead-differentiators (*, ', -, etc.); if neither is present: output empty column: | // Second column contains either backlink or lead-differentiators (*, ', -, etc.); if neither is present: output empty column: | ||
Line 41: | Line 49: | ||
// Next column is the main statement text plus the result. To make distribution of columns variable row-by-row, this uses a nested inner table: | // Next column is the main statement text plus the result. To make distribution of columns variable row-by-row, this uses a nested inner table: | ||
--><td class="lead-row1" {{#if:{{{parentlead}}}||<!--else-->colspan="3"}}><table class="nested {{#if: {{{detailtext}}}{{{image m}}}<!--make table collapsible if EXTRA txt/imgs exist:-->|<nowiki> </nowiki>collapsible collapsed}}" width="100%" cellspacing="0" cellpadding="0"><tr> | --><td class="lead-row1" {{#if:{{{parentlead}}}||<!--else-->colspan="3"}}><table class="nested {{#if: {{{detailtext}}}{{{image m}}}<!--make table collapsible if EXTRA txt/imgs exist:-->|<nowiki> </nowiki>collapsible collapsed}}" width="100%" cellspacing="0" cellpadding="0"><tr> | ||
− | <th class="leadtxt" {{#ifexpr:{{#len:{{{next}}}{{{ | + | <th class="leadtxt" {{#ifexpr:{{#len:{{{next}}}{{{resulttext}}} }} < 5 |width="95%"}}><span class="leadspan">{{Trim|1={{{statement}}}}} </span></th><!-- |
// Next column is a pointer to further leads and/or to a taxon/subkey result; both will be autolinked. | // Next column is a pointer to further leads and/or to a taxon/subkey result; both will be autolinked. | ||
Line 53: | Line 61: | ||
--><span class="leadresults{{#ifexpr:{{#len:{{{resulttext}}}{{{resultqualifier}}} }} < 40|<nowiki> </nowiki>nowrap}}"><!-- | --><span class="leadresults{{#ifexpr:{{#len:{{{resulttext}}}{{{resultqualifier}}} }} < 40|<nowiki> </nowiki>nowrap}}"><!-- | ||
--><span class="leadout{{#ifexpr:{{#len:{{{resulttext}}} }} < 40|<nowiki> </nowiki>nowrap}}"> {{ | --><span class="leadout{{#ifexpr:{{#len:{{{resulttext}}} }} < 40|<nowiki> </nowiki>nowrap}}"> {{ | ||
− | #ifeq:{{#sub:{{{resultlink}}}|0|5}}|http:<!-- | + | #ifeq:{{#sub:{{{resultlink}}}|0|5}}|http:<!-- |
− | THEN-->|[{{{resultlink}}} {{{resulttext}}}]<!-- | + | THEN http-link:-->|[{{{resultlink}}} {{{resulttext}}}]<!-- |
− | ELSE-->|[[{{{resultlink}}}|{{{resulttext}}}]] | + | ELSE -->|{{#if:{{{resultlink}}}<!-- |
− | }}</span>{{#if: {{{resultqualifier}}}<!--then-->|{{#if:{{{image a}}}<!-- use br if side-bar images present, else a wrappable blank:-->|<br />|<nowiki> </nowiki>}}<span class="resultqualifier{{#ifexpr:{{#len:{{{resultqualifier}}} }} < 40|<nowiki> </nowiki>nowrap}}"><nowiki> </nowiki>{{{resultqualifier}}}</span><!--end if res.qual., then closing nowrap span around result+qualif.:-->}}</span>{{ | + | THEN wiki-link:-->|[[{{{resultlink}}}|{{{resulttext}}}]]<!-- |
+ | ELSE non-link: -->|{{{resulttext}}}<!-- | ||
+ | END -->}}<!-- | ||
+ | END -->}}</span>{{#if: {{{resultqualifier}}}<!--then-->|{{#if:{{{image a}}}<!-- use br if side-bar images present, else a wrappable blank:-->|<br />|<nowiki> </nowiki>}}<span class="resultqualifier{{#ifexpr:{{#len:{{{resultqualifier}}} }} < 40|<nowiki> </nowiki>nowrap}}"><nowiki> </nowiki>{{{resultqualifier}}}</span><!--end if res.qual., then closing nowrap span around result+qualif.:-->}}</span>{{ | ||
#if:{{{next}}}<!-- NEXT-LEAD-POINTER in addition to "resultlink": | #if:{{{next}}}<!-- NEXT-LEAD-POINTER in addition to "resultlink": | ||
// (result+next-lead co-occur, e.g., for species-result where key continues with subspecies. Always new line, double arrow:) | // (result+next-lead co-occur, e.g., for species-result where key continues with subspecies. Always new line, double arrow:) | ||
THEN-->|<br /><span class="leadon"> [[#L{{{keyID}}}_{{{parentlead}}}{{{next}}}| ►► {{{next}}}]]</span><!-- | THEN-->|<br /><span class="leadon"> [[#L{{{keyID}}}_{{{parentlead}}}{{{next}}}| ►► {{{next}}}]]</span><!-- | ||
− | ELSE IF nested-->|{{#if:{{{nested}}}<!-- | + | ELSE IF nested (? pointer to indented subkey)-->|{{#if:{{{nested}}}<!-- Note: leadpart2 could be a backlink... |
− | THEN-->|<br /><span class="leadon"> [[#L{{{keyID}}}_{{{leadID}}}{{{nested}}}| ▼▼ {{{nested}}}]]</span><!-- | + | THEN-->|<br /><span class="leadon"> [[#L{{{keyID}}}_{{{leadID}}}{{#ifeq:{{#sub:{{{leadpart2}}}|0|1}}|[<!--THEN nothing-->|<!--ELSE -->|{{{leadpart2}}}}}{{{nested}}}| ▼▼ {{{nested}}}]]</span><!-- |
+ | * Note on above: leadpart2 may be a * forbidden in ids; however, some step in mediawiki will convert * to .2A | ||
END of both next / nested lead inside result -->}}}}</td><!-- | END of both next / nested lead inside result -->}}}}</td><!-- | ||
// Normal NEXT-LEAD-POINTER (without result); format as internal link: | // Normal NEXT-LEAD-POINTER (without result); format as internal link: | ||
ELSE-->|<td class="leadresult"><span class="leadon"> [[#L{{{keyID}}}_{{{parentlead|}}}{{{next}}}| ► {{{next}}}]]</span></td><!-- | ELSE-->|<td class="leadresult"><span class="leadon"> [[#L{{{keyID}}}_{{{parentlead|}}}{{{next}}}| ► {{{next}}}]]</span></td><!-- | ||
End if result or next-lead -->}}</tr> | End if result or next-lead -->}}</tr> | ||
− | <!-- | + | <!-- |
− | // ADDITIONAL info below the statement/result line: | + | // ADDITIONAL info below the statement/result line: |
− | // ERROR REPORTING: Any content in 4th and later unnamed parameters is an error.-->{{ | + | // ERROR REPORTING: Any content in 4th and later unnamed parameters is an error.-->{{ |
#if: {{{errors}}}|<tr><th colspan="2" class="leaderror">{{{errors}}}</th></tr><!-- | #if: {{{errors}}}|<tr><th colspan="2" class="leaderror">{{{errors}}}</th></tr><!-- | ||
end:-->}}<!-- | end:-->}}<!-- | ||
− | // START EXTRA INFO and IMAGES: | + | // START EXTRA INFO and IMAGES: |
// Extra text and images from the optional parameters: "synonyms", "description", "occurrence", "remarks" are already combined to detailtext here. "image m/caption m" to "image r/caption r" are tested. For wrappable gallery images are below detailtext -->{{ | // Extra text and images from the optional parameters: "synonyms", "description", "occurrence", "remarks" are already combined to detailtext here. "image m/caption m" to "image r/caption r" are tested. For wrappable gallery images are below detailtext -->{{ | ||
#if: {{{detailtext}}}{{{image m}}}<!-- | #if: {{{detailtext}}}{{{image m}}}<!-- | ||
THEN-->|<tr><td class="leadextras" colspan="2"><div class="leadextras">{{{detailtext}}}{{ | THEN-->|<tr><td class="leadextras" colspan="2"><div class="leadextras">{{{detailtext}}}{{ | ||
− | #if: {{{image m}}}<!-- | + | #if: {{{image m}}}<!-- |
// at least 1 extra image present, after extra text or alone: START Secondary-IMAGE CONTENT | // at least 1 extra image present, after extra text or alone: START Secondary-IMAGE CONTENT | ||
// The wrapping table around float-left tables is necessary, with nothing or a div the outer div will not be around, and the lines not displayed | // The wrapping table around float-left tables is necessary, with nothing or a div the outer div will not be around, and the lines not displayed | ||
Line 89: | Line 101: | ||
--></td></tr>{{#if:{{{imagesfooter}}}|<tr><td colspan="10" style="text-align:right; font-size:80%; line-height:1em;">{{{imagesfooter}}}</td></tr>}}</table><!-- | --></td></tr>{{#if:{{{imagesfooter}}}|<tr><td colspan="10" style="text-align:right; font-size:80%; line-height:1em;">{{{imagesfooter}}}</td></tr>}}</table><!-- | ||
// END if any images-->}}</div></td></tr><!-- | // END if any images-->}}</div></td></tr><!-- | ||
− | // END if any extra text or image info in a second row: -->}}<!-- | + | // END if any extra text or image info in a second row: -->}}<!-- |
// END of "nested" inner table--> | // END of "nested" inner table--> | ||
</table>{{ | </table>{{ | ||
− | #if:{{{image j}}}{{{image k}}}<!-- | + | #if:{{{image j}}}{{{image k}}}<!-- |
// At least one larger, non-hide-able image below (image j/k): | // At least one larger, non-hide-able image below (image j/k): | ||
Line 102: | Line 114: | ||
#if: {{{image a}}}<!-- At least 1 sidebar image present (else empty td created): | #if: {{{image a}}}<!-- At least 1 sidebar image present (else empty td created): | ||
− | // START RIGHT SIDEBAR IMAGE CONTENT, | + | // START RIGHT SIDEBAR IMAGE CONTENT, (image m... in contrast are hidden by default) |
// up to 5 images, non-wrapping, Lead/GalleryItemNoCaption creates td! | // up to 5 images, non-wrapping, Lead/GalleryItemNoCaption creates td! | ||
// image a - e, caption a - e | // image a - e, caption a - e | ||
Line 108: | Line 120: | ||
// image a - e height, primary images height (for all) | // image a - e height, primary images height (for all) | ||
THEN-->|<table style="border:none; margin-top:0.1em;margin-left:1em;"><tr><!-- | THEN-->|<table style="border:none; margin-top:0.1em;margin-left:1em;"><tr><!-- | ||
− | -->{{#if: {{{image a}}}|{{Lead/GalleryItemNoCaption|image={{{image a}}}|caption={{{caption a}}}|label={{{label a}}}|width={{{image a width}}}|height={{{image a height}}}}}}}<!-- | + | image a |
− | -->{{#if: {{{image b}}}|{{Lead/GalleryItemNoCaption|image={{{image b}}}|caption={{{caption b}}}|label={{{label b}}}|width={{{image b width}}}|height={{{image b height}}}}}}}<!-- | + | -->{{#if: {{{image a}}}|{{Lead/GalleryItemNoCaption|image={{{image a}}}|caption={{{caption a}}}|label={{{label a}}}|width={{{image a width}}}|height={{{image a height}}}}} }}<!-- |
− | -->{{#if: {{{image c}}}|{{Lead/GalleryItemNoCaption|image={{{image c}}}|caption={{{caption c}}}|label={{{label c}}}|width={{{image c width}}}|height={{{image c height}}}}}}}<!-- | + | image a: add an optional break |
− | -->{{#if: {{{image d}}}|{{Lead/GalleryItemNoCaption|image={{{image d}}}|caption={{{caption d}}}|label={{{label d}}}|width={{{image d width}}}|height={{{image d height}}}}}}}<!-- | + | -->{{#ifeq: {{{image columns|}}} | n×1 | </tr><!-- n×1 --><tr>}}<!-- |
− | -->{{#if: {{{image e}}}|{{Lead/GalleryItemNoCaption|image={{{image e}}}|caption={{{caption e}}}|label={{{label e}}}|width={{{image e width}}}|height={{{image e height}}}}}}} | + | image b |
− | + | -->{{#if: {{{image b}}}|{{Lead/GalleryItemNoCaption|image={{{image b}}}|caption={{{caption b}}}|label={{{label b}}}|width={{{image b width}}}|height={{{image b height}}}}} }}<!-- | |
+ | image b: add an optional break | ||
+ | -->{{#switch: {{{image columns|}}} | n×1 = </tr><!-- n×1 --><tr> | n×2 = </tr><!-- n×2 --><tr> | test = test funktioniert }}<!-- | ||
+ | image c | ||
+ | -->{{#if: {{{image c}}}|{{Lead/GalleryItemNoCaption|image={{{image c}}}|caption={{{caption c}}}|label={{{label c}}}|width={{{image c width}}}|height={{{image c height}}}}} }}<!-- | ||
+ | image c: add an optional break | ||
+ | -->{{#switch: {{{image columns|}}} | n×1 = </tr><!-- n×1 --><tr> | n×3 = </tr><!-- n×3 --><tr> }}<!-- | ||
+ | image d | ||
+ | -->{{#if: {{{image d}}}|{{Lead/GalleryItemNoCaption|image={{{image d}}}|caption={{{caption d}}}|label={{{label d}}}|width={{{image d width}}}|height={{{image d height}}}}} }}<!-- | ||
+ | image d: add an optional break | ||
+ | -->{{#switch: {{{image columns|}}} | n×1 = </tr><!-- n×1 --><tr> | n×2 = </tr><!-- n×2 --><tr> }}<!-- | ||
+ | image e | ||
+ | -->{{#if: {{{image e}}}|{{Lead/GalleryItemNoCaption|image={{{image e}}}|caption={{{caption e}}}|label={{{label e}}}|width={{{image e width}}}|height={{{image e height}}}}} }} | ||
+ | </tr></table> | ||
}}</td></tr></includeonly> | }}</td></tr></includeonly> |
Revision as of 22:21, 1 June 2010
Version 3.6. NEW: length estimate based on resulttext instead of resultlink (for empty result!!!)
Previous changes: a) nested works now on parents with backlinks and alternatives (1 and 1*, 1 and 1'). 1 and 1- NEEDS TESTING! b) result text+ empty result supported (non-linking result). d) nowrap on result/qualifier reworked! d) result=http:... now works. e) Nested subkey ok. Resultqualifier no longer in ()
See Key Start for the main documentation.