模板:Military navigation/sandbox
![]() | 这是Template:Military navigation(差异)的沙盒。 参见本模板的测试样例。 |
![]() | 此模板沙盒被引用于约7,200个页面。 为了避免造成大规模的影响,所有对此模板沙盒的编辑应先于沙盒、测试样例或您的沙盒上测试。 测试后无误的版本可以一次性地加入此模板沙盒中,但是修改前请务必于讨论页发起讨论。 模板引用数量会自动更新。 |
![]() | 此模板使用Lua语言: |
模板介绍
[编辑]The various navigation templates maintained by the Military history WikiProject are all intended to be implemented through a single base template, which combines the project's common template style with the standard navigation box format. This is needed primarily to allow multiple such templates to be stacked together—with each other, or with infobox templates—to present the appearance of a continuous block; it is also beneficial for providing a consistent appearance to the entire set of articles within our scope.
参数及使用方法
[编辑]Any military-related navigational template should be created using the {{military navigation}} base template, as shown below:
{{military navigation | name = | title = | listclass = | style = | state = | image = | imageleft = | odd_color = | even_color = | above = | group1 = | list1 = | group2 = | list2 = | group3 = | list3 = ... | group15 = | list15 = | below = }}
- name
- The actual page name (i.e. "XYZ" for Template:XYZ) of the newly-created template.
- title
- The displayed title of the navigation box.
- listclass
- Optional – but typically
hlist
, to format content as horizontal lists. In the case of hlists in above or below fields, set bodyclass=hlist, instead. - style
- Optional – an alternative style for the template; this may be set to "wide" to produce a full-width box. The alternative style should be used sparingly; it is intended that the majority of navigational templates will use the default style (in the wild, "wide" has become quite common). The above example template formatted with
style=wide
is shown below:
|
- state
- Optional – may be set to "collapsed" to force the template to render in its closed state by default.
- odd_color/even_color
- Optional – the stripe colors for alternating listN items to use. These parameters should be used sparingly; in the absence of a good reason to do otherwise, templates should use the default stripe colors.
- groupN/listN
- The body of the navigation box, consisting of successive horizontal blocks of content (the listN fields) with optional labels (the corresponding groupN fields). Please see the documentation for {{navbox}} for more details on the different layouts possible.
- above
- Optional – the sub-header of the navigation box; please see the documentation for {{navbox}} for more details on the resulting layout when this is used.
- below
- Optional – the footer of the navigation box; please see the documentation for {{navbox}} for more details on the resulting layout when this is used.
- image
- Optional – an image to be displayed at the right of the box, given in the form
[[Image:Example.jpg|100px]]
. This parameter should be used sparingly, and typically only in conjunction with the full-width template style. - imageleft
- Optional – an image to be displayed at the left of the box, given in the form
[[Image:Example.jpg|100px]]
. This parameter should be used sparingly, and typically only in conjunction with the full-width template style.
范例
[编辑]注意事项
[编辑]There are several known issues with the current navigation template design that editors should be aware of:
- Bunched-up edit links
- If several infoboxes or navigation templates are stacked along the right margin of an article, the [edit] links of nearby sections may be moved to unexpected positions. A number of workarounds exist; full details are available on the linked page.
- Shifted header wrapping
- A long header used in a narrow navigation template may wrap incorrectly, with the second line being indented further than necessary. A workaround is possible by adding a
<br />
tag between the words where the wrapping is to occur. This should be done to separate link-text to the right of the 'pipe' (|
), as follows:[[Article title|Article <br /> title]]
. An alternative method is to use {{allow wrap}} for the link-text as follows:[[A very long article title|{{allow wrap|A very long article title}}]]
, which allows the browser to break as-needed. - Stretching or overflowed boxes
- A very long header formatted as a single link may cause a template to stretch beyond its normal width, or the whole link to extend off too far to the right. A workaround is possible by breaking the header onto multiple lines, as shown above.
追踪模板
[编辑]给模板编辑者的说明
[编辑]模板结构
[编辑]实现方法
[编辑]编辑注意
[编辑]上述文档嵌入自Template:Military navigation/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (编辑 | 差异)和测试样例 (编辑)页面进行实验。 请在/doc子页面中添加分类。本模板的子页面。 |