Bản mẫu:Lỗi

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

{{{1}}}

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

This meta template returns a state of error (recognized as such by a wiki parser function), and optionally an error-message text in red (visible for the user). It is used by other templates to signal an error, for example invalid input, which can then either be displayed to the editor or caught and handled by other templates.

Cách sử dụng[sửa]

  • {{lỗi|An exemplary error}}An exemplary error
  • {{lỗi|message=An exemplary error}}An exemplary error
  • Compare, used in a Parser Function: {{#expr:Foo}}Lỗi biểu thức: Từ “foo” không rõ ràng
  • {{#iferror:{{lỗi|Foo}} | {{y}} | {{n}} }}Bản mẫu:Y

Tùy chọn thẻ[sửa]

The tag to contain the error message can be given through the tag parameter, but it will only accept span, div, p, and strong, since those are the only tags recognized by the Bản mẫu:Pf parser function. It defaults to strong, the tag generated e.g. by Bản mẫu:Pf. To prevent strong message, use one of the other tags, e.g. tag=span.

  • ABC {{lỗi|An exemplary error demo no tag (default)}} XYZ → ABC An exemplary error demo no tag (default) XYZ
  • ABC {{lỗi|An exemplary error demo span|tag=span}} XYZ → ABC An exemplary error demo span XYZ
  • ABC {{lỗi|An exemplary error demo div|tag=div}} XYZ → ABC
    An exemplary error demo div
    XYZ
  • ABC {{lỗi|An exemplary error demo p|tag=p}} XYZ → ABC

    An exemplary error demo p

    XYZ
  • ABC {{lỗi|An exemplary error demo strong|tag=strong}} XYZ → ABC An exemplary error demo strong XYZ

Dữ liệu bản mẫu[sửa]

Đây là tài liệu Dữ liệu bản mẫu cho bản mẫu này được sử dụng bởi Trình soạn thảo trực quan và các công cụ khác; xem báo cáo sử dụng tham số hàng tháng cho bản mẫu này.

Dữ liệu bản mẫu cho Lỗi

The template returns a state of error (recognized as such by a wiki parser function), and optionally an error-message text in red (visible for the user)

Tham số bản mẫu[Quản lý Dữ liệu bản mẫu]

Tham sốMiêu tảKiểuTrạng thái
Message1

Error message text in red

Chuỗi dàitùy chọn
Tagtag

The tag to contain the error message; will only accept span, div, p, and strong, since those are the only tags recognized by the #iferror parser function. It defaults to strong, the tag generated e.g. by #expre

Mặc định
strong
Chuỗi dàitùy chọn

Xem thêm[sửa]