الگو:خطا/توضیحات
| این زیرصفحهٔ مستندات الگو:خطا است. این شامل اطلاعات استفاده، الگوها، پیوندهای بین زبانی و سایر اطلاعات است که در اصل الگو صفحه قرار نمیگیرد. |
| این الگو از لوآ استفاده میکند: |
این الگو یک پیام خطا را نشان میدهد (که توسط Parser Function: شناخته میشود) و متن پیام خطای دلخواهی را به رنگ قرمز (به کاربر) نشان میدهد.
استفاده
- {{error}} ← An exemplary error
- مقایسه با هنگام استفاده در تابع Parser:
{{#expr:Foo}}← خطای عبارت: کلمه ناشناخته «foo» {{#iferror:{{خطا|Foo}} | {{شد}} | {{نشد}} }}←
امکان برچسب
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 #iferror parser function. It defaults to strong, the tag generated e.g. by #expre. To prevent strong message, use one of the other tags, e.g. tag=span.
- ABC {{error}} XYZ ← ABC An exemplary error demo no tag (default) XYZ
- ABC {{خطا|An exemplary error demo span|tag=span}} XYZ ← ABC An exemplary error demo span XYZ
- ABC {{خطا|An exemplary error demo div|tag=div}} XYZ ← ABC An exemplary error demo divXYZ
- ABC {{خطا|An exemplary error demo p|tag=p}} XYZ ← ABC
An exemplary error demo p
XYZ - ABC {{خطا|An exemplary error demo strong|tag=strong}} XYZ ← ABC An exemplary error demo strong XYZ
دادههای الگو
الگوداده خطا
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)
| پارامتر | توضیحات | نوع | وضعیت | |
|---|---|---|---|---|
| Message | 1 message | Error message text in red | رشته | پیشنهادشده |
| Tag | tag | 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
| رشته | اختیاری |
جستارهای وابسته