Template:Listen: Difference between revisions

From Savez
Jump to navigation Jump to search
No edit summary
(Replaced content with "<includeonly>{{#invoke:Listen|main}}</includeonly><noinclude> {{documentation}} <!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> <templatedata> {{Listen | filename = | title = | description = | pos = }} </noinclude>")
Tag: Replaced
 
Line 1: Line 1:
{{Documentation subpage}}
<includeonly>{{#invoke:Listen|main}}</includeonly><noinclude>
{{for|the inline audio template|Template:Audio}}
{{documentation}}
{{Lua|Module:Listen}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
 
<templatedata>
{{tl|{{BASEPAGENAME}}}} allows audio and video files to be embedded in articles. It should be used for audio files that are set off from the text, such as music clips or sound recordings.
 
==Simple usage==
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Listen
{{Listen
| filename    =
| filename    =
Line 13: Line 9:
| pos        =
| pos        =
}}
}}
</syntaxhighlight>
</noinclude>
* '''filename''' ''(Required)'': the pagename of the media file, {{em|without}} the <code>File:</code> (formerly <code>Image:</code>) prefix
* '''title''' ''(Required)'': the title of the audio file, to be displayed. Do not use wikilinks in the title – they will not work.
* '''description''': a description of the sounds being heard
* '''pos''': right (default), left, or center
 
===Multiple files===
Additional files can be embedded in an article with one template by appending a number to each parameter.
 
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Listen
| filename    =
| title        =
| alt          =
| description  =
| filename2    =
| title2      =
| alt2        =
| description2 =
| filename3    =
| title3      =
| alt3        =
| description3 =
}}
</syntaxhighlight>
* '''filename''' ''(Required)'': the pagename of the media file, ''without'' the File: (formerly Image:) prefix
* '''title''' ''(Required)'': the title of the audio file, to be displayed.
* '''alt''': alt text for the image displayed for the file, for visually impaired readers; see ''[[Wikipedia:Alternative text for images]]''. This is needed for file formats such as [[Ogg]]'s <code>.ogv</code> format that include video as well as sound. The alt text should describe just the initial static image, not the entire video or its sound.
* '''description''': a description of the sounds being heard
 
==Style parameters==
The template also takes a number of style parameters to control its appearance:
* '''type''': can be used to alter the image displayed at the left depending on the type of audio content being embedded. Acceptable values are '''music''', '''speech''' and '''sound''' (default)
* '''header''': can be used to add a header to the box.
* '''help''': if set to {{para|help|no}}, suppresses the help text that normally appears at the bottom of the box. Only do this if there are other audio files on the page which ''do'' have the help link; it ''must'' be provided on ''at least'' the first file on the article.
* '''pos''': by default the box floats to the right side of the screen. Setting this to '''left''' or '''center''' will float the box on the left-hand side, or center it, respectively.
* '''image''': define a different image. E.g. {{nowrap|{{para|image|<nowiki>[[File:Example.jpg|50px]]</nowiki>}}}}. You can set {{para|image|none}} to disable the image entirely.
* '''style''': can be used to pass specific style instructions to the box. Setting this to '''float:none''' will anchor the box when this is convenient. Setting this to '''float:none; clear:none''' will enable the anchored box to co-exist gracefully beside another floating box.
* '''play''(n)''''': some media files cannot be displayed inline; if this is the case set {{para|play|no}} to prevent the broken inline link from displaying.
* '''plain''': if set {{para|plain|yes}}, removes most of the ornamentation (table border, image, and help links) to give a minimalist version. This also removes the left/right float and positioning, to allow the box to be manually positioned as desired using the {{para|style}} (e.g., {{Para|style|float:right}}) parameter and surrounding markup.
* '''embed''': use {{para|embed|yes}} to remove border and padding when using as a module embedded in another infobox (see examples below).
* '''start''(n)''''': Timestamp at which the file should start playing
* '''length''(n)''''': setting {{para|length''(n)''|hide}} hides the duration (h:m:s).
 
