امتداد:وسوم إتش تي إم إل
![]() حالة الإصدار مستقر |
|
---|---|
تنفيذ | وسم |
بيان | يتولى تحديد وسم، <htmltag> ، يسمح بوضع وسوم إتش تي إم إل على الصفحة من مجموعة من الوسوم المسموح بها والنعوت المحددة مسبقا بيد إداري. |
المؤلف/المؤلفون | Yaron Koren <yaron57@gmail.com> |
آخر إصدار | 0.4 (2025-02-21) |
MediaWiki | 1.29+ |
تغييرات قاعدة البيانات | لا |
ترخيص | رخصة جنو العمومية 2.0 أو ما بعدها |
التنزيل | |
مثال | عرض حي لامتداد وسوم إتش تي إم إل |
|
|
|
|
ترجم الامتداد HTML Tags لو كان متوفرا على translatewiki.net | |
يحدد امتداد وسوم إتش تي إم إل وسم، <htmltag>
، الذي يمكن استخدامه في عرض وسوم إتش تي إم إل في صفحات ويكي يجوز ألا يسمح بها محلل ميدياويكي اللغوي.
صمم امتداد وسوم إتش تي إم إل في البداية للسماح بدعم استخدام وسوم LRMI (مبادرة البيانات الفوقية لموارد التعلم) داخل صفحات ميدياويكي. طالع تنفيذ المبادرة للتعرف على كيفية تنفيذ أمر مثل هذا مستخدما امتداد وسوم إتش تي إم إل.
أحد الاستخدامات الأخرى المحتملة لامتداد وسوم إتش تي إم إل هو دمج بيانات مصغّرة (خاصة هذا النوع منها الذي لا يمكن دمجه بالفعل).
يمكنك الاطلاع على عرض حي بسيط لهذا الامتداد هنا.
الكود البرمجي والتنزيل
You can download the HTML Tags code, in .zip format, here.
You can also download the code directly via Git from the MediaWiki source code repository. From a command line, you can call the following:
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/HTMLTags.git
To view the code online, including version history for each file, go here.
التثبيت
After you've obtained an 'HTMLTags' directory (either by extracting a compressed file or downloading via Git), place this directory within the main MediaWiki 'extensions' directory. Then, in the file 'LocalSettings.php' in the main MediaWiki directory, add the following line:
wfLoadExtension( 'HTMLTags' );
You then need to specify the allowed set of HTML tags, and the allowed set of attributes for each one, using the global variable $wgHTMLTagsAttributes.
For instance, to allow the <a>
tag, and to allow only the attributes "href" and "class" for it, you would add the following to LocalSettings.php, after the inclusion of LocalSettings.php:
$wgHTMLTagsAttributes['a'] = [ 'href', 'class' ];
If you wanted to allow the tag <fieldset>
, but without any allowed attributes, you would add the following:
$wgHTMLTagsAttributes['fieldset'] = [];
الاستخدام
Once a set of allowed tags and attributes are specified, you can use <htmltag>
to place those tags on the page.
You use the attribute "tagname" to specify the actual tag, and then add the other attributes exactly as you want them to appear.
The "contents" of the tag become the contents of <htmltag>
.
For instance, if the above lines are added, and you want to add a link on some page using the <a>
tag, you could add something to the page like:
<htmltag tagname="a" href="http://en.wikipedia.org/wiki/Antarctica" class="my-links">Read about Antarctica</htmltag>
This will add the following to the page's HTML source:
<a href="http://en.wikipedia.org/wiki/Antarctica" class="my-links">Read about Antarctica</a>
Calling <htmltag>
with a tag name that is not allowed will result in an error message; calling it with an attribute that is not allowed will simply lead to the attribute being ignored.
See Implementing LRMI for a full description of how this extension, along with some templates, can be used to allow for easy adding of LRMI metadata to pages.
المؤلفون
HTML Tags was written by Yaron Koren, reachable at yaron57 -at- gmail.com.
This extension was funded by Creative Commons as part of the LRMI project.
تاريخ النسخة
HTML Tags is currently at version 0.3.
The version history is:
- 0.1 - - Initial version
- 0.2 - - i18n messages moved into JSON files; various fixes
- 0.3 - - converted to extension registration
- 0.4 - - Removed PHP entry point; code improvements
انظر أيضا
- قيود على إتش تي إم إل - list of extensions that allow for the inclusion of raw HTML
- Extension:AnchorHandler – Allows inserting
<a>
anchor tags into wikitext
هذا الامتداد مشمول في الحزم أو مزارع الويكي التالية أو كليهما: هذه ليست قائمة كاملة. بعض مزارع الويكي أو الاستضافة أو حزم البرمجيات قد تحتوي على هذا الامتداد حتى لو كانت غير مدرجة هنا. راجع دائمًا مزرعة الويكي أو المستضيف أو حزمة البرمجيات للتأكد من ذلك. |