Jump to content

Template:Audio sample/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
use a free file
updated with new parameter, etc.
Line 2: Line 2:
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. -->


Audio samples may be uploaded to as long as they comply with copyright law and Wikipedia guidelines (see [[WP:SAMPLE]]). Use this template to add an audio sample link to an infobox created by {{tl|Infobox song}}.
{{infobox|data1={{parameter names example||type=song|file=Wikipedia.ogg}}}}

== Usage ==
== Usage ==
This template is used with the {{para|misc}} parameter of the infobox template. It should not be used on its own. If this template is substituted, it will return a cleaned-up copy of itself with unnecessary parameters removed and deprecated parameters replaced. Parameter indentation will also automatically be fixed.


=== Code ===
If this template is substituted, it will return a cleaned-up copy of itself with unnecessary parameters removed and deprecated parameters replaced. Parameter indentation will also automatically be fixed.
{{infobox|data1={{parameter names example||type=song|file=Wikipedia.ogg}}}}

<pre style="overflow:auto;">{{Infobox song
=== Syntax ===
...

| misc = {{subst:Audio sample
<pre>
{{subst:Audio sample
| type =
| type =
| header =
| header =
| file =
| file =
| description =
| description =
}}
}}
</pre>
</pre>


; type : Enter the same type specified in the {{tl|Infobox song}} parameter {{para|type}}. If not used or set to {{para|type|single}}, a header with a khaki background color is created. Set to {{para|type|song}} to generate a light blue background.
=== Parameters ===
; header : Enter the text for the header. If not used, the default is <code>Audio sample</code>. For no header, enter {{para|header|no}}. For audio samples links, set the first to {{para|header|Audio samples}} and the succeeding links to {{para|header|no}}, so only one header for all will be created (see Example).
{| class=wikitable
; file : Enter the name of the audio file, without the preceding <code>File:</code>. For example for [[:File:Silent Night (choral).ogg]], enter <code>Silent Night (choral).ogg</code>.
! Parameter !! Description
; description : Since the infobox already provides the name of the song, artist, dates, etc., an additional description is usually not necessary. However, "Live version", "2010 remix", etc., may be added if needed.
|-

| type || Specify <code>single</code>, <code>song</code>, or a code from {{tl|Infobox album/doc/type}} – this sets the header color.
==Example==
|-
<pre style="overflow:auto;">{{Infobox song
| header || "Audio sample" is the default header. A custom header may be added or to hide it altogether, specify <code>none</code>.
...
|-
| misc = {{subst:Audio sample
| file || Name of the audio file. For example, for [[:File:americaog.ogg]], specify <code>americaog.ogg</code>.
| type = song
|-
| header = Audio samples
| description || Since the infobox already provides the name of the song, artist, dates, etc., an additional description is usually not necessary.
| file = Silent Night (choral).ogg
|}
| description = Choral version
}}{{subst:Audio sample
| type = song
| header = no
| file = Gruber - Schumann-Heink - Stille Nacht.ogg
| description = Soprano solo version
}}
</pre>


== Microformat ==
== Microformat ==

Revision as of 15:40, 15 July 2017

Audio samples may be uploaded to as long as they comply with copyright law and Wikipedia guidelines (see WP:SAMPLE). Use this template to add an audio sample link to an infobox created by {{Infobox song}}.

Usage

This template is used with the |misc= parameter of the infobox template. It should not be used on its own. If this template is substituted, it will return a cleaned-up copy of itself with unnecessary parameters removed and deprecated parameters replaced. Parameter indentation will also automatically be fixed.

Code

Audio sample
{{Infobox song
...
| misc         = {{subst:Audio sample
 | type        = 
 | header      = 
 | file        = 
 | description =
 }}
type
Enter the same type specified in the {{Infobox song}} parameter |type=. If not used or set to |type=single, a header with a khaki background color is created. Set to |type=song to generate a light blue background.
header
Enter the text for the header. If not used, the default is Audio sample. For no header, enter |header=no. For audio samples links, set the first to |header=Audio samples and the succeeding links to |header=no, so only one header for all will be created (see Example).
file
Enter the name of the audio file, without the preceding File:. For example for File:Silent Night (choral).ogg, enter Silent Night (choral).ogg.
description
Since the infobox already provides the name of the song, artist, dates, etc., an additional description is usually not necessary. However, "Live version", "2010 remix", etc., may be added if needed.

Example

{{Infobox song
...
| misc         = {{subst:Audio sample
 | type        = song
 | header      = Audio samples
 | file        = Silent Night (choral).ogg
 | description = Choral version
 }}{{subst:Audio sample
 | type        = song
 | header      = no
 | file        = Gruber - Schumann-Heink - Stille Nacht.ogg
 | description = Soprano solo version
 }}

Microformat

The HTML mark-up produced by this template includes an hAudio microformat that makes an audio recording's details readily parsable by computer programs. This aids tasks such as the cataloguing of articles and maintenance of databases. For more information about the use of microformats on Wikipedia, please visit the Microformat WikiProject.

Subtemplates

Date-of-publication ("published") information will only be included in the microformat if {{start date}} (or, where appropriate, {{start date and age}}) is used in a parent infobox/template. Do not, however, use {{start date}} or {{start date and age}} if a date before 1583 CE is involved.

Use {{duration}} to specify the duration/length of a recording. For instance, if the recording's duration is 3 minutes 45 seconds, use {{duration|m=3|s=45}} (which appears as: 3:45). If needed, |h= may be included to specify a number of hours.

Please do not remove instances of these subtemplates.

Classes used

The HTML classes of this microformat include:

  • haudio
  • fn
  • album
  • description
  • category
  • contributor
  • duration
  • h
  • item
  • min
  • photo
  • position
  • price
  • published
  • s
Please do not rename or remove these classes
nor collapse nested elements which use them.

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Audio sample in articles based on its TemplateData.

TemplateData for Audio sample

Adds an audio sample for album and song infoboxes. Use in the "misc" parameter of those templates.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Typetype

Type of recording (this changes the colour of the header), such as single for khaki or song for light blue. For album types, see [[Template:Infobox album/color]]

Example
song, single
Stringrequired
Headerheader

Change the header text. If value is "none", then the header will not be displayed.

Example
none
Stringoptional
Filefile

Audio file to be shown.

Example
Example.ogg
Filerequired
Descriptiondescription

Description of the audio file

Example
"O Kazakhstan" (instrumental)
Stringoptional