مساعدة:تغيير موديل المحتوى

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Help:ChangeContentModel and the translation is 22% complete.

Other languages:
العربية • ‎English • ‎español • ‎日本語 • ‎português • ‎português do Brasil • ‎中文
PD ملاحظة:بتحريرك هذه الصفحة فإنك توافق على وضع مساهمتك في الملك العام وفق CC0.راجع صفحات مساعدة الملكية العامة للمزيد من المعلومات.
PD
Content Models and Handlers
MediaWiki allows for page content types other than wikitext. It offers built-in support for JavaScript, CSS, JSON and plain text. Extensions can use MediaWiki's ContentHandler mechanism to add new content models for accepting different formats and controlling how they are rendered, stored and edited.
Icon apps query.svg About
Icon tools.svg Usage
Icon-gears.svg Configuration settings

Support and development
Git-logo.svg Latest technical documentation (Git)
Wikimedia Phabricator logo.svg Phabricator
Special:ChangeContentModel أثناء استخدام جلد MonoBook.

مكن استخدام صفحة 'Special:ChangeContentModel' لتغيير "نموذج المحتوى" الخاص بالصفحة. نموذج المحتوى ، على نطاق واسع للغاية ، هو تنسيق أو نوع صفحة معينة على الويكي. بشكل افتراضي ، يكون نموذج محتوى الصفحة هو wikitext ، وهو تنسيق نص منسق يستخدم ترميز wiki. تتضمن نماذج المحتوى المستخدمة في مشاريع ويكيميديا "css" و "javascript" لتخزين الأكواد ، و "wikibase-item" للإدخالات على Wikidata ، و "Campaign" على ويكيميديا كومنز لحملات التحميل مثل Wiki Loves آثار. تتوفر قائمة بنماذج المحتوى في ' content handlers' . يتوفر المزيد من المعلومات الفنية في ' Manual: ContentHandler' .

يتم تسجيل جميع الإجراءات إلى Special: Log/ contentmodel ، مع رابط "العودة" الملائم للتراجع عن التغييرات إذا لزم الأمر. يجب أن يكون لدى المستخدمين إذن editcontentmodel </ code> لتتمكن من تغيير نماذج المحتوى. في مشاريع ويكيميديا ، يتم منح هذا الإذن حاليًا إلى sysops.

Background

Traditionally, the only types of pages you could create on MediaWiki were wikitext pages: rich text documents written in wikitext markup. This is acceptable for writing encyclopedia entries on Wikipedia, but falls short for content of other types, such as blocks of source code, structured data content, or complex workflows.

With the advent of the Wikidata project (and the Wikibase extension) in 2012, the ContentHandler branch was developed to allow the creation of pages other than wikitext documents. As of MediaWiki 1.21, ContentHandler is a part of the core MediaWiki software.

Some generic content models include those meant for storing and presenting source code, but they can also be used to create customized editing interfaces. For example, instead of using a horrible mess of templates to structure content on a page, you could store the underlying data in a structured format such as JSON and then write a MediaWiki extension that builds a custom editing interface on top of this structured data. This approach is used by MassMessage to create delivery list pages and by CollaborationKit for creating WikiProjects. Although these extensions have their own workflows for creating pages, Special:ChangeContentModel can also be used.

As an alternative to setting content models on a page-by-page basis, you can specify alternative defaults for a given namespace. For example, the default content model in the Module namespace is ScribuntoContent. Similarly, you can enforce that a given content model is only used in a given namespace; ScribuntoContent can only be used in the Module namespace.

Viewing a page's current content model

To view a page's current content model, click "معلومات عن هذه الصفحة" in the sidebar toolbox. You can also append ?action=info to a URL to get the same page.

Changing a page's content model

Go to Special:ChangeContentModel, enter the page name you wish to change. This can be a non-existent page if you wish to create a new page that uses a different content model from the default. Next, choose the content model you wish to change to. Click "تغيير" to make the change.

Note that not all conversions are possible. If you are trying to convert a page that already exists and the MediaWiki software cannot figure out how to re-interpret the current page's content, the content model will not be converted and you will get an error message. When this happens, it is recommended that you archive the old page and create the page anew in the new content model. For instance, you could rename "Project:Foo" to "Project:Foo/old" and then use Special:ChangeContentModel to create a new page at "Project:Foo". If possible, you should include a link to "Project:Foo/old" on the new page.

Undoing a change

All content model changes are logged at Special:Log/contentmodel on your wiki. To undo a change, go to the relevant entry in the log and click "استرجع". You will see a pre-filled form; click "تغيير" to carry out the revert. If you are viewing the page history and the most recent change was the one that changed the content model, you can use the undo feature to change the content model back. Rollback will also undo any content model changes.

Note that this may not always work, particularly if the page was edited after the content model was changed in such a way to make it incompatible with the old content model. When this happens, you will have to undo the edits that made it incompatible. Alternatively, you could carry out the content model change anew and archive the old content. Ideally, content model changes are few and far between. In most situations, a page will not have to change content model more than once.