跳转到内容

模板:Download PDF/doc

来自天灾之下:危险连接资料站
wiki>Sophivorus2024年10月8日 (二) 22:04的版本 (→Installation)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

Use this template to make a button that, when clicked, will prompt the user to print or download a PDF with a specified set of pages.

See the installation instructions to get it working in your wiki.

Usage

Markup Renders asLua错误:expandTemplate: template loop detected。

Installation

To install this template in your wiki:

  1. Create a template with the following markup. You can choose the template name, parameter names and defaults to suit your wiki.
    <includeonly><span data-pages="{{{pages|{{FULLPAGENAME}}}}}" data-separator="{{{separator|,}}}" class="DownloadPDF cdx-button cdx-button--fake-button cdx-button--fake-button--enabled" tabindex="0" role="button">{{{text|Download PDF}}}</span>[[Category:Gadget:DownloadPDF]]</includeonly>
    
  2. Create MediaWiki:Gadget-DownloadPDF.js with the following code:
    /**
     * DownloadPDF enables printing or downloading a specified set of pages
     * Documentation: https://www.mediawiki.org/wiki/DownloadPDF
     * Source code: https://www.mediawiki.org/wiki/MediaWiki:Gadget-Global-DownloadPDF.js
     */
    mw.loader.load( '//www.mediawiki.org/w/load.php?modules=ext.gadget.Global-DownloadPDF' );
    
  3. Add the following gadget to MediaWiki:Gadgets-definition:
    * DownloadPDF[ResourceLoader|hidden|default|categories=Gadget:DownloadPDF]|DownloadPDF.js
    

Done! Add your template to any page to verify that the installation was successful.

Template data

Use this template to make a button that, when clicked, will prompt the user to print or download a PDF with a specified set of pages.

模板参数

此模板首选参数换行的代码块格式。

参数描述类型状态
Pagespages

Comma-separated list of pages to print or download

默认值
The current page
示例值
Help:Images, Help:Tables, Help:Templates
字符串可选
Separatorseparator

Separator in the list of pages

默认值
,
示例值
;
字符串可选
Texttext

Text of the button

默认值
Download PDF
示例值
Download instructions
字符串可选

See also