==Examples==
===Basic===
{{Listen
| filename    = Accordion chords-01.ogg
| title      = Accordion chords
| description = Chords being played on an accordion
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Listen
| filename    = Accordion chords-01.ogg
| title      = Accordion chords
| description = Chords being played on an accordion
}}
</syntaxhighlight>
{{-}}
 
===With video===
{{Listen
| image      = [[File:Crystal Project video camera.png|50px]]
| help        = no
| filename    = Barack Obama inaugural address.ogv
| alt        = A black man in a black coat gestures and talks at a lecturn surrounded by teleprompters. Behind him, in the background, are about a dozen warmly-dressed onlookers.
| title      = Inaugural address of Barack Obama
| description = Barack Obama's [[First inauguration of Barack Obama|first inaugural address]], January 20, 2009<br />(Duration: 21 minutes, 21 seconds)
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Listen
| image      = [[File:Crystal Project video camera.png|50px]]
| help        = no
| filename    = Barack Obama inaugural address.ogv
| alt        = A black man in a black coat gestures and talks at a lecturn surrounded by teleprompters. Behind him, in the background, are about a dozen warmly-dressed onlookers.
| title      = Inaugural address of Barack Obama
| description = Barack Obama's [[First inauguration of Barack Obama|first inaugural address]], January 20, 2009<br />(Duration: 21 minutes, 21 seconds)
}}
</syntaxhighlight>
{{-}}
 
===With header===
{{Listen
| header      = Recordings of this phrase:
| type        = speech
| filename    = Frase de Neil Armstrong.ogg
| title      = "One small step for a man..."
| description = First words spoken on the [[Moon]]
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Listen
| header      = Recordings of this phrase:
| type        = speech
| filename    = Frase de Neil Armstrong.ogg
| title      = "One small step for a man..."
| description = First words spoken on the [[Moon]].
}}
</syntaxhighlight>
{{-}}
 
===Embedding===
{{Infobox person
| name = Dr. Accordion
| occupation = Accordion player
| module =
{{Listen
| filename = Accordion chords-01.ogg
| title    = Accordion chords
| embed    = yes
}}
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox person
| name = Dr. Accordion
| occupation = Accordion player
| module =
{{Listen
| filename = Accordion chords-01.ogg
| title    = Accordion chords
| embed    = yes
}}
}}
</syntaxhighlight>
{{-}}
 
===Plain===
{|
|<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Listen
| filename = Accordion chords-01.ogg
| title    = Accordion chords
| plain    = yes
| style    = float:left
}}
</syntaxhighlight>
|{{Listen
| filename = Accordion chords-01.ogg
| title    = Accordion chords
| plain    = yes
| style    = float:left
}}
|}
{{-}}
 
===Multiple files===
{{Listen
| type        = music
| filename    = Accordion chords-01.ogg
| title        = Accordion chords
| description  = Chords being played on an accordion
| filename2    = Moonlight.ogg
| title2      = ''Moonlight Sonata''
| description2 = [[Ludwig van Beethoven|Beethoven]]'s [[Piano Sonata No. 14 (Beethoven)|Sonata in C-sharp minor]]
| filename3    = Brahms-waltz15.ogg
| title3      = Waltz No. 15
| description3 = From [[Sixteen Waltzes, Op. 39 (Brahms)|Sixteen Waltzes, Op. 39]] by [[Johannes Brahms|Brahms]]
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Listen
| type        = music
| filename    = Accordion chords-01.ogg
| title        = Accordion chords
| description  = Chords being played on an accordion
| filename2    = Moonlight.ogg
| title2      = ''Moonlight Sonata''
| description2 = [[Ludwig van Beethoven|Beethoven]]'s [[Piano Sonata No. 14 (Beethoven)|Sonata in C-sharp minor]]
| filename3    = Brahms-waltz15.ogg
| title3      = Waltz No. 15
| description3 = From [[Sixteen Waltzes, Op. 39 (Brahms)|Sixteen Waltzes, Op. 39]] by [[Johannes Brahms|Brahms]]
}}
</syntaxhighlight>
{{-}}
 
