Jump to content

Extension:Attachments

From mediawiki.org
This page is a translated version of the page Extension:Attachments and the translation is 17% complete.


MediaWiki 拡張機能マニュアル
Attachments
リリースの状態: 安定
実装 パーサー関数 , 変数 , ページの操作 , フック
説明 下位ページ、ファイル、外部リンクをページに添付できるようにする。
作者
  • Gittenburg
  • Wryck
  • Vuhuy (Shibe90)
最新バージョン 1.0.1
互換性の方針 MediaWiki とともにリリースされるスナップショット。 master には後方互換性がありません。
MediaWiki 1.39+

  • $wgAttachmentsNamespaces
  • $wgAttachmentsChunkListByLetter
  • $wgAttachmentsShowSubpageForm
  • $wgAttachmentsShowLinkForm
  • $wgAttachmentsShowInNamespaces
  • $wgAttachmentsShowInViews
  • $wgAttachmentsShowEmptySection
ライセンス MIT ライセンス
ダウンロード
https://vowi.fsinf.at/

Attachments 拡張機能は、利用者が有効な名前空間内のページに下位ページ、ファイル、外部リンクを添付できるようにします。

  • Attachments can easily be added through the user interface.
  • Attachments of an article are displayed in an automatically generated list at its end.
  • This extension integrates with the Vector and Minerva Neue skins.

So how does it work?

  • subpages automatically count as attached to their parent page
  • When you upload a file through the Attach page action, a parser function {{#attach: Title}} is added to the description.
  • When you add a link, the extension creates a subpage containing the {{#exturl: URL}} parser function.
  • Both parser functions set page properties , which are queried for the autogenerated sections.

高度な機能

  • #attach can also be used to attach a regular page to another regular page.
  • You can exclude subpages starting with a specific prefix from the autoindex with {{#attachments ignore subpages: prefix}} on the parent page.
  • You can access attachments before they are sorted with the BeforeSortAttachments(&$links) hook, where links is an associative array mapping string keys to HTML links. Return false to take over the sorting.

Relatively linking an attached file

The Attachments extension provides the {{FILEPREFIX}} parser function to faciliate linking/embedding attached files.

If you attach an image Example.jpg to Somepage then you can embed the image:

  • from Somepage with [[File:{{FILEPREFIX}}Example.jpg]]
  • from Somepage/Subpage with [[File:{{FILEPREFIX:..}}Example.jpg]]
  • from Somepage/Subpage/Subsubpage with [[File:{{FILEPREFIX:../..}}Example.jpg]]

Note that the same also works with [[Media:...]] links.

インストール

  • Enable Uploads .
  • Developers can clone the extension into your MediaWiki extensions directory:
    cd extensions/
    git clone https://github.com/vuhuy/Swiki
    
  • Note that you should also enable subpages for these namespaces.

省略可能な構成パラメーター

Name Type Description Default
$wgAttachmentsChunkListByLetter Boolean Whether or not the attachment list should be chunked by the first letter of list items. true
$wgAttachmentsShowSubpageForm Boolean Whether or not the subpage form should be shown. true
$wgAttachmentsShowLinkForm Boolean Whether or not the external link form should be shown. true
$wgAttachmentsShowInNamespaces Boolean Whether or not a link to the attachments should be shown in the namespaces (page, discussion). false
$wgAttachmentsShowInViews Boolean Whether or not an 'add attachments' link should be shown in the views (read, edit source, view history). false
$wgAttachmentsShowEmptySection Boolean Whether or not to show certain elements when there are no attachments for a page. false

ヒント

クレジット

This extension is essentially a complete rewrite of PerPageResources by Mathias Ertl, which consists of Extension:Resources, Extension:AddResource and Extension:ExternalRedirects. This extension replaces all three, notable differences are:

  • attachments are stored in page_props instead of pagelinks
  • no open redirects, just links
  • attachments are shown at the end of pages, as opposed to on a special page

Originally developed and maintained by Gittenburg.

関連項目