Difference between revisions of "Vorlage:Lead"

From FloraWiki - das Wiki zur Schweizer Flora
Jump to: navigation, search
m (floristic zones: fix (…); → …;)
m (fix {{#var: separatorOfPreviousParameter}})
Line 114: Line 114:
 
  #if: {{{occurrence|}}} |{{#var: separatorOfPreviousParameter}}{{#vardefine: separatorOfPreviousParameter|;}} <span class="occurrence">{{{occurrence}}}</span>
 
  #if: {{{occurrence|}}} |{{#var: separatorOfPreviousParameter}}{{#vardefine: separatorOfPreviousParameter|;}} <span class="occurrence">{{{occurrence}}}</span>
 
}}{{
 
}}{{
  #if: {{{occurrence ecology typo|}}} |{{#vardefine: separatorOfPreviousParameter|;}}&#32;<span class="occurrence-ecology-typo">{{{occurrence ecology typo}}}</span>
+
  #if: {{{occurrence ecology typo|}}} |{{#var: separatorOfPreviousParameter}}{{#vardefine: separatorOfPreviousParameter|;}}&#32;<span class="occurrence-ecology-typo">{{{occurrence ecology typo}}}</span>
 
}}{{
 
}}{{
 
  #if: {{{occurrence ecology values|}}} |{{#var: separatorOfPreviousParameter}}{{#vardefine: separatorOfPreviousParameter|;}} <span class="occurrence-ecology-values">{{{occurrence ecology values}}}</span>
 
  #if: {{{occurrence ecology values|}}} |{{#var: separatorOfPreviousParameter}}{{#vardefine: separatorOfPreviousParameter|;}} <span class="occurrence-ecology-values">{{{occurrence ecology values}}}</span>
Line 122: Line 122:
 
  #if: {{{floristic regions|}}} |{{#var: separatorOfPreviousParameter}}{{#vardefine: separatorOfPreviousParameter|;}} <span class="floristic-regions">{{{floristic regions}}}</span>
 
  #if: {{{floristic regions|}}} |{{#var: separatorOfPreviousParameter}}{{#vardefine: separatorOfPreviousParameter|;}} <span class="floristic-regions">{{{floristic regions}}}</span>
 
}} -->{{
 
}} -->{{
  #if: {{{floristic zones|}}} |{{#vardefine: separatorOfPreviousParameter|;}} <span class="floristic-zones">{{{floristic zones}}}</span>
+
  #if: {{{floristic zones|}}} |{{#var: separatorOfPreviousParameter}}{{#vardefine: separatorOfPreviousParameter|;}} <span class="floristic-zones">{{{floristic zones}}}</span>
 
}}{{
 
}}{{
 
  #if: {{{xenophyte|}}} |{{#var: separatorOfPreviousParameter}}{{#vardefine: separatorOfPreviousParameter|;}} <span class="xenophyte">{{{xenophyte}}}</span>
 
  #if: {{{xenophyte|}}} |{{#var: separatorOfPreviousParameter}}{{#vardefine: separatorOfPreviousParameter|;}} <span class="xenophyte">{{{xenophyte}}}</span>

Revision as of 20:04, 11 July 2016

[Bearbeiten] [Aktualisieren] Template-info.svg Dokumentation der Vorlage

See Key Start for the main documentation.

Changes in recent versions

(The main documentation for all parts of the single-access key is under Template:Key Start/doc!)

Version 3.11.

added parameters:

  • life form=list of life forms
  • occurrence ecology typo=, occurrence ecology values=, plant sociology
  • presence territory=
  • result id list=list of ids presently <span> tags that are styled by CSS
  • references=
  • toxicity= (temporarily at display:none 2017-08-07)
  • xenophyte=
  • floristic regions= use floristic zones=

added comment parameters:

  • altitudinal zone comment=, flowering period comment, plant height comment=

Version 3.10.

added parameters for plant details:

  • plant height formula min-from-to-max-unit=formula or generally as complete string: plant height=
    (case: size for plants only)
  • flowering period formula min-from-to-max=formula or generally as complete string: flowering period=
  • altitudinal zone formula min-from-to-max=formula or generally as complete string: altitudinal zones=
  • occurrence status=
  • floristic regions=
  • floristic zones=
  • organism size formula min-from-to-max-unit=formula or generally as complete string: organism size=
    (case: general size, if it's not clear what was meant whether height or length or width)

Version 3.9.

  • comments changed, partly refactored
  • removed the br in front of the resultqualifier if sidebar image a etc. present
  • result layout variants better integrated to save memory
  • general minor optimizations
  • next-lead-pointer (number on right side) now always in same row as statement, even if results are also present

Version 3.8.

  • moved from own jKey-collapsible mechanism to MediaWiki’s mw-customcollapsible
  • introduced scientificname and new rules of the result-layout
  • saving properties for commonnames, scientificname, synonyms

Version 3.7.

Length estimate based on resulttext instead of resultlink (for empty result!!!)

Previous changes:

  • nested works now on parents with backlinks and alternatives (1 and 1*, 1 and 1'). 1 and 1- NEEDS TESTING!
  • result text+ empty result supported (non-linking result).
  • nowrap on result/qualifier reworked!
  • result=http:... now works.
  • Nested subkey ok. Resultqualifier no longer in ()
Version 3.3:
  • added scientific name and new layout for result
Version 3.2:
  • Added error category: Category:Internal - Error in Lead template
  • removed: resultlink
  • resulttext deprecated, "result text" is preferred!
  • resultqualifier deprecated, "result qualifier" is preferred!
  • common names allowed (and should perhaps be preferred over commonnames! -- TODO: also allow common names in Key Start

Older version changes:

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 "result qualifier=" 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.

Additional- and subtemplates, dependencies

Lead
 ├ Lead/SplitNumberLead/InnerLead/docLead/GalleryItemLead/GalleryItemNoCaption
 + Template: StripFormatting to get just text
 + Template: Pixel2Number eg. 300px → 300
 + {{Lead/Formfield occurrence status}} (German terms)

CSS

See MediaWiki:Common.css section “Decisiontree and Lead templates”. Display of ids in parameter result list ids:

/* Template:Lead show or hide result ids via CSS. <span> tags should have no space in between */
span.result-id-list span.show::before { content: attr(data-prefix) " "}
span.result-id-list span.show ~ span.show::before { content: ", " attr(data-prefix) " "}
span.result-id-list span.hide { display: none}

Technical Documentation

Parameters

Statements and next IDs

This can be given simply with 3 unnamed parameters (those not starting with a "fieldname=" construction, unless an equal sign (=) is contained in the value text!). Example: {{Lead| 2| statement text| 34}}. Those unnamed parameters are, in order:

1= 
couplet ID (can be unnamed/unspecified unless an equal sign is present in the text)
2= 
lead statement (can be unnamed/unspecified unless an equal sign is present in the text)
3= 
next couplet ID (can be unnamed/unspecified unless an equal sign is present in the text)

Any further unnamed parameter will be reported as an error. Note also, that if the statement contains an equal sign ("="), it cannot be used with an unnamed parameter. In this case, use "{{Lead|1=30| 2=statement text (=the lead text)| 3=34}}"

Media

Primary Large Primary Collapsed
(small at right column) (large, below text & details) (below text & details)
image a= to image e= 
up to 5 images as primary media
caption a= to caption e= 
up to 5 captions of primary media
label a= to label e=
a letter or number, placed in the lower right corner over the image, allowing the image to be referred to from the main lead text.
primary images width= 
(default: 80)
primary images height= 
(default: 80), preserving aspect ratio
image a height= to image e height=
(default: value of primary images height=)
image a width= to image e width= 
(default: value of primary images width=)
image j= to image k= 
up to 2 images as large primary media
caption j= to caption k= 
up to 2 captions of large primary media
label j= to label k=
a letter or number, placed in the lower right corner over the image, allowing the image to be referred to from the main lead text.
image j height= to image k height=
(default: 400)
image j width= to image k width= 
(default: 600)
image m= to image r= 
up to 6 images as collapsed media. The caption will be displayed full readable.
caption m= to caption r= 
up to 6 captions of collapsed media
label m= to label r=
a letter or number, placed in the lower right corner over the image, allowing the image to be referred to from the main lead text.
image m height= to image r height=
(default: value of extra images height=)
image m width= to image r width= 
(default: value of extra images width=)
extra images width=
(default: 200) like primary images width, but for “image m” to “image r”
extra images height=
(default: 200) like primary images height, preserving aspect ratio
captionlines= 
(default: 3) due to the way image m to image r can wrap to the available space, the space for all captions together must be fixed. If undesired scrollbars appear within the caption area of some images, set captionlines to a value larger than 2
imagesfooter=
a free from text displayed below all images together.


Results

common names=
(as comma separated list) The common name(s) of an organism, in cases where you want to link using the scientific name.
scientific name=
scientific name and common names will replace result in the future, so prefer common and scientific name instead of using result; result text= can be used to format it differently
synonyms= scientific name synonyms=
(as semicolon list) scientific synonym names
result=
formatted text, which will – after unformatting – also be used as the link target for the result. Example: “''Aus bus'' var. ''xus''” will display as “Aus bus var. xus” and link to “Aus bus var. xus” (i.e. without the formatting apostrophes).
result text=
text to be displayed (overrides the other result parameters). If result= is missing, no link will be generated. If both are present, result= defines the link target, result text the display text. Thus, only using result= is a shortcut, defining both as the same.
result qualifier=
an additional text appearing after results, but not becoming part of the link. Where the result is given as a common name, this may contain the scientific name, or it may contain the scientific author names. In other cases it may contain stage “(2nd instar)”, sex “(♀♀)”, or variety “(white form)” information. In many cases, adding brackets “()” will be desirable.

Details

For order of appearance see section HTML Structure.

General text details (not handled by other detail parameters)

description=
free text, additional description
occurrence=
free text, geographic or habitat/ecological distribution. The information will be presently simply appended to the description, but this may be changed later on.
remarks=
free text for additional remarks, including historic or current uses by humans, clues to help to memorize characteristics of the organism, etc. The information will be presently simply appended to the description, but this may be changed later on.

Additionally specific parameters in order of appearance:

If parameter plant height= and its detail-variants are not applicable, than you can use instead the rather general „organism size“:

organism size= 
the whole organism sizes, e.g. "(5-)10-20 cm". Either this as a whole string or in detail as formula:
organism size formula min-from-to-max-unit= 
(formula) example “NA/12/30/90/cm” or “/12/30//cm”. The formula must always be complete, i.e. 5 positions separated by “/”. NA means not available.
organism size comment= 
free text comment
life form= 
life form after FI or Nyffeler[1]

Plant height:

plant height= 
the whole plant heights, e.g. "(5-)10-20 cm". Either this as a whole string or in detail as follows:
plant height formula min-from-to-max-unit= 
(formula) example “NA/12/30/90/cm” or “/12/30//cm”. The formula must always be complete, i.e. 5 positions separated by “/”. NA means not available.
plant height comment= 
free text comment
flowering period= 
(string), as complete string e.g. "1-2" or "II-IV" or as formula:
flowering period formula min-from-to-max= 
(formula), example “1/3/4/NA” or “1/3/4/”. The formula must always be complete, i.e. 4 positions separated by “/”. NA means not available.
altitudinal zones= 
(string), as a complete string e.g. "(montan-)subalpin-alpin" or as formula:
altitudinal zone formula min-from-to-max-unit= 
(formula), example “montan/subalpin/alpin/NA” or “montan/subalpin/alpin/”. The formula must always be complete, i.e. 4 positions separated by “/”. NA means not available.
altitudinal zone comment= 
free text comment
occurrence= 
free text
occurrence status= 
status of naturalness (natural, weed, etc.) see also http://terms.tdwg.org/wiki/dwc:occurrenceStatus or discussion at Offene Naturführer
occurrence ecology typo= 
phytosociology
occurrence ecology values= 
based on FI/FH and reviewed by AGY[2]
presence territory= 
absence of taxon on the territory (allowed values: no value=present, X = absent, ? = doubtful)
floristic zones= 
(string), e.g. "submeridional" or a comma separated list
toxicity= 
class of toxicity of a taxon according to Flora Helvetica (+, ++, +++)
result id list= 
list of tagged result ids (without blanks in between). To make some ids visible and others not, it is proposed to wrap the id in a <span> tag and style the display via CSS classes “show” or “hide”:
<span class="show" data-term="florahelvetica_id" data-prefix="FH">2013479</span> is shown and data-prefix="FH" will prefix the value, so “FH 2013479” is shown. However, <span class="hide" data-term="infoflora_id" data-prefix="infoflora">2013479</span> will not be shown because CSS class "hide" here is defined in MediaWiki:Common.css with "display:none". The attribute data-term corresponds to the data column in the original data matrix
remarks= 
free text
references= 
free text


Nested sub-keys within a couplet

In a usual couplet a nested couplet can be used, e.g. for sub species

nested=
what is the next identifier for a sub-key? (e.g. “a”). This must be given only at the starting point where you want to start a nested-key
parentlead=
the parent lead identifier, all the nested statements are pointing to. For instance if we started a nested sub-key at “5*”, this value must be given as parentlead=5*

Example:

{{Lead | 5* | statement text | nested = a}}
{{Lead | parentlead = 5* | …  | f}}
{{Lead | a-parentlead = 5* | …  | b}}
{{Lead | parentlead = 5* | …  | c}}
{{Lead | b-parentlead = 5* | …  | d}}

Sectioning

subheading=
A heading that can be interspersed into a key; it will be displayed in in front of the couplet (it should always be used in the first lead of a couplet) for which it is designed.
subheadingstyle=
either a set of css definitions, or one of the following symbolic styles: orange, green, bigorange oderbiggreensimple (=no background)

Parameter that are not evaluated

The following parameter shall be kept in the template but are not evaluated at all. They are needed for a re-export:

  • taxon treatment hidden comment=
  • map comment=

HTML Structure

Lead/Inner produces a table row with 6 <td>

Legend:
tr#something → id="something"
td.something → class="something"
{something}  → {{{something}}}
[something]  → optional
‹1-2›        → colspan

┌ tr#L{keyID}_{leadID}_{decisiontreeAlternative}_row ───────────────────┐
│  [td] ┬ if {parentlead}                                               │
│  [td] ┘                                                               │
│  td.dt-nodeid                                                         │
└───────────────────────────────────────────────────────────────────────┘

┌ tr.dt-subheading ─────────────────────────────────────────────────────┐
└───────────────────────────────────────────────────────────────────────┘

┌  tr.dt-row#L{keyID}_{leadID}_row ─────────────────────────────────────┐
│   [td] ┬ if {parentlead}                                              │
│   [td] ┘                                                              │
│   td.dt-nodeid#L{keyID}_{leadID}                                      │
│   td.leadalt                                                          │
│ ┌ td.lead-row1 ─────────────────────────────────────────────────────┐ │
│ │  table.nested                                                     │ │
│ │  ├ tr                                                             │ │
│ │  │  td.leadtext span.leadspan                                     │ │   │   │ ► │
│ │  │  [td.leadresult span.leadon]                                   │ │   
│ │  ├ tr                                                             │ │
│ │  │  td.leadresult                                                 │ │   │       │
│ │  │     span.commonnames                                           │ │
│ │  │     span.leadresults                                           │ │
│ │  │       span.leadout                                             │ │
│ │  │       span.resultqualifier                                     │ │
│ │  │     span.leadon                                                │ │
│ │  ├ tr                                                             │ │
│ │  │  th.leaderror                                                  │ │   │       │
│ │  └ tr                                                             │ │
│ │     td.leadextras                                                 │ │   │       │
│ │       div.leadextras[.mw-collapsible]                             │ │
│ │         span.synonmys                                             │ │
│ │         span.description                                          │ │
│ │         span.organism-size                                        │ │
│ │         span.life-form                                            │ │
│ │         span.plant-height                                         │ │
│ │         span.flowering-period                                     │ │
│ │         span.altitudinal-zones                                    │ │
│ │         span.description                                          │ │
│ │         span.occurrence-status                                    │ │
│ │         span.occurrence                                           │ │
│ │         span.occurrence-ecology-typo                              │ │
│ │         span.occurrence-ecology-values                            │ │
│ │         span.presence-territory                                   │ │
│ │         span.floristic-zones                                      │ │
│ │         span.xenophyte                                            │ │
│ │         span.toxicity                                             │ │
│ │         span.result-id-list                                       │ │
│ │         span.remarks                                              │ │
│ │         span.references                                           │ │
│ │         table                                                     │ │
│ │          tr                                                       │ │
│ │           table (containing image m,n,o,p,q,r) → Lead/GalleryItem │ │
│ │  table.nested                                                     │ │
│ │  └ tr                                                             │ │
│ │     td                                                            │ │
│ │       div (float:left) image j,k                                  │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│   td                                                                  │
│    table                                                              │
│    tr                                                                 │
│      td (containing image a,b,c,d,e) → Lead/GalleryItemNoCaption      │
│        div.overlaywrapper                                             │
│          div.overlaylabel                                             │
└───────────────────────────────────────────────────────────────────────┘   

Notes:

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

2. 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).

3. Temporarily, the template supports two versions for formatting results, depending on whether Scientific Name is present (new) or not (old). If most keys have a scientific name, then the old version may be dropped. Please attempt to create all new keys for the new format!

 ############### NEW OLD RESULT layout rules: ####################
 // ? scientificname
 // yes: (new layout format)
 //    ? resulttext
 //    yes: resulttext [, resultlink] [, next]
 //    no :
 //        ? commonnames
 //        yes: commonnames - scientificname [, next]
 //        no : scientificname [, next]
 // no : (old layout)
 //    ? commonnames
 //    yes: commonnames
 //        ? resulttext
 //        yes: commonnames - resulttext [, resultlink] [, next]
 //        no : commonnames [, next]
 // Note: [, next] can appear in all layout variants
 ############################################################


  1. please add any literature, reference that
  2. please add any literature, reference to that