Vorlage:Lead/Inner: Unterschied zwischen den Versionen
Aus Offene Naturführer
(Testweise zurück zu Version vom 21. Oktober 2010, 19:38 Uhr) |
(Wieder die aktuelle Version von 00:14, 4. Sep. 2012. Die alte Version rendert Brassica/Gladis OK, die neue nicht!) |
||
Zeile 1: | Zeile 1: | ||
− | <noinclude> | + | <noinclude>{{Documentation}} |
+ | [[Category:Single-access key templates]] | ||
+ | </noinclude><includeonly><!-- | ||
+ | // PART 0. Semantic properties and hidden category for SMW forms | ||
+ | -->{{#switch: {{CONTENTLANGUAGE}}<!-- | ||
− | + | // German: Deutschsprachige Attribute | |
− | + | -->|de|de-formal=[[Category:Schlüssel mit Lead-Vorlage]]<!-- Hidden cat for SMW form! | |
− | + | ||
− | + | -->{{#if: {{{commonnames}}}<!-- | |
− | + | THEN-->|{{#arraymap: {{{commonnames}}}<!-- values | |
− | + | -->|,<!-- split on , | |
− | + | -->|§<!-- assign temporary variable | |
+ | -->|[[Deutscher Name::§| ]]<!-- output | ||
+ | -->|<!-- new output separator | ||
+ | -->}}<!-- | ||
+ | END -->}}{{ | ||
+ | |||
+ | #if: {{{synonyms}}}<!-- | ||
+ | THEN-->| [[Synonymliste:: {{StripFormatting |{{{synonyms}}}}}| ]]<!-- | ||
+ | END -->}}{{ | ||
+ | |||
+ | #if: {{{scientificname}}}<!-- | ||
+ | THEN-->|[[Wissenschaftlicher Name::{{StripFormatting | {{{scientificname}}}}}| ]]<!-- | ||
+ | END -->}}<!-- | ||
− | + | // English properties | |
+ | -->| #default =[[Category:Keys based on lead template]]<!-- Hidden cat for SWM form! | ||
− | + | ! ENGLISH SEMANTIC PROPERTIES NOT YET DEFINED | |
− | + | // PART 0, END switch CONTENTLANGUAGE | |
− | // | + | -->}}<!-- |
+ | |||
+ | |||
+ | // PART 1. Manage spacer rows and subheadings above a lead row | ||
-->{{#ifeq: {{{leadID}}}|{{#var: decisiontreePreviousCouplet}}<!-- | -->{{#ifeq: {{{leadID}}}|{{#var: decisiontreePreviousCouplet}}<!-- | ||
− | + | // THEN 2nd/3rd/etc lead in a couplet, normal start | |
− | -->|{{#vardefine: decisiontreeAlternative|{{#expr: {{#var: decisiontreeAlternative}}+1}} | + | -->|{{#vardefine: decisiontreeAlternative|{{#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: indent 2 columns -->|<td></td><td></td>}} | |
− | + | <td class="dt-nodeid">{{{displayID}}}</td><!-- | |
− | + | // ELSE first lead: | |
− | + | -->|{{#if: {{#ifeq: 0|{{#var: decisiontreePreviousCouplet}}|FIRSTCOUPLET|}}{{{parentlead}}}<!-- | |
− | + | // THEN: no spacer row before first couplet or nested subkeys | |
− | -->|{{#if: | + | -->|<!-- // nothing |
− | + | // ELSE: insert spacer row | |
− | + | -->|<tr class="dt-hspacer"><td colspan="6"></td></tr><!-- | |
− | + | -->}}{{ | |
− | + | #vardefine: decisiontreePreviousCouplet|{{{leadID}}}}}{{ | |
− | + | #vardefine: decisiontreeAlternative|1}}{{ | |
− | + | #if: {{{subheading}}}<!-- | |
− | + | -->|<tr class="dt-subheading"><!-- | |
− | + | ||
− | + | ||
--><td colspan="6" style="font-weight:bold;padding:0.5em 0.75em 0.3em 0.75em; <!-- | --><td colspan="6" style="font-weight:bold;padding:0.5em 0.75em 0.3em 0.75em; <!-- | ||
-->{{#switch: {{lc:{{{subheadingstyle}}}}} | -->{{#switch: {{lc:{{{subheadingstyle}}}}} | ||
Zeile 39: | Zeile 57: | ||
| orange = background-color:#FCFFEC; border:1px solid #ffc51a; | | orange = background-color:#FCFFEC; border:1px solid #ffc51a; | ||
| green = background-color:#e5febe; border:1px solid #c5de9e; | | green = background-color:#e5febe; border:1px solid #c5de9e; | ||
− | |||
| bigorange = background-color:#FCFFEC; border:2px solid #ffc51a; font-size:120%; | | bigorange = background-color:#FCFFEC; border:2px solid #ffc51a; font-size:120%; | ||
| biggreen = background-color:#e5febe; border:2px solid #c5de9e; font-size:120%; | | biggreen = background-color:#e5febe; border:2px solid #c5de9e; font-size:120%; | ||
| simple = | | simple = | ||
| #default = {{{subheadingstyle}}} | | #default = {{{subheadingstyle}}} | ||
− | }}">{{{subheading}}}</td><!-- | + | }}">{{{subheading}}}</td><!-- |
--></tr><!-- | --></tr><!-- | ||
--><tr class="dt-hspacer"><td></td></tr><!-- | --><tr class="dt-hspacer"><td></td></tr><!-- | ||
− | -->}}<!-- | + | // END subheading: |
+ | -->}}<!-- | ||
+ | // Next column is lead id for first alternative. | ||
+ | --><tr id="L{{{keyID}}}_{{{leadID}}}_row" class="dt-row">{{ | ||
+ | #if:{{{parentlead}}}<!-- THEN: indent 2 columns -->|<td></td><td></td>}} | ||
+ | <td id="L{{{keyID}}}_{{{leadID}}}" class="dt-nodeid">{{{displayID}}}</td><!-- | ||
+ | // END PART 1, Manage spacer rows and subheadings above a lead row | ||
+ | -->}}<!-- | ||
− | + | // PART 2. Prepare lead core. | |
− | + | // Second column contains either backlink or lead-differentiators (*, ', -, etc.); | |
− | + | // Output empty column if neither is present | |
− | + | --><td class="leadalt">{{{leadpart2}}}</td><!-- | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | // Third column is main statement text. Uses a nested table to allow for row-by-row variable col. width | |
− | + | --><td class="lead-row1" {{#if: {{{parentlead}}}||colspan="3"}}><!-- | |
− | + | --><table class="nested" width="100%" cellspacing="0" cellpadding="0"><tr><!-- | |
+ | --><td class="leadtxt{{#if:{{{next}}}|<nowiki></nowiki> leadon}}" width="95%"><!-- | ||
+ | --><span class="leadspan">{{Trim|1={{{statement}}}}} </span><!-- | ||
+ | // Add mw-collapsible span (the "more…") | ||
+ | -->{{#if: {{{detailtext}}}{{{image m}}}|<span class="leadspan noprint mw-customtoggle-L{{{keyID}}}{{{leadID}}}{{#var:decisiontreeAlternative}}row"></span>}}<!-- | ||
+ | --></td><!-- | ||
+ | // Second column in nested table = number of further leads. NEW: both with and without result in same row (it used to be below result)! | ||
+ | // Single triangle for normal next, double triangle if also result occurs (result and continue), e.g. where a genus is result, but species in same key. | ||
+ | -->{{ | ||
+ | #if:{{{next}}}|<td class="leadresult leadon"><span class="leadon"> [[#L{{{keyID}}}_{{{parentlead}}}{{{next}}}| ►{{ | ||
+ | #if:{{{resulttext}}}|►}} {{{next}}}]]</span>|<td> | ||
+ | }}</td>{{ | ||
+ | #if:{{{resulttext}}}{{{nested}}}<!-- | ||
+ | // THEN New-Row-For-Results | ||
+ | -->|</tr><tr><!-- | ||
+ | --><td class="leadresult{{#if: {{{next}}} |<!-- no leaderdots if result-something -->{{#if: {{{resulttext}}}{{{commonnames}}} | |<nowiki></nowiki> leadon}}}}" colspan="2"><!-- | ||
− | + | // BACKGROUND OLD/NEW RESULTSTYLE: | |
− | + | // The original ("old") layout interprets result as either free of scientific name | |
− | + | // (and it does not know which is which), and adds the common name in front. | |
− | --> | + | // The new format should be able to either show free-form result text (common/scientific |
− | + | // name may be present, but are not shown) or directly common and scientific name. | |
− | -->< | + | // See also schema at bottom of Template:Lead/doc |
− | + | // TODO: introduce resultformat parameter later (= list of format options, allowing common name or scientific name to be first) | |
− | + | -->{{#if: {{{resulttextoverride}}}<!-- | |
+ | // THEN: Explicit result text override -> ignore commonnames+scientificname, i.e. | ||
+ | -->|{{#if: {{{scientificname}}}|<!-- | ||
+ | // THEN: NEW LAYOUT RULES -> no common names output for resulttextoverride | ||
+ | // ELSE:-> output common names if present: | ||
+ | -->|{{#if: {{{commonnames}}}<!-- | ||
+ | -->|<span class="commonnames"> {{Lead/MakeCommaBreakingList | listtext={{{commonnames}}} }}<!-- | ||
+ | --> –</span><!-- (no additional space after ndash!) | ||
+ | -->}}<!-- | ||
+ | -->}}<!-- // END scientificname | ||
+ | // ELSE: no resulttextoverride, output commonnames for both OLD and NEW LAYOUT | ||
+ | -->|{{#if: {{{commonnames}}}<!-- | ||
+ | -->|<span class="commonnames"> {{Lead/MakeCommaBreakingList | listtext={{{commonnames}}} }}<!-- | ||
+ | // DEBUG: NEXT WAS: {{#if: {{{resulttext}}} | –| }}</span> // CHECK WHETHER OK WITHOUT | ||
+ | --> –</span><!-- (no additional space after ndash!) | ||
+ | -->}}<!-- | ||
+ | // END resulttextoverride: | ||
+ | -->}}<!-- // END NEW/OLD LAYOUT, result itself is identical | ||
− | + | // resulttext = one of resulttextoverride, scientificname, or resultlink itself. | |
− | + | // resulttext and qualifier need white background and (if together <40 char) a common nowrap: | |
− | + | --><span class="leadresults{{#ifexpr:{{#len:{{{resulttext}}}{{{resultqualifier}}} }} < 40|<nowiki> </nowiki>nowrap}}"><!-- | |
− | + | --><span class="leadout{{#ifexpr:{{#len:{{{resulttext}}} }} < 40|<nowiki> </nowiki>nowrap}}"> {{ | |
− | + | #ifeq: {{#sub: {{{resultlink}}}|0|5}}|http:<!-- | |
− | + | // THEN http-link: | |
− | + | -->|[{{{resultlink}}} {{{resulttext}}}]<!-- | |
− | + | // ELSE wiki link or result-text-only (non-link). | |
− | + | -->|{{#if: {{{resultlink}}}<!-- | |
− | + | // THEN | |
− | + | -->|[[{{{resultlink}}}|{{{resulttext}}}]]<!-- | |
− | + | // ELSE unlinked | |
− | + | -->|{{{resulttext}}}<!-- | |
− | + | // END resultlink | |
− | + | -->}}<!-- | |
− | + | // END (if http-link) | |
− | + | -->}}</span><!-- close span.leadout. span.leadresults will be closed after result qualifier! | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | // resultqualifier in all result-layout variants | |
− | + | -->{{#if: {{{resultqualifier}}}<!-- | |
− | -->{{#if: {{{ | + | // THEN (start with wrappable blank, NOT a br-if-image-sidebar present: res.qual. may just be "L.") |
− | + | -->|<nowiki> </nowiki><span class="resultqualifier{{#ifexpr:{{#len:{{{resultqualifier}}} }} < 40|<nowiki> </nowiki>nowrap}}"> {{{resultqualifier}}}</span><!-- | |
− | -->}}<!-- | + | // END (res.qual.) |
+ | -->}}<!-- | ||
+ | // closing span.leadresults = nowrap-span around result+qualif. | ||
+ | --></span><!-- | ||
− | START EXTRA INFO and IMAGES: | + | // NESTED (= pointer to indented subkey with parentlead) in addition to result, all result-layout variants |
− | + | // Note: leadpart2 may be a "*" = forbidden in @id. BUT: some step in mediawiki will convert "*" to ".2A". OK | |
− | + | // Note: leadpart2 could contain a backlink... -> ??? | |
− | + | -->{{#if:{{{nested}}}<!-- | |
− | + | -->|<br /><!-- within-page-link: | |
+ | --><span class="leadon"> [[#L{{{keyID}}}_{{{leadID}}}<!-- | ||
+ | -->{{#ifeq:{{#sub:{{{leadpart2}}}|0|1}}|[<!-- | ||
+ | -->|<!--THEN nothing | ||
+ | -->|<!--ELSE -->{{{leadpart2}}}<!-- | ||
+ | -->}}{{{nested}}}| ▼▼ {{{nested}}}]]</span><!-- | ||
+ | // END if nested: | ||
+ | -->}}<!-- | ||
+ | --></td><!-- | ||
+ | |||
+ | // END New-Row-For-Results | ||
+ | -->}}</tr><!-- | ||
+ | |||
+ | // PART 4. ADDITIONAL = error, detailtext, image gallery m-r | ||
+ | // 4 a) ERROR REPORTING: Any content in 4th and later unnamed parameters is an error. | ||
+ | -->{{#if: {{{errors}}}<!-- | ||
+ | -->|<tr><td class="leaderror" colspan="2">{{{errors}}}</td></tr><!-- | ||
+ | -->}}<!-- | ||
+ | // 4 b) START EXTRA INFO and IMAGES: | ||
+ | // Extra text and images from the optional parameters: detailtext = synonyms + description + | ||
+ | // occurrence + remarks; already combined in outer Lead template! | ||
+ | // Wrappable gallery image m/caption m" to "image r/caption r" output below detailtext | ||
-->{{#if: {{{detailtext}}}{{{image m}}}<!-- | -->{{#if: {{{detailtext}}}{{{image m}}}<!-- | ||
− | + | // THEN | |
− | + | -->|<tr><td class="leadextras" colspan="2"><!-- | |
− | + | --><div class="mw-collapsible mw-collapsed mw-collapsible-content leadextras" id="mw-customcollapsible-L{{{keyID}}}{{{leadID}}}{{#var:decisiontreeAlternative}}row"><!-- | |
− | + | -->{{{detailtext}}}<!-- | |
− | + | -->{{#if: {{{image m}}}<!-- | |
− | + | // THEN at least 1 extra image present, after detailtext or alone: | |
− | + | // 4 c: START Secondary-IMAGE-Gallery | |
− | + | // The nested wrapping table around left-floating tables is necessary, without or with a div | |
− | + | // the images will not be contained in the outer div and the lines not displayed | |
− | + | -->|<table><tr><td>{{ | |
− | + | #if: {{{image m}}}|{{Lead/GalleryItem|image={{{image m}}}|caption={{{caption m}}}|label={{{label m}}}|width={{Pixel2Number|{{{image m width}}}}}|height={{Pixel2Number|{{{image m height}}}}}|lines={{{captionlines}}}}}}}{{ | |
− | + | #if: {{{image n}}}|{{Lead/GalleryItem|image={{{image n}}}|caption={{{caption n}}}|label={{{label n}}}|width={{Pixel2Number|{{{image n width}}}}}|height={{Pixel2Number|{{{image n height}}}}}|lines={{{captionlines}}}}}}}{{ | |
− | + | #if: {{{image o}}}|{{Lead/GalleryItem|image={{{image o}}}|caption={{{caption o}}}|label={{{label o}}}|width={{Pixel2Number|{{{image o width}}}}}|height={{Pixel2Number|{{{image o height}}}}}|lines={{{captionlines}}}}}}}{{ | |
− | + | #if: {{{image p}}}|{{Lead/GalleryItem|image={{{image p}}}|caption={{{caption p}}}|label={{{label p}}}|width={{Pixel2Number|{{{image p width}}}}}|height={{Pixel2Number|{{{image p height}}}}}|lines={{{captionlines}}}}}}}{{ | |
− | + | #if: {{{image q}}}|{{Lead/GalleryItem|image={{{image q}}}|caption={{{caption q}}}|label={{{label q}}}|width={{Pixel2Number|{{{image q width}}}}}|height={{Pixel2Number|{{{image q height}}}}}|lines={{{captionlines}}}}}}}{{ | |
− | + | #if: {{{image r}}}|{{Lead/GalleryItem|image={{{image r}}}|caption={{{caption r}}}|label={{{label r}}}|width={{Pixel2Number|{{{image r width}}}}}|height={{Pixel2Number|{{{image r height}}}}}|lines={{{captionlines}}}}}}}<!-- | |
− | + | --></td></tr><!-- | |
− | + | -->{{#if:{{{imagesfooter}}}<!-- | |
− | --></div></td></tr><!-- | + | -->|<tr><td colspan="10" style="text-align:right; font-size:80%; line-height:1em;">{{{imagesfooter}}}</td></tr><!-- |
− | + | -->}}<!-- | |
− | --> | + | --></table><!-- |
− | + | // END 4 c: END Secondary-IMAGE-Gallery | |
− | + | -->}}</div></td></tr><!-- div = end mw-collapsible | |
+ | // END 4. ADDITIONAL error, detailtext or image gallery (m-r) | ||
+ | -->}}<!-- | ||
+ | // END of "nested" inner table | ||
+ | --></table><!-- | ||
+ | // PART 5: Always-on images (image j/k), non-hide-able image below lead statement and result: | ||
-->{{#if:{{{image j}}}{{{image k}}}<!-- | -->{{#if:{{{image j}}}{{{image k}}}<!-- | ||
− | -->|<table class="nested"><tr style="vertical-align:top;"><td><!-- | + | -->|<table class="nested"><tr style="vertical-align:top;"><td><!-- |
− | -->{{#if: {{{image j}}}<!-- | + | -->{{#if: {{{image j}}}<!-- |
− | -->|<!-- | + | -->|<!-- |
− | --><div style="padding:1em 1em 1em 0;float:left;width:{{#expr: {{Pixel2Number|{{{image j width}}}}}+15}}px;">[[{{Trim| {{{image j}}} }} |none|{{Pixel2Number|{{{image j width}}}}}x{{Pixel2Number|{{{image j height}}}}}px]]<!-- | + | --><div style="padding:1em 1em 1em 0;float:left;width:{{#expr: {{Pixel2Number|{{{image j width}}}}}+15}}px;">[[{{Trim| {{{image j}}} }} |none|{{Pixel2Number|{{{image j width}}}}}x{{Pixel2Number|{{{image j height}}}}}px]]<!-- |
− | -->{{#if: {{{label j}}}|'''{{{label j}}}: '''}}{{{caption j}}}<!-- | + | -->{{#if: {{{label j}}}|'''{{{label j}}}: '''}}{{{caption j}}}<!-- |
--></div><!-- | --></div><!-- | ||
− | -->}}<!-- | + | -->}}<!-- |
− | -->{{#if: {{{image k}}}<!-- | + | -->{{#if: {{{image k}}}<!-- |
− | -->|<!-- | + | -->|<!-- |
− | --><div style="padding:1em 1em 1em 0;float:left;width:{{#expr: {{Pixel2Number|{{{image j width}}}}}+15}}px;">[[{{Trim| {{{image k}}} }} |none|{{Pixel2Number|{{{image k width}}}}}x{{Pixel2Number|{{{image k height}}}}}px]]<!-- | + | --><div style="padding:1em 1em 1em 0;float:left;width:{{#expr: {{Pixel2Number|{{{image j width}}}}}+15}}px;">[[{{Trim| {{{image k}}} }} |none|{{Pixel2Number|{{{image k width}}}}}x{{Pixel2Number|{{{image k height}}}}}px]]<!-- |
− | -->{{#if: {{{label k}}}|'''{{{label k}}}: '''}}{{{caption k}}}<!-- | + | -->{{#if: {{{label k}}}|'''{{{label k}}}: '''}}{{{caption k}}}<!-- |
--></div><!-- | --></div><!-- | ||
-->}}<!-- | -->}}<!-- | ||
− | --></td></tr><!-- | + | --></td></tr><!-- |
− | --></table><!-- | + | --></table><!-- |
− | -->}}<!-- | + | // END PART 5: Always-on images (image j/k) |
− | --></td><td><!-- | + | -->}}<!-- |
− | + | --></td><td><!-- | |
− | + | ||
− | -->{{#if: {{{image a}}}<!-- | + | // PART 6: Right Sidebar Images |
− | + | -->{{#if: {{{image a}}}<!-- at least 1st present (else empty td created): | |
− | + | // Up to 5 images, non-wrapping, always visible but smaller than image m-r | |
− | + | // → image a-e, caption a-e, image a-e width, primary images width and image | |
− | + | // a-e height, primary images height (both for all images) | |
− | THEN-->|<table style="border:none; margin-top:0.1em;margin-left:1em;" | + | // Lead/GalleryItemNoCaption creates td! |
− | + | 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={{Pixel2Number|{{{image a width}}}}}|height={{Pixel2Number|{{{image a height}}}}}}}}}{{ | |
− | + | #if: {{{image b}}}|{{Lead/GalleryItemNoCaption|image={{{image b}}}|caption={{{caption b}}}|label={{{label b}}}|width={{Pixel2Number|{{{image b width}}}}}|height={{Pixel2Number|{{{image b height}}}}}}}}}{{ | |
− | + | #if: {{{image c}}}|{{Lead/GalleryItemNoCaption|image={{{image c}}}|caption={{{caption c}}}|label={{{label c}}}|width={{Pixel2Number|{{{image c width}}}}}|height={{Pixel2Number|{{{image c height}}}}}}}}}{{ | |
− | + | #if: {{{image d}}}|{{Lead/GalleryItemNoCaption|image={{{image d}}}|caption={{{caption d}}}|label={{{label d}}}|width={{Pixel2Number|{{{image d width}}}}}|height={{Pixel2Number|{{{image d height}}}}}}}}}{{ | |
− | + | #if: {{{image e}}}|{{Lead/GalleryItemNoCaption|image={{{image e}}}|caption={{{caption e}}}|label={{{label e}}}|width={{Pixel2Number|{{{image e width}}}}}|height={{Pixel2Number|{{{image e height}}}}}}}}}<!-- | |
− | + | --></tr></table><!-- | |
− | + | // END PART 6: Right Sidebar Images | |
− | }}</td></tr></includeonly> | + | -->}}</td></tr></includeonly> |
Version vom 4. September 2012, 13:55 Uhr
[Erstellen]
Dokumentation der Vorlage