Template:Custom rule/doc: Difference between revisions

From Ekatra Wiki
Jump to navigation Jump to search
ENWS>Alien333
No edit summary
 
m (1 revision imported: Importing Custome Rule Template)
 
(No difference)

Latest revision as of 01:25, 24 July 2024

Lua error in package.lua at line 80: module 'strict' not found.

Lua error in package.lua at line 80: module 'strict' not found. Lua error in package.lua at line 80: module 'strict' not found.

Usage

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
sp Span Rule Segment - Span - 10px.svg 5, 10, 20, 40, 50, 100
al, ar Arrow (Left, Right) Rule Segment - Arrow Left - 12px.svg Rule Segment - Arrow Right - 12px.svg 12
atl, atr Arrow Thin (Left, Right) Rule Segment - Arrow Thin Left - 10px.svg Rule Segment - Arrow Thin Right - 10px.svg 10
ac Arrow Cross Rule Segment - Arrow Cross - 18px.svg 18
tl Tear Left Rule Segment - Tear Left - 20px.svg 20, 28, 40, 57
tr Tear Right Rule Segment - Tear Right - 20px.svg 20, 28, 40, 57
str Star Rule Segment - Star - 10px.svg 6, 10
w Wave Rule Segment - Wave - 40px.svg 1–40, 160
s Square Rule Segment - Square - 10px.svg 5, 10
so Square open Rule Segment - Square open - 10px.svg 5, 10
d Diamond Rule Segment - Diamond - 10px.svg 4, 6, 10
do Diamond open Rule Segment - Diamond open - 7px.svg 7
lz Lozenge Rule Segment - Lozenge - 60px.svg 20, 40, 60, 140
lzt Lozenge thin Rule Segment - Lozenge 5px - 60px.svg 20, 40, 60, 100, 200, 250, 300, 350, 400
c Circle Rule Segment - Circle - 6px.svg 6, 10
co Circle open Rule Segment - Circle open - 6px.svg 6, 10, 20
qc Quatrefoil in circle Rule Segment - Quatrefoil in circle - 12px.svg 12, 25
r Rectangle Rule Segment - Rectangle - 15px.svg 15
crt, crr, crb, crl Crescent (top, right, bottom, left) Rule Segment - Crescent top - 10px.svg Rule Segment - Crescent right - 10px.svg Rule Segment - Crescent bottom - 10px.svg Rule Segment - Crescent left - 10px.svg 10
bcrt, bcrr, bcrb, bcrl Black Crescent (top, right, bottom, left) Rule Segment - Black Crescent top - 10px.svg Rule Segment - Black Crescent right - 10px.svg Rule Segment - Black Crescent bottom - 10px.svg Rule Segment - Black Crescent left - 10px.svg 10
el Ellipse Rule Segment - Ellipse - 15px.svg 15
elo Ellipse open Rule Segment - Ellipse open - 15px.svg 15
col Colon Rule Segment - Colon - 6px.svg 4, 6
fl, fr Flare (Left, Right) Rule Segment - Flare Left - 12px.svg Rule Segment - Flare Right - 12px.svg 11, 12, 15, 30, 40
fc Flare Centre Rule Segment - Flare Centre - 60px.svg 14, 22, 40, 60, 80, 100, 140
fct Flare Centre thin Rule Segment - Flare Centre 5px - 60px.svg 20, 40, 60, 80, 100, 120, 140
fcw Flare Centre White Rule Segment - Flare Centre White - 40px.svg 22, 40
cll, clr Curl (Left, Right) Rule Segment - Curl Left - 10px.svg Rule Segment - Curl Right - 10px.svg 10
ltr, rtr Triangle (Left, Right) Rule Segment - Lefttriangle - 10px.svg Rule Segment - Righttriangle - 10px.svg 5, 10
lo Loops Rule Segment - loops - 141px.svg 141, 283
fy1 Fancy1 Rule Segment - Fancy1 - 40px.svg 40
fy2 Fancy2 Rule Segment - Fancy2 - 100px.svg 100
fy3 Fancy3 Rule Segment - Fancy3 - 40px.svg 40

If an an identifier is not available for a segment you want, add it to Module:Custom rule/segments, 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.

Example

Example

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

text Lua error in package.lua at line 80: module 'strict' not found. text

Example

text
{{Custom rule|sp|100|d|6|sp|10|d|10|sp|10|d|6|sp|100|inline=true}}
text

text Lua error in package.lua at line 80: module 'strict' not found. text

Adding components

Adding new feature types

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 "Rule Segment - [Identifier] - [Width]px.svg. Example: File:Rule Segment - Span - 10px.svg

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 right 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 module that grabs the image segments, Module:Custom rule/segments. Instructions on modifying that module can be found in the documentation there.

See also