Extension:Attachments
Jump to navigation
Jump to search
Attachments リリースの状態: 安定 |
|
---|---|
![]() |
|
実装 | パーサー関数 , 変数 , ページの操作 , フック |
説明 | Attach subpages, files and external links to pages. |
作者 | (Gittenburgトーク) |
最新バージョン | 0.1.0 (2019-06-11) |
互換性ポリシー | Master maintains backwards compatibility. |
MediaWiki | 1.32+ |
ライセンス | MIT ライセンス |
ダウンロード | |
例 | https://vowi.fsinf.at/ |
$wgAttachmentsNamespaces |
|
The Attachments extension lets users attach subpages, files and external links to pages in enabled namespaces.
- 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 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 descripiton. - 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 link files added through the Attach page action relatively with
[[File:{{FILEPREFIX}}filename.jpg]]
(or{{FILEPREFIX:..}}
for the parent 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.
インストール
- ダウンロードして、ファイルを
extensions/
フォルダー内のAttachments
という名前のディレクトリ内に配置します。 - 以下のコードを LocalSettings.php の末尾に追加します:
wfLoadExtension( 'Attachments' );
完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。
構成パラメーター
- $wgAttachmentsNamespaces
- Associative array, set a namespace id to true to enable the extension in the namespace.
- For example:
$wgAttachmentsNamespaces[NS_MAIN] = true;
- Note that you should also enable subpages for these namespaces.
ヒント
- Enable $wgCountCategorizedImagesAsUsed to exclude attached files from Special:UnusedImages.
- Attachments and external URLs are both stored as page props, meaning they can be queried with API:Pageprops and API:Pageswithprop.
- Set $wgForeignUploadTargets to
[]
, if you don't want users circumventing this extension through the upload dialog. - If new attachments do not show up, it might be because you have many jobs in your job queue.
Credits
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
関連項目
- MoinMoinWiki - supports attachments out of the box.
- Extension:PageAttachment - unmaintained, has 7k lines of PHP – this extension has under 400
- Extension:FileAttach - unmaintained, saves attachments in wikitext
Categories:
- Stable extensions/ja
- Parser function extensions/ja
- Variable extensions/ja
- Page action extensions/ja
- Hook extensions/ja
- MIT licensed extensions/ja
- Extensions in GitHub version control/ja
- ParserFirstCallInit extensions/ja
- BeforePageDisplay extensions/ja
- MagicWordwgVariableIDs extensions/ja
- ParserGetVariableValueSwitch extensions/ja
- SkinTemplateNavigation extensions/ja
- MinervaPreRender extensions/ja
- ListDefinedTags extensions/ja
- ChangeTagsListActive extensions/ja
- All extensions/ja
- Attachment extensions/ja