Difference between revisions of "Template:Legio Campaign Extract"
m (→Break 2 Structure the output) |
|||
(59 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | |||
{{#vardefine:errcheck|{{#sub:{{#dpl: | {{#vardefine:errcheck|{{#sub:{{#dpl: | ||
|category =Battlereport | |category =Battlereport | ||
|category =Campaign | |category =Campaign | ||
− | |category = | + | |category ={{PAGENAME}} |
|notnamespace=Template | |notnamespace=Template | ||
}}|3|9}}}} | }}|3|9}}}} | ||
− | {{#ifeq:{{#var:errcheck}}|Extension|{{DPL Error Message}}|{{# | + | {{#ifeq:{{#var:errcheck}}|Extension|{{DPL Error Message}}| |
− | | | + | {{#vardefine:ppagename|{{PAGENAME}}}} |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
{{#switch: {{#var:ppagename}} | {{#switch: {{#var:ppagename}} | ||
| Legio I ={{#vardefine:lcel|L-I}} | | Legio I ={{#vardefine:lcel|L-I}} | ||
− | | | + | | Legio III ={{#vardefine:lcel|L-III}} |
− | | | + | | Legio IV ={{#vardefine:lcel|L-IV}} |
− | | | + | | Legio V ={{#vardefine:lcel|L-V}} |
− | | | + | | Legio VI ={{#vardefine:lcel|L-VI}} |
− | | | + | | Legio VII ={{#vardefine:lcel|L-VII}} |
− | | | + | | Legio VIII ={{#vardefine:lcel|L-VIII}} |
− | | | + | | Legio IX ={{#vardefine:lcel|L-IX}} |
− | | | + | | Legio X ={{#vardefine:lcel|L-X}} |
− | | | + | | Legio XII ={{#vardefine:lcel|L-XII}} |
− | | | + | | Legio XIII ={{#vardefine:lcel|L-XIII}} |
− | | | + | | Legio XIV ={{#vardefine:lcel|L-XIV}} |
− | | | + | | Legio XV ={{#vardefine:lcel|L-XV}} |
− | | | + | | Legio XVI ={{#vardefine:lcel|L-XVI}} |
− | | | + | | Legio XVII ={{#vardefine:lcel|L-XVII}} |
− | | | + | | Legio XVIII ={{#vardefine:lcel|L-XVIII}} |
− | | | + | | Legio XIX ={{#vardefine:lcel|L-XIX}} |
− | | | + | | Legio XX ={{#vardefine:lcel|L-XX}} |
− | | | + | | Adeptus Mechanicus ={{#vardefine:lcel|A-MECH}} |
− | + | | Questoris Familia ={{#vardefine:lcel|Q-KNT}} | |
− | + | }}{{#arraydefine:legiocam|{{#dpl: | |
− | {{# | + | |
|category =Battlereport | |category =Battlereport | ||
|category =Campaign | |category =Campaign | ||
− | |category = | + | |category ={{PAGENAME}} |
− | |include={Campaign Honour}:image2,{Battlereport}:date,{armyname}:armyname | + | |include={Campaign Honour}:image2,{Battlereport}:date,{armyname}:armyname,{Battlereport}:victor,#Campaign Summary[200], |
|notnamespace=Template | |notnamespace=Template | ||
|format=,[[%PAGE%]],$ | |format=,[[%PAGE%]],$ | ||
|secseparators=¶¦ | |secseparators=¶¦ | ||
− | }}}} | + | }}|$}} |
− | + | {{{!}} class="wikitable" style="" | |
− | + | {{!!}}Badge | |
− | {{ | + | {{!!}}Date |
+ | {{!!}}Campaign Name | ||
+ | {{!!}}Campaign Summary | ||
+ | {{!!}}Victor | ||
+ | {{!!}}{{PAGENAME}} Participants | ||
+ | {{!-}} | ||
{{#vardefine:cntlegiocam|{{#arraysize:legiocam}}}} | {{#vardefine:cntlegiocam|{{#arraysize:legiocam}}}} | ||
− | + | {{!-}} | |
{{ #vardefine: ilc | 0 }} | {{ #vardefine: ilc | 0 }} | ||
{{ | {{ | ||
#while: | #while: | ||
| {{ #ifexpr: {{ #var: ilc }} < {{#expr:{{#var:cntlegiocam}}-1}} | true }} | | {{ #ifexpr: {{ #var: ilc }} < {{#expr:{{#var:cntlegiocam}}-1}} | true }} | ||
− | |{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|0}} | + | |{{!-}} |
− | {{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}| | + | {{!}}{{#vardefine:tmpimg|{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|1}}}}[[{{#var:tmpimg}}|25px]] |
− | {{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}| | + | {{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|2}} |
− | {{#arraydefine:llegiocam|{{#sub:{{#explode:{{#replace:{{#arrayindex:legiocam|{{#var: ilc}}}}|L|@L}}|{{!}}|3}}|1|{{#len:{{#replace:{{#arrayindex:legiocam|{{#var: ilc}}}}|L|@L}}}}}}|@}} | + | {{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|0}} |
− | {{#vardefine:cntllegiocam|{{#arraysize:llegiocam}}}} | + | {{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|5}}{{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|6}} |
− | {{ #vardefine: ilc2 | 0 }} | + | {{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|4}} |
− | {{ | + | {{#arraydefine:llegiocam|{{#sub:{{#explode:{{#replace:{{#replace:{{#arrayindex:legiocam|{{#var: ilc}}}}|L|@L}}|A|@A}}|{{!}}|3}}|1|{{#len:{{#replace:{{#replace:{{#arrayindex:legiocam|{{#var: ilc}}}}|L|@L}}|A|@A}}}}}}|@}}{{#vardefine:cntllegiocam|{{#arraysize:llegiocam}}}}{{ #vardefine: ilc2 | 0 }}{{!}} |
− | + | {{#while: | |
| {{ #ifexpr: {{ #var: ilc2 }} < {{#var:cntllegiocam}} | true }} | | {{ #ifexpr: {{ #var: ilc2 }} < {{#var:cntllegiocam}} | true }} | ||
|{{#ifeq:{{#var:lcel}}|{{#sub:{{#arrayindex:llegiocam|{{#var: ilc2}}}}|0|{{#expr:{{#len:{{#arrayindex:llegiocam|{{#var: ilc2}}}} }}-5}}}} | |{{#ifeq:{{#var:lcel}}|{{#sub:{{#arrayindex:llegiocam|{{#var: ilc2}}}}|0|{{#expr:{{#len:{{#arrayindex:llegiocam|{{#var: ilc2}}}} }}-5}}}} | ||
− | |{{#arrayindex:llegiocam|{{#var: ilc2}}}}<br> | + | |[[{{#arrayindex:llegiocam|{{#var: ilc2}}}}]]<br>|}} |
− | |}} | + | {{#vardefine: ilc2 | {{ #expr: {{ #var: ilc2 }} + 1 }}}} |
− | + | ||
− | {{ #vardefine: ilc2 | {{ #expr: {{ #var: ilc2 }} + 1 }}}} | + | |
}} | }} | ||
+ | {{!-}} | ||
{{#vardefine: ilc | {{ #expr: {{ #var: ilc }} + 1 }}}} | {{#vardefine: ilc | {{ #expr: {{ #var: ilc }} + 1 }}}} | ||
}} | }} | ||
+ | {{!}}} | ||
+ | }}<noinclude> | ||
− | + | == Example == | |
− | == | + | {{#vardefine:errcheck|{{#sub:{{#dpl: |
+ | |category =Battlereport | ||
+ | |category =Campaign | ||
+ | |category =Legio I | ||
+ | |notnamespace=Template | ||
+ | }}|3|9}}}} | ||
+ | {{#ifeq:{{#var:errcheck}}|Extension|{{DPL Error Message}}| | ||
{{#vardefine:ppagename|Legio I}} | {{#vardefine:ppagename|Legio I}} | ||
{{#switch: {{#var:ppagename}} | {{#switch: {{#var:ppagename}} | ||
| Legio I ={{#vardefine:lcel|L-I}} | | Legio I ={{#vardefine:lcel|L-I}} | ||
− | | | + | | Legio III ={{#vardefine:lcel|L-III}} |
− | | | + | | Legio IV ={{#vardefine:lcel|L-IV}} |
− | | | + | | Legio V ={{#vardefine:lcel|L-V}} |
− | | | + | | Legio VI ={{#vardefine:lcel|L-VI}} |
− | | | + | | Legio VII ={{#vardefine:lcel|L-VII}} |
− | | | + | | Legio VIII ={{#vardefine:lcel|L-VIII}} |
− | | | + | | Legio IX ={{#vardefine:lcel|L-IX}} |
− | | | + | | Legio X ={{#vardefine:lcel|L-X}} |
− | | | + | | Legio XII ={{#vardefine:lcel|L-XII}} |
− | | | + | | Legio XIII ={{#vardefine:lcel|L-XIII}} |
− | | | + | | Legio XIV ={{#vardefine:lcel|L-XIV}} |
− | | | + | | Legio XV ={{#vardefine:lcel|L-XV}} |
− | | | + | | Legio XVI ={{#vardefine:lcel|L-XVI}} |
− | | | + | | Legio XVII ={{#vardefine:lcel|L-XVII}} |
− | | | + | | Legio XVIII ={{#vardefine:lcel|L-XVIII}} |
− | | | + | | Legio XIX ={{#vardefine:lcel|L-XIX}} |
− | | | + | | Legio XX ={{#vardefine:lcel|L-XX}} |
− | | | + | | Adeptus Mechanicus ={{#vardefine:lcel|A-MECH}} |
− | }}{{# | + | }}{{#arraydefine:legiocam|{{#dpl: |
|category =Battlereport | |category =Battlereport | ||
|category =Campaign | |category =Campaign | ||
|category =Legio I | |category =Legio I | ||
− | |include={Campaign Honour}:image2,{Battlereport}:date,{armyname}:armyname | + | |include={Campaign Honour}:image2,{Battlereport}:date,{armyname}:armyname,{Battlereport}:victor,#Campaign Summary[200], |
|notnamespace=Template | |notnamespace=Template | ||
|format=,[[%PAGE%]],$ | |format=,[[%PAGE%]],$ | ||
|secseparators=¶¦ | |secseparators=¶¦ | ||
− | }}}} | + | }}|$}} |
− | {{ | + | {{{!}} class="wikitable" style="" |
+ | {{!!}}Badge | ||
+ | {{!!}}Date | ||
+ | {{!!}}Campaign Name | ||
+ | {{!!}}Campaign Summary | ||
+ | {{!!}}Victor | ||
+ | {{!!}}Legio I Participants | ||
+ | {{!-}} | ||
{{#vardefine:cntlegiocam|{{#arraysize:legiocam}}}} | {{#vardefine:cntlegiocam|{{#arraysize:legiocam}}}} | ||
− | { | + | {{!-}} |
− | + | ||
{{ #vardefine: ilc | 0 }} | {{ #vardefine: ilc | 0 }} | ||
{{ | {{ | ||
Line 116: | Line 124: | ||
| {{ #ifexpr: {{ #var: ilc }} < {{#expr:{{#var:cntlegiocam}}-1}} | true }} | | {{ #ifexpr: {{ #var: ilc }} < {{#expr:{{#var:cntlegiocam}}-1}} | true }} | ||
|{{!-}} | |{{!-}} | ||
− | {{!}}{{#vardefine:tmpimg|{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|1}}}}[[{{#var:tmpimg}}| | + | {{!}}{{#vardefine:tmpimg|{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|1}}}}[[{{#var:tmpimg}}|25px]] |
{{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|2}} | {{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|2}} | ||
{{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|0}} | {{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|0}} | ||
− | {{#arraydefine:llegiocam|{{#sub:{{#explode:{{#replace:{{#arrayindex:legiocam|{{#var: ilc}}}}|L|@L}}|{{!}}|3}}|1|{{#len:{{#replace:{{#arrayindex:legiocam|{{#var: ilc}}}}|L|@L}}}}}}|@}}{{#vardefine:cntllegiocam|{{#arraysize:llegiocam}}}}{{ #vardefine: ilc2 | 0 }}{{!}} | + | {{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|5}}{{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|6}} |
+ | {{!}}{{#explode:{{#arrayindex:legiocam|{{#var: ilc}}}}|{{!}}|4}} | ||
+ | {{#arraydefine:llegiocam|{{#sub:{{#explode:{{#replace:{{#replace:{{#arrayindex:legiocam|{{#var: ilc}}}}|L|@L}}|A|@A}}|{{!}}|3}}|1|{{#len:{{#replace:{{#replace:{{#arrayindex:legiocam|{{#var: ilc}}}}|L|@L}}|A|@A}}}}}}|@}}{{#vardefine:cntllegiocam|{{#arraysize:llegiocam}}}}{{ #vardefine: ilc2 | 0 }}{{!}} | ||
{{#while: | {{#while: | ||
| {{ #ifexpr: {{ #var: ilc2 }} < {{#var:cntllegiocam}} | true }} | | {{ #ifexpr: {{ #var: ilc2 }} < {{#var:cntllegiocam}} | true }} | ||
|{{#ifeq:{{#var:lcel}}|{{#sub:{{#arrayindex:llegiocam|{{#var: ilc2}}}}|0|{{#expr:{{#len:{{#arrayindex:llegiocam|{{#var: ilc2}}}} }}-5}}}} | |{{#ifeq:{{#var:lcel}}|{{#sub:{{#arrayindex:llegiocam|{{#var: ilc2}}}}|0|{{#expr:{{#len:{{#arrayindex:llegiocam|{{#var: ilc2}}}} }}-5}}}} | ||
− | | | + | |[[{{#arrayindex:llegiocam|{{#var: ilc2}}}}]]<br>|}} |
{{#vardefine: ilc2 | {{ #expr: {{ #var: ilc2 }} + 1 }}}} | {{#vardefine: ilc2 | {{ #expr: {{ #var: ilc2 }} + 1 }}}} | ||
}} | }} | ||
Line 129: | Line 139: | ||
{{#vardefine: ilc | {{ #expr: {{ #var: ilc }} + 1 }}}} | {{#vardefine: ilc | {{ #expr: {{ #var: ilc }} + 1 }}}} | ||
}} | }} | ||
− | |} | + | {{!}}} |
+ | }} | ||
+ | |||
+ | ==Explanation== | ||
+ | * First DPL simple extracts to confirm there is data to extract if this fails the errcheck variable is set to "Extension", the first part of the default DPL error message. If this does = Extension the custom error message is displayed. | ||
+ | * The variable "ppagename" is then set to the current pagename | ||
+ | * The switch statement then works out the front half of the Army code dependent on the current page name, this is set to "LceI" variable for use later. | ||
+ | * Raw data is extracted using standard DPL and set to an array, splitting on the $ that was ended at the end of each unique string | ||
+ | * Table headings are then set {{!!}}=!, {{!}}=| and {{!-}}=|-. | ||
+ | * Total number of unique values in the array are then set to "cntlegiocam" | ||
+ | * while loop counter then set and while loop started | ||
+ | * Initial data is then looped out using explode on the | character for each value. Due to the way data is stored the Summary ends up split into two seperate chunks and has to be recombined back together around a | or in this case {{!}} - Values 5 and 6 in the string. | ||
+ | * Value 3 is the tricky value as it's a flat string of army designations eg L-I-3456L-IV-9876L-XIX-7886A-MECH-1276 This string has a double replace run over it using L and A as the replace keys and replacing them with @L and @A respectively this is all fed into a new array "llegiocam" | ||
+ | * "llegiocam" is then looped through and only those army designations matching "lcel" are outputted - theres a bit of messing around with substrings to perform this matching. | ||
+ | </noinclude> |
Latest revision as of 03:53, 1 May 2019
Imperial Search....No Result
Contents
Example
Badge | Date | Campaign Name | Campaign Summary | Victor | Legio I Participants |
---|---|---|---|---|---|
Ashes of Pyre |
Excerpt from The Horus Heresy: Famous Campaigns and notable battles by Reginald Archibald III, Official Remembrancer. Most Imperial historians are in agreement that the campaign by Loyalist ..→ |
||||
Battle for Kenuc |
Baatle for Kenuc system started on Kenuc Alpha, with several skirmish around a manufactorium, that process a crystals. Several Legions have stop at various times to collect cargo from several ..→ |
||||
Baylonian Insurrection |
PreludeEven before the shocking actions of Istvaan filtered through to the Australis Ultima Sector, the situation in the Oteal System had degenerated to dangerous levels. Rumours of military ..→ |
||||
Breaking of Centrumeh Gate |
Prelude to WarWhile a number of Houses and at least one Company are known to have accumulated a great deal of wealth (enough to even purchase a new frontier Knight World) the final ..→ |
||||
Northern Front - Battle of Eglurn System |
The Eglurn System is on the outer reaches of the Cambrius Sub-Sector. Like most the systems within the sub sector they have attempted to remain neutral in the conflict to maxmimise profits, ..→ |
||||
Second Compliance of Corabie |
The Second Compliance of Corabie With the arrival of the Imperial forces through the Warp Storm rimward, so to came the knowledge of the Warmasters Heresy and the civil war burning through ..→ |
||||
The Battle For Zereous |
The Secrets of Vosculia 041.010.M31 War ravages across the Eglurn system as the forces of the Traitor Horus seek to expel their Loyal cousins from the system. Those brothers loyal to the ..→ |
||||
790.008.M31 | The Burning of Scandus Prime |
The Emperors dreams and hope are in ruin, his trust proved false, and his brightest son fallen to darkness. These are bitter times as nightmares are made flesh and the Empire is thorn asunder as ..→ |
Unresolved | ||
The Liberation of Fuschal |
Prelude to WarWhen compared to the scale of the civil war, or even to the chaos rolling back and forth across the Kaerimon Sub-Sector, the battle to reclaim the Fuschal System from the grasp ..→ |
||||
The Lincon Heresy |
In the wake of Horus' treachery on Istvaan III and the galaxy plunged into civil war, confusion and panic spreads along the whole Beneheventian Sub-Sector. With the ragtag survivors of the drop site ..→ |
||||
The Rallying of Trugoy |
ProloguesThe Warmasters great betrayal is announced to the galaxy with the bloody brutal shattering of the loyalist legions at Istvaan IV. The unthinkable has become reality, brother fights ..→ |
||||
The Second Golloch War |
Prelude to WarThe Golloch Cluster is a nebulous region of space containing thousands of stars, and hundreds of habitable worlds. Including over fifty primary level Imperial worlds of post ..→ |
||||
The Tomb of Galahad |
Prelude to WarSometime before the Heresy erupted throughout the Imperium, Crusade Fleet 1574 was recorded to have refitted and prepared for deep space travel at the Savage Naval Yards in the ..→ |
Explanation
- First DPL simple extracts to confirm there is data to extract if this fails the errcheck variable is set to "Extension", the first part of the default DPL error message. If this does = Extension the custom error message is displayed.
- The variable "ppagename" is then set to the current pagename
- The switch statement then works out the front half of the Army code dependent on the current page name, this is set to "LceI" variable for use later.
- Raw data is extracted using standard DPL and set to an array, splitting on the $ that was ended at the end of each unique string
- Table headings are then set !=!, |=| and |-=|-.
- Total number of unique values in the array are then set to "cntlegiocam"
- while loop counter then set and while loop started
- Initial data is then looped out using explode on the | character for each value. Due to the way data is stored the Summary ends up split into two seperate chunks and has to be recombined back together around a | or in this case | - Values 5 and 6 in the string.
- Value 3 is the tricky value as it's a flat string of army designations eg L-I-3456L-IV-9876L-XIX-7886A-MECH-1276 This string has a double replace run over it using L and A as the replace keys and replacing them with @L and @A respectively this is all fed into a new array "llegiocam"
- "llegiocam" is then looped through and only those army designations matching "lcel" are outputted - theres a bit of messing around with substrings to perform this matching.