வார்ப்புரு:Pdf/doc
{{Documentation subpage}}
 &lt;!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --&gt;
 
 {{tl|{{PAGENAME}}}} highlights that a link points to a [[Portable Document Format|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 ==
 The following lines:
 
 &lt;!-- &lt;nowiki&gt;[http://www.example.org/Link.pdf Link] {{PDFlink}}&lt;/nowiki&gt;
      No longer works in Internet Explorer with new site-wide CSS-based icon.  Please use the other forms  --&gt;
  &lt;nowiki&gt;{{PDFlink|[http://www.example.org/Link.pdf Link]}}&lt;/nowiki&gt;
  &lt;nowiki&gt;{{PDFlink|[http://www.example.org/Link.pdf Link]|32&amp;amp;nbsp;KB}}&lt;/nowiki&gt; &lt;!-- only use when the bot fails to update --&gt;
 &lt;!-- &lt;nowiki&gt;{{PDFlink|[http://www.example.org/Link.pdf Link]|32&amp;amp;nbsp;[[Kibibyte|KiB]]}}&lt;/nowiki&gt;
      Deprecated.  See [[MOS:NUM#Binary prefixes]] --&gt;
  &lt;nowiki&gt;{{PDFlink|[http://www.example.org/fileserver/239349 Link]|1.4&amp;nbsp;MB}}&lt;/nowiki&gt;
 
 yield:
 
 :{{PDFlink|[http://www.example.org/Link.pdf Link]}}
 :{{PDFlink|[http://www.example.org/Link.pdf Link]|32&amp;nbsp;KB}}
 :{{PDFlink|[http://www.example.org/fileserver/239349 Link]|1.4&amp;nbsp;MB}}
 
 '''Note:''' It was previously possible to add the icon with &lt;code&gt;&lt;nowiki&gt;{{PDFlink}}&lt;/nowiki&gt;&lt;/code&gt; 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.{{clarify|reason=What version(s), on what platform(s)?}}  See [[#Use in citation templates]], below, for how to do this now without boogering IE.
 
 '''Units''': Per [[WP:Manual of Style (dates and numbers)]], use KB and MB (kilobytes and megabytes), not KiB and MiB (kibibytes and mibibytes), as very few readers have ever even heard of the latter units.
 
 === PDFbot ===
 An unassisted [[WP:Bot policy|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 ==
 The icon is added using CSS and is found in [[MediaWiki:Common.css]], the relevant portion that applies the icon is:
 &lt;source lang=&quot;css&quot;&gt;
 /* Change the external link icon to an Adobe icon anywhere the PDFlink class
    is used (notably Template:PDFlink). This works in IE, unlike the above. */
 #content span.PDFlink a,
 #mw_content span.PDFlink a {
     background: url(&quot;http://upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif&quot;) center right no-repeat;
     padding-right: 18px;
 }
 &lt;/source&gt;
 
 == Limitations and easy workarounds ==
 ===The problematic &quot;=&quot; character===
 When this template is used with [[m:Help:Templates#Restrictions on parameter values|unnamed parameters]], links containing the &quot;&lt;code&gt;=&lt;/code&gt;&quot; (equals sign) character will cause the link to not display at all.  Workarounds available are:
 *Use explicitly numbered parameters, {{para|1}} and {{para|2}}, for the URL and the file size, respectively
 or
 *Use &lt;code&gt;&lt;nowiki&gt;{{=}}&lt;/nowiki&gt;&lt;/code&gt; as a replacement for &lt;code&gt;=&lt;/code&gt;
 or
 *Replace the &lt;code&gt;=&lt;/code&gt; character with its [[Numeric character reference|numeric character entity reference]], &lt;code&gt;&amp;amp;#61;&lt;/code&gt;
 
 
 ;Bad example:
  &lt;nowiki&gt;{{PDFlink|[http://example.org/bla?a=xy|Link.pdf Link to a PDF]|32&amp;amp;nbsp;KB}}&lt;/nowiki&gt;
 :{{PDFlink|[http://example.org/bla?a=xy/Link.pdf Link to a PDF]|32&amp;nbsp;KB}}
 
 
 ;Good examples:
  &lt;nowiki&gt;{{PDFlink|[http://example.org/bla?a&lt;/nowiki&gt;&lt;span style=&quot;color: red;&quot;&gt;'''&amp;amp;#61;'''&lt;/span&gt;xy&lt;span style=&quot;color: red;&quot;&gt;'''&amp;amp;#124;'''&lt;/span&gt;Link.pdf Link to a PDF]|32&amp;amp;nbsp;KB}}
 :{{PDFlink|[http://example.org/bla?a&amp;#61;xy&amp;#124;Link.pdf Link to a PDF]|32&amp;nbsp;KB}}
 
  &lt;nowiki&gt;{{PDFlink|&lt;/nowiki&gt;'''&lt;span style=&quot;color: red;&quot;&gt;1=&lt;/span&gt;'''&lt;nowiki&gt;[http://example.org/bla?a=xy&lt;/nowiki&gt;&lt;span style=&quot;color: red;&quot;&gt;'''&lt;nowiki&gt;{{!}}&lt;/nowiki&gt;'''&lt;/span&gt;Link.pdf Link to a PDF]|'''&lt;span style=&quot;color: red;&quot;&gt;2=&lt;/span&gt;'''32&amp;amp;nbsp;KB}}
 :{{PDFlink|1=[http://example.org/bla?a=xy{{!}}Link.pdf Link to a PDF]|2=32&amp;nbsp;KB}}
 
 ===Use in citation templates===
 This template is not instantly compatible with citation templates such as {{tl|cite book}} and {{tl|cite web}}, which put URLs in their own parameter, without markup.  Two kinds of usage need two different workarounds, both using the invisible but existent &quot;no-width space&quot; numeric character entity reference, &lt;code&gt;&amp;amp;#8203;&lt;/code&gt;.
 
 
 ;URLs ending in &quot;.pdf&quot; or &quot;.PDF&quot;:
 
 The workaround is to not use an actual URL (and no [square brackets]) in the {{tl|PDFlink}} first parameter, but just the &lt;code&gt;&amp;amp;#8203;&lt;/code&gt; entity:
 
  &lt;nowiki&gt; |title=Some Article
  |url=http://www.example.org/fileserver/Link.pdf
  |format={{PDFlink|&amp;amp;#8203;|1.4&amp;nbsp;MB}}&lt;/nowiki&gt;
 
 renders as something like:
 
 :[http://www.example.org/fileserver/Link.pdf Some Article] ({{PDFlink|&amp;#8203;|1.4&amp;nbsp;MB}})
 
 in the spaces that the parameters fill. (Exact spacing, punctuation, etc., depends on the specific citation template used). This prevents the appearance of a PDF icon auto-generated by MediaWiki being followed by one generated by {{tl|PDFlink}}.
 
 Doing this, however:
  &lt;nowiki&gt; |title=Some Article
  |url=http://www.example.org/fileserver/Link.pdf
  |format={{PDFlink|[http://www.example.org/fileserver/Link.pdf &amp;amp;#8203;]|1.4&amp;nbsp;MB}}&lt;/nowiki&gt;
 
 would result in:
 
 :[http://www.example.org/fileserver/Link.pdf Some Article] ({{PDFlink|[http://www.example.org/fileserver/Link.pdf &amp;#8203;]|1.4&amp;nbsp;MB}})
 
 This trick needs to be done with the character entity, because leaving the first parameter blank will simply get the page categorized in a cleanup category for pages that misuse this template, and a bot will &quot;fix&quot; the page's use of the template (i.e., it will cause problems).
 
 
 ;URLs not ending in &quot;.pdf&quot; or &quot;.PDF&quot;:
 
 The workaround is to repeat the URL used in {{para|url}} in {{tnull|PDFlink}} inside {{para|format}} as a square-backeted link, and use &lt;code&gt;&amp;amp;#8203;&lt;/code&gt; as the link text (note that numbered parameters are often required because of &quot;&lt;code&gt;=&lt;code&gt;&quot; characters in such URLs):
 
  &lt;nowiki&gt; |title=Some Article
  |url=http://www.example.org/fileserver&amp;file=2234234
  |format={{PDFlink|1=[http://www.example.org/fileserver&amp;file=2234234 &amp;amp;#8203;]|2=1.4&amp;nbsp;MB}}&lt;/nowiki&gt;
 
 yields:
 
 :[http://www.example.org/fileserver&amp;file=2234234 Some Article] ({{PDFlink|1=[http://www.example.org/fileserver&amp;file=2234234 &amp;#8203;]|2=1.4&amp;nbsp;MB}})
 
 I.e., it produces a PDF icon that links to the same target as the URL given in the citation template's {{para|url}} parameter, without creating new link text, and meanwhile MediaWiki did not know this was a PDF file and so did not autogenerate a duplicative icon.
 
 [[fr:Modèle:pdf]]
 [[simple:Template:PDFlink]]