Bản mẫu:PDFlink/doc
< Bản mẫu:PDFlink
Phiên bản vào lúc 21:05, ngày 28 tháng 10 năm 2020 của Taitamtinh (Thảo luận | đóng góp) (Tạo trang mới với nội dung “<includeonly>{{pp-template|small=yes}}</includeonly> {{Trang con tài liệu}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> {…”)
(khác) ← Phiên bản cũ | xem phiên bản hiện hành (khác) | Phiên bản mới → (khác)

{{PDFlink/doc}} highlights that a link points to a PDF document (on some systems PDF files may take time to download and display within the browser, and their use on many websites is not compliant with the Web Content Accessibility Guidelines).

Usage[sửa]

The following lines:

{{PDFlink|[http://www.example.org/Link.pdf Link]}}
{{PDFlink|[http://www.example.org/Link.pdf Link]|32&nbsp;KB}} 

yield:

LinkPDF
LinkPDF (32 KB)

Note: It was previously possible to add the icon with {{PDFlink}} by itself, but the functionality has changed, making this no longer work in Internet Explorer. You must surround it with the template as shown above to work correctly in Internet Explorer.

PDFbot[sửa]

An unassisted bot (User:PDFbot) has been created to add and keep file size information current. In addition, it will fix many mistakes and the limitation as described in the section below.

Note: the bot will replace the contents of the second parameter when updating the file size.

Icon[sửa]

The icon is add using CSS and is found in MediaWiki:Common.css, the relevant portion that applies the icon is:

/* Change the external link icon to an Adobe icon anywhere the PDFlink class */
/* is used (notably Template:PDFlink). This works in IE5-6, unlike the above. */
span.PDFlink a {
    background: url(http://upload.wikimedia.org/wikipedia/commons/thumb/2/23/Icons-mini-file_acrobat.gif/15px-Icons-mini-file_acrobat.gif) center right no-repeat !important;
    padding-right: 17px !important;
}

Limitations[sửa]

As this template uses unnamed parameters, links containing = or | will cause the link to not display at all. The workaround is to either replace the entity with an indirect character reference as &#61; and &#124;, respectively, or to use the numbered parameter (1= and 2=) for each parameter to take care of =, or to use {{!}} to take care of |.

Examples:

  • {{PDFlink|[http://example.org/bla?a=xy|Link.pdf Link to a PDF]|32&nbsp;KB}}
  • {{PDFlink|[http://example.org/bla?a&#61;xy&#124;Link.pdf Link to a PDF]|32&nbsp;KB}}
  • {{PDFlink|1=[http://example.org/bla?a=xy{{!}}Link.pdf Link to a PDF]|2=32&nbsp;KB}}