Parsoid/Parser Unification/Media structure/FAQ/fa

مرور کلی


منظور از ساختار رسانه چیست؟
وقتی پرونده‌ها در یک صفحه درج می‌شوند (نمونه:  )، تجزیه‌گر مدیاویکی مقداری کد HTML را ارائه می‌دهد که آنچه مرورگر شما برای نمایش آن نیاز دارد را در اختیارش قرار می‌دهد – راهنمایی برای مرورگر تا بتواند آن را به شکلی درست در نمایشگر شما نمایش دهد. برچسب‌های HTML منتخب و ویژگی‌های آن‌ها، و چگونگی چیدمان آن‌ها برای شکل دادن یک درخت دام، ساختاری است که مد نظر ماست.



چه‌چیزی را می‌توان در ساختار کنونی بهبود بخشید؟
ساختار کنونی متشکل از برچسب‌های div تودرتو و ویژگی‌های class است که معنای زیادی را منتقل نمی‌کنند. این نشانه‌گذاری غیرعادی است و اخذ پرسمان و سبک‌بندی را سخت می‌کند. همچنین خروجی کنونی با سایر محصولات مانند ترکیب ویرایشگر دیداری/پارسوئید تفاوت دارد. برای جزئیات بیشتر این نظرخواهی را ببینید. خروجی نمونهٔ فوق در حال حاضر مشابه کد زیر است:



آن را با چه‌چیزی جایگزین می‌کنید؟
The structure we're replacing it with is composed of semantic markup, which will provide accessibility benefits, such as giving those who read the wikis using screenreaders more information about how images, videos and other media are used within the content. The markup will be more regular and specified, making it easier and more efficient to query and style, meaning that the new structure will make it easier for anyone writing CSS related to media on the Wikimedia wikis. Moreover, using the same structure that has been piloted in Parsoid will provide consistency between products and reduce some CSS redundancy. The output for the example above will look like this:

Why are you doing this now?
A medium term goal of the Content Transform Team at the WMF is to replace MediaWiki's legacy parser with Parsoid, a bidirectional wikitext to HTML5 parser. In order to get there, the legacy parser and Parsoid need to produce compatible HTML. Parsoid has been generating this new media structure for quite some time, to good effect. In order to lessen the disruption of changing parsers all at once, we're rolling out an isolated piece in preparation for further changes to come.

How has this been tested?

 * 1) The new structure has been piloted in Parsoid which is used in several active products like Visual Editor and the mobile apps. As editors and readers used these products, they flagged rendering differences with the old structure and problems with the new structure, which we've fixed over the years.
 * 2) In addition, we've done several rounds of visual difference testing where thousands of pages are rendered with the old and new structure and the rendering compared at a pixel level.
 * 3) We've also already deployed this change to several wikis, including mediawiki.org, wikitech, and all the group 0 wikis.

What's left to do?

 * 1) Code that interacts with the page, like JavaScript for extensions, user scripts and gadgets will need to be adjusted to the new structure, hopefully in a forwards and backwards compatible way.
 * 2) Skins will need to ask for the "content-media" feature or provide their own styling, since classes targeting the old structure won't apply.
 * 3) Some wikis have CSS in MediaWiki:Commons.css that will need to be ported to the new structure.

When will you be rolling this out?
As above, it's already live on several wikis. However, we won't continue to push forward until the known issues are addressed and we've done some level of auditing of user scripts and gadgets to ensure we're causing as little disruption to readers and editors as possible.

How can I help?
Test your code on the wikis we've deployed to. If you find any problems that are not covered below, please file tasks with the tag , or see the list of open tasks.

Copy known fixes to gadgets enabled on your wikis
A number of gadgets were identified as needing to be updated to support the new media structure. Fixes were applied to the source of the gadgets but the changes still need to propagate out to all the wikis that have duplicated the gadgets locally. See the task description of T297447 for the list of gadgets and wikis where the gadgets are enabled. If yours haven't been updated, please do so.

Copy known fixes to MediaWiki:Common.(css|js) to your wikis
A number of issues with site specific css and js were identified as needing to be updated to support the new media structure. See the task description of T271114 for the list of known issues common to multiple wikis and the wikis that may need to be updated. If yours haven't been updated, please do so.

The "image" class is no longer present on file description links
By default, a file (e.g. ) will link to its description page and would previously be given a class named .

In contrast, an explicit link (e.g. ) would not result in that class being applied.

In the new structure, the class serving the same purpose has been renamed to .

Selectors should target the new class, where appropriate. For example, see https://www.mediawiki.org/w/index.php?title=Snippets%2FDirect_imagelinks_to_Commons&type=revision&diff=5451422&oldid=3976429

The media option is now applied to the wrapper
Previously, the class media option (e.g. ) would be applied to the media element.

The class has been moved to the outer wrapper, in order to allow the most flexibility when selecting within the structure.

The media option is now applied to the wrapper and the class emitted has been renamed
Previously, the border media option (e.g. ) would result in the  class being applied to the media element.

For consistency, the class has been moved to the outer wrapper and renamed to  to prevent conflicts.

Horizontal and vertical alignment options now place classes on the wrapper
The horizontal alignment options include. The vertical alignment options include.

For example, previously, the center media option (e.g. ) would result in the  class being applied to a wrapping div.

This now results in a figure with the  class.

Similarly, the top media option (e.g. ) would previously result a style attribute being applied to the media element.

This now results in the  class being applied to the wrapper.