Template:Unit/doc:修订间差异

(merge from official wiki)
 
(merge from official wiki)
 
第1行: 第1行:
<noinclude>[[Category:Module_documentation]]</noinclude><includeonly>{{Lua|Module:Arguments|Module:Unit/List|Module:Tooltip|Module:Tooltip/Types}}
<includeonly>{{template doc page transcluded}}</includeonly><noinclude>{{template doc page viewed directly}}</noinclude>
Documentation for this module may be created at [[Module:Unit/doc]]</includeonly>
   <!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
__NOTOC__
'''Unit''' can be used to create info tooltips or table rows for units.


Implements {{template|Unit}}.{{clear}}
== Parameters ==


<includeonly>[[Category:Modules]]</includeonly>
{| class="wikitable"
! Parameter !! Description !! Required !! Default
|-
| 1 || English localized unit name || '''Required''' || ''none''
|-
| index
| Tooltip index, for tooltip-in-a-tooltip use
* 1, 2, or 3
| ''Optional'' || ''none''
|-
| w || Width of icon, no effect if used with <code>table</code> || ''Optional'' || ''24px''
|-
| table
| Formats output as a table row instead of tooltip, if set to anything
| ''Optional'' || ''none''
|}
 
Parameter 1 must be the proper English localized name of the unit; names that are localized in plural can also be singular (indicated with "(s)"):
{| class="wikitable" style="float:left; margin-right:5px;"
|+ Land units
|-
| Irregular Infantry
| Cannon Artillery
| Hussar(s)
|-
| Line Infantry
| Mobile Artillery
| Dragoon(s)
|-
| Skirmish Infantry
| Shrapnel Artillery
| Cuirassier(s)
|-
| Trench Infantry
| Siege Artillery
| Lancer(s)
|-
| Squad Infantry
| Heavy Tank(s)
| Light Tank(s)
|-
| Mechanized Infantry
|
|
|}
 
{| class="wikitable" style="float:left; margin-right:5px;"
|+ Naval units
|-
| Frigate(s)
| Man-o-War(s)
| Submarine(s)
|-
| Monitor(s)
| Ironclad(s)
| Carrier(s)
|-
| Destroyer(s)
| Dreadnought(s)
|
|-
| Torpedo Boat(s)
| Battleship(s)
|
|-
| Scout Cruiser(s)
|
|
|}
{{clear}}
== Tooltip usage ==
This template can be used in paragraphs by wrapping the paragraph in a <nowiki><div></div></nowiki> or <nowiki><span></span></nowiki> tag, otherwise it breaks the paragraph layout. It can be used in wiki lists or table cells without issue otherwise. If <code>index</code> is not set, this is not necessary.
 
== Table usage ==
This template outputs into the following table format. The template should be put in the first column and it generates the remaining columns for its row.
{| class = "wikitable plainlist"
! Type !! Stats !! Upkeep
|-
| <code>Template goes here</code>
|}
 
Each unit in the table requires its own use of the template in a new row.
 
== Examples ==
<code><nowiki>{{Unit|Irregular Infantry|index=1}}</nowiki></code> results in <div>{{Unit|Irregular Infantry|index=1}}</div>
Note the line break; wrapping the paragraph in <nowiki><span></span></nowiki> results in:
<div><code><nowiki>{{Unit|Irregular Infantry|index=1}}</nowiki></code> results in {{Unit|Irregular Infantry|index=1}}</div>
 
Setting the index to a non-number or a number above 3 prevents a tooltip and sets just a basic icon display:
 
<code><nowiki>{{Unit|Battleships}}</nowiki></code> results in {{Unit|Battleships}}
 
Table usage appears as follows
{| class = "wikitable plainlist"
! Type !! Stats !! Upkeep
|-
| colspan=3 | <code><nowiki>{{Unit|Frigates|table=1}}</nowiki></code> results in
|-
| {{Unit|Frigates|table=1}}
|}

2025年7月9日 (三) 23:12的最新版本

这是Template:Unit的模板文档
当直接浏览时,使用变量可能会失效,请不要使用硬编码来代替页面名或地址。


Unit can be used to create info tooltips or table rows for units.

Parameters

Parameter Description Required Default
1 English localized unit name Required none
index Tooltip index, for tooltip-in-a-tooltip use
  • 1, 2, or 3
Optional none
w Width of icon, no effect if used with table Optional 24px
table Formats output as a table row instead of tooltip, if set to anything Optional none

Parameter 1 must be the proper English localized name of the unit; names that are localized in plural can also be singular (indicated with "(s)"):

Land units
Irregular Infantry Cannon Artillery Hussar(s)
Line Infantry Mobile Artillery Dragoon(s)
Skirmish Infantry Shrapnel Artillery Cuirassier(s)
Trench Infantry Siege Artillery Lancer(s)
Squad Infantry Heavy Tank(s) Light Tank(s)
Mechanized Infantry
Naval units
Frigate(s) Man-o-War(s) Submarine(s)
Monitor(s) Ironclad(s) Carrier(s)
Destroyer(s) Dreadnought(s)
Torpedo Boat(s) Battleship(s)
Scout Cruiser(s)

Tooltip usage

This template can be used in paragraphs by wrapping the paragraph in a <div></div> or <span></span> tag, otherwise it breaks the paragraph layout. It can be used in wiki lists or table cells without issue otherwise. If index is not set, this is not necessary.

Table usage

This template outputs into the following table format. The template should be put in the first column and it generates the remaining columns for its row.

Type Stats Upkeep
Template goes here

Each unit in the table requires its own use of the template in a new row.

Examples

{{Unit|Irregular Infantry|index=1}} results in

Irregular Infantry Irregular Infantry
InfantryIrregular Infantry
Always unlocked

Stats:
Military offense.png 10 Offense
Military defense.png 10 Defense
Military morale.png 15 Morale loss
No upkeep goods
Can upgrade to:
Line Infantry Line InfantrySkirmish Infantry Skirmish InfantryTrench Infantry Trench InfantrySquad Infantry Squad InfantryMechanized Infantry Mechanized Infantry

Note the line break; wrapping the paragraph in <span></span> results in:

{{Unit|Irregular Infantry|index=1}} results in
Irregular Infantry Irregular Infantry
InfantryIrregular Infantry
Always unlocked

Stats:
Military offense.png 10 Offense
Military defense.png 10 Defense
Military morale.png 15 Morale loss
No upkeep goods
Can upgrade to:
Line Infantry Line InfantrySkirmish Infantry Skirmish InfantryTrench Infantry Trench InfantrySquad Infantry Squad InfantryMechanized Infantry Mechanized Infantry

Setting the index to a non-number or a number above 3 prevents a tooltip and sets just a basic icon display:

{{Unit|Battleships}} results in Battleships Battleships

Table usage appears as follows

Type Stats Upkeep
{{Unit|Frigates|table=1}} results in
Frigates Frigates
  • Unlocked by:
    • Navigation Navigation

  • Can upgrade from:
    • None
  • Man-o-Wars 1 Man-o-Wars