==Microformat==
{{UF-audio}}
 
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
    "description": "Allows audio and video files to be embedded in articles.",
"format": "{{_\n| ____________ = _\n}}\n",
"params": {
"header": {
"label": "Header",
"description": "Text or other content to go above all the files in the template (but within the template boundary). Allows markup.",
"type": "content"
},
"type": {
"label": "Music or speech icon",
"description": "Enter \"music\" or \"speech\" here to change the template icon to a speaker with music notes or a microphone.",
"type": "line",
"example": "music",
"default": "sound"
},
"image": {
"label": "Custom icon",
"description": "Custom image to replace the speaker icon in the template. Alternatively, enter \"none\" here to hide the icon entirely.",
"type": "wiki-file-name",
"example": "[[File:Example.jpg|50px]], none"
},
"filename": {
"label": "Filename",
"description": "The filename of the file. Filename2, filename3, etc. can be used for subsequent files.",
"type": "wiki-file-name",
"required": true
},
"title": {
"label": "Title",
"description": "The title to display for the file. Title2, title3, etc. can be used for subsequent files.",
"type": "string",
"required": true
},
"description": {
"label": "Description",
"description": "A description of the file. Description2, description3, etc. can be used for subsequent files.",
"type": "string",
"suggested": true
},
"start": {
"label": "Start time",
"description": "Timestamp at which the first file should start playing (start2, start3, etc. can be used for subsequent files)",
"type": "line",
"example": "0:20"
},
"length": {
"label": "Hide duration?",
"description": "Enter \"hide\" here to hide the duration of the first file (length2, length3, etc. can be used for subsequent files).",
"type": "line",
"example": "hide",
"autovalue": "hide"
},
"play": {
"label": "Hide player?",
"description": "Enter \"no\" here to hide the file player for the first file (play2, play3, etc. can be used for subsequent files). To be used for some media files that cannot be displayed inline, to prevent a broken inline link from showing.",
"type": "line",
"example": "no",
"autovalue": "no"
},
"help": {
"label": "Hide help text?",
"description": "Enter \"no\" here to hide the \"Problems playing this file? See media help.\" text at the bottom of the template. Must not be done on the first instance of the template; optional on subsequent instances of the template.",
"type": "line",
"example": "no",
"autovalue": "no"
},
"pos": {
"label": "Position",
"description": "Enter \"left\" or \"center\" here to change the default position of the template from on the right.",
"type": "line",
"example": "left",
"default": "right"
},
"plain": {
"label": "Plain style?",
"description": "Enter \"yes\" here to remove most of the ornamentation (border, background, icon and help text) and the float/positioning of the template to give a minimalist version, allowing the user to use the custom CSS (\"style\") parameter to style and position the template.",
"type": "line",
"example": "yes",
"autovalue": "yes"
},
"embed": {
"label": "Optimise for embedding?",
"description": "Enter any text here to remove the left, right and bottom border, the background, the icon, the help text and the padding of the template for use in an infobox.",
"type": "line",
"example": "y",
"autovalue": "y"
},
"style": {
"label": "Custom CSS",
"description": "Custom CSS for the template",
"type": "content",
"example": "float:none; clear:none"
}
},
"paramOrder": [
"header",
"type",
"image",
"filename",
"title",
"description",
"start",
"length",
"play",
"help",
"pos",
"plain",
"embed",
"style"
]
}
</templatedata>
 
==See also==
{{Audio templates}}
{{Film- and television-related infobox templates}}
 
<includeonly>{{Sandbox other||
[[Category:Audio templates]]
[[Category:Embeddable templates]]
[[Category:Templates that add a tracking category]]
}}</includeonly>

Latest revision as of 17:39, 12 July 2023

<templatedata>