Vorlage:Lead/SplitNumberV2
Aus Bayernflora
IMPORTANT: THIS TEMPLATE IS NOT USED, the algoritm is implemented directly into Template:Lead.
However, IT SHOULD NOT BE DELETED. It is useful for reference and to test new enhancements!
This template splits the parts of a Lead identifier. Examples are: “12 (2)” or "1*" or "1-". This lead identifier may combine:
- the couplet id common to all leads of a couplet “12”
- the part identifying the alternative leads within a couplet:"*"”
- and the "coming-from couplet or lead-id", called the backlink: “(2)”
The splitting is designed for the following cases:
- Number plus backlink in round parenthesis ("10 (2)")
- Number plus characters used to distinguish multiple leads in a couplet (like "2, 2*, 2**", "2, 2', 2", ): Return 2 + *, etc.
- Note: unformatted apostrophe is converted to formatted apostrophe
- Number plus hyphen or ndash, like "2, 2-" (in contrast to the previous SplitNumber version, this now works exactly like with *)!
- Note: hyphen is converted to n-dash
- Number plus certain letter (for couplets with MANY leads), like "2 a, 2 b, 2 c"): Return 2 + a, etc.
- Note: in this case, a blank must be present between the number and the letter. "1b" will not work!
It is intended to be used in combination with Template: Lead.
The present implementation returns a semicolon-separated list of "before backlink", couplet id, alternative id and backlink.
In contrast to Lead/SplitNumber (the first version) this no longer handles:
- the display issues of the "1-"-case, where in the first lead ("1", "2" etc.) normally the "1", "2" are shown, but in the second lead ("1-", "2-" etc.) the number is REPLACED by the "-", rather than normally both being shown.
USAGE examples
- 123: actual = "123 + 123"; expected = "123 +"
- 123 (22): actual = "123 + (22)"; expected = "123 + (22)" -- full list is: 123$123$123$22
- 123*: actual = "123 + *"; expected = "123 + *"
- 123**: actual = "123 + **"; expected = "123 + **"
- 123***: actual = "123 + ***"; expected = "123 + ***"
- 123-: actual = "123 + –"; expected = "123 + –"
- 123': actual = "123 + ’"; expected = "123 + ’"
- 123’’: actual = "123 + ’’"; expected = "123 + ’’"
- 123 a: actual = "123 + a"; expected = "123 + a"
- 123a: actual = "123a + 123a"; expected = "123a + (EMPTY)" -- It is known that this does not work without a blank!
- Extra test with all parts returned: "123&#$123&#$123&#$2; (2" should result in: "123*$123$*$2".
- DEBUG NOTE: no longer handled in this template, needs to be done outside: SPECIAL HANDLING: lead number IS SUPPRESSED and the hyphen/dash swapped in. Note: Tried to replace hyphen with n-dash, plus the rest after it, but did not work: {{#replace: {{#sub:{{#var: leadIDMain}} |{{#pos:{{#var: leadIDMain}}|-}} |-|–}} }} So very simple instead just output – rather than replacing!
{{{1}}}${{{1}}}${{{1}}}$