Templat:Custom rule/dok

Dari Wikisource bahasa Indonesia, perpustakaan bebas
Loncat ke navigasi Loncat ke pencarian
Ini adalah subhalaman dokumentasi untuk Templat:Custom rule.
Halaman ini mengandung informasi penggunaan, kategori, pranala antarbahasa, dan lain-lain yang bukan merupakan bagian dari halaman templat asli.


This template creates a rule made up of a number of interchangeable image segments. Each element is a pair of parameters, the first selecting the pattern, the second selecting the size, as such there will always be an even number of parameters added.

The parameters are a sequence of identifiers for the type of feature followed by that feature's width in pixels. These always form pairs of parameters. Below is a list of the features available. Update this list if you know of elements that are missing.

Stylistic options for Template:Custom rule
Shorthand Identifier Example Widths available
Templat:Code Span 5, 10, 20, 40, 50, 100
Templat:Code, Templat:Code Arrow Thin (Left, Right) 10
Templat:Code Tear Left 20, 40
Templat:Code Tear Right 20, 40
Templat:Code Star 6, 10
Templat:Code Wave 40
Templat:Code Square 5, 10
Templat:Code Square open 5, 10
Templat:Code Diamond 4, 6, 10
Templat:Code Diamond open 7
Templat:Code Lozenge 20, 40, 60, 140
Templat:Code Lozenge thin 20, 40, 60, 100, 200, 250, 300, 350, 400
Templat:Code Circle 6
Templat:Code Circle open 6, 10, 20
Templat:Code Rectangle 15
Templat:Code Crescent 10
Templat:Code Ellipse 15
Templat:Code Colon 4, 6
Templat:Code Flare (Left, Right) 12, 40
Templat:Code Flare Centre 14, 22, 40, 60, 80, 100, 140
Templat:Code Flare Centre thin 20, 40, 60, 80, 100, 120, 140
Templat:Code Flare Centre White 22, 40
Templat:Code Curl (Left,Right) 10
Templat:Code Fancy1 40
Templat:Code Fancy2 100
Templat:Code Fancy3 40

If an an identifier is not available for a segment you want, add it to {{custom rule segment}}, or use the plain identifier without a shorthand. Eg {{custom rule|sp|100}} = {{custom rule|Span|100}}.

The feature must be available as that specific size. If it is not, the image will not be found, and a red link will appear. You can see a full list at the Rule segments category at Commons. If you add your own segments, add them to this category.


{{Custom rule|sp|100|d|6|sp|10|d|10|sp|10|d|6|sp|100}}

Adding components[sunting]

Adding new feature types[sunting]

Notice the "flange" for matching to the background rule.

It is easy to add images to the set. In order to be found, the filename must be in the form "Templat:Code. Example: Templat:Code

Note that it is also required that the image meet up well at the sides. The rule is 1px wide, so the features must have a 1px edge on each side, in the exact centre (vertically) of the edge. To ensure this, run a 1px line through the feature so that it fills in the gaps. See the diagram on the left for an example of how this is done. Ensure that the line is aligned with the pixel grid (but not centred on it), otherwise it will come out blurry when rendered. To fix this, shift up or down by 0.5px. Be careful about edges of features as well, especially horizontal or vertical ones—these should be also aligned to pixel edges.

You will also need to add code to the template that grabs the image segments, {{Custom rule segment}}. Instructions on modifying that template can be found on the documentation there.

Adding more segments[sunting]

For complex rules, more segments can be added. Edit this template and paste in line in the format:

</noinclude>{{#if:{{{17|}}}|{{!!}}{{Custom rule segment|{{{17}}}|{{{18}}}}}}}<noinclude>

Make sure the numbers are continuous through the template, and that you match the first parameter of this line to the second one, otherwise the template will not render reliably.

See also[sunting]