Bản mẫu:Vạch tùy chỉnh

Văn thư lưu trữ mở Wikisource


Tài liệu bản mẫu[xem] [sửa] [lịch sử] [làm mới]

Bản mẫu này tạo ra một vạch kẻ ngang gồm nhiều loại hình dạng khác nhau.

Ví dụ[sửa]

{{Vạch tùy chỉnh|sp|100|d|6|sp|10|d|10|sp|10|d|6|sp|100}}

Cách dùng[sửa]

Tham số sẽ là một chuỗi từ khóa đại diện cho các hình dạng, đi kèm với chiều dài theo đơn vị pixel (điểm ảnh). Tham số lúc nào cũng đi cặp như vậy. Dưới đây là danh sách các hình dạng có sẵn. Hãy cập nhật danh sách này nếu bạn thấy có hình dạng nào đang thiếu.

Viết tắt Từ khóa Ví dụ Chiều dài có sẵn
sp Span 5, 10, 20, 40, 50, 100
atl, atr Arrow Thin (Left, Right) 10
tl Tear Left 20, 40
tr Tear Right 20, 40
str Star 6, 10
w Wave 40
s Square 5, 10
so Square open 5, 10
d Diamond 4, 6, 10
do Diamond open 7
lz Lozenge 20, 40, 60, 140
lzt Lozenge thin 20, 40, 60
c Circle 6
co Circle open 6, 10, 20
r Rectangle 15
crt, crr, crb, crl Crescent 10
el Ellipse 15
col Colon 4, 6
fl, fr Flare (Left, Right) 12, 40
fc Flare Centre 14, 22, 60, 100, 140
cll, clr Curl (Left,Right) 10
fy1 Fancy1 40
fy2 Fancy2 100
fy3 Fancy3 40

Nếu bạn không thấy một từ khóa nào bạn muốn, hãy thêm nó vào {{Vạch tùy chỉnh/đoạn}}, hoặc dùng từ khóa đơn giản mà không viết tắt. Ví dụ {{Vạch tùy chỉnh|sp|100}} = {{Vạch tùy chỉnh|Span|100}}.

Hình dạng chỉ có sẵn ở một số kích thước cố định. Nếu không ghi đúng, ảnh sẽ không hiện ra, và liên kết đỏ sẽ xuất hiện. Bạn có thể xem danh sách đầy đủ tại Rule segments category ở Commons. Nếu bạn tự thêm đoạn riêng cho mình, hãy thêm nó vào thể loại đó.

Thêm hình dạng mới[sửa]

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 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, {{Vạch tùy chỉnh/đoạn}}. Instructions on modifying that template can be found on the documentation there.

Adding more segments[sửa]

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

</noinclude>{{#if:{{{17|}}}|{{!!}}{{Vạch tùy chỉnh/đoạn|{{{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[sửa]

  • {{rule}} Simple rule of variable width - use this if you just want a line