Kontent qismiga oʻtish

Modul:Music ratings

Vikipediya, erkin ensiklopediya
Professional Reytinglar
Review scores
ManbaReyting

Instructions

[manbasini tahrirlash]

This template provides a brief summary and overview of the critical consensus of song and album reviews. It is used to display only brief and objectively-verifiable ratings, such as "", "B+", or "7/10". It cannot capture the general sense of a review that does not include any kind of scale, so do not include language like "Very favorable" or "(mixed)" in the template, as this would be original research.

The template is not to be a substitute for a section in paragraph form, since a review can not be accurately boiled down to a simple rating out of five stars or other numeric score. If an article is lacking a reception section in prose, but the information is presented in table format, the |noprose=yes parameter can be used to tag the article as needing a reception section in prose.

This template is generally the first element after the heading for the section on Reception, Critical reception, Reviews, or something similar. If one of those sections is not present, the template should be placed immediately after the infobox, and can then be moved once a Reception section is present.

The reviews should be listed alphabetically in the Reviews field. The information in the reviewer field should be the name of the source (most commonly an online music service like AllMusic, or a music magazine like Rolling Stone—note that magazines are italicized). Don't forget to wikilink to the relevant article.

The information in the score field should be the rating given in the review (e.g. 4/5). The rating should use the same format as in the review, to portray the score of the review accurately. For star ratings you should use the star rating template; for example, entering {{Rating|4.5|5}}, will render: .

For reviews at AllMusic it is convenient to use the {{AllMusic}} template.

For review aggregators AnyDecentMusic? and Metacritic it is convenient to use the fields ADM and MC in the template, respectively.

For reviews from Robert Christgau's Consumer Guide you may use the Christgau rating template. For example, entering {{Rating-Christgau|dud}} will render: Andoza:Rating-Christgau.

Note that the minus sign character () is not the same thing as a hyphen (-), so "B–", not "B-". They appear similar but you can use the proper character by inputting &amp;minus; or using the Insert menu that is available in the editing window on Wikipedia; it is located near other such arithmetic operators like <×> and <÷>.

After the rating should be the citation of the source of the review. Per Wikipedia:Citing sources do not add reviews without a citation. This means a properly formatted footnote, in most cases providing the author, date, and source, along with an external link if available. Do not use an embedded link with no information (e.g. link) as this promotes link rot and is inconsistent with Wikipedia's policy on embedded links. If you must use an embedded link, be sure to manually provide a full citation in the article's References section per Wikipedia:Citing sources.

{{Music ratings
| title = 
| subtitle = 
<!-- Aggregate scores -->
| ADM = 
| MC = 
| aggregate1 = 
| aggregate1score = 
| aggregate2 = 
| aggregate2score = 
| aggregate3 = 
| aggregate3score = 
<!-- ... -->
<!-- Reviewers -->
| rev1 = 
| rev1score = 
| rev2 = 
| rev2score = 
| rev3 = 
| rev3score = 
<!-- ... -->
<!-- Article needs reviews expanded into prose -->
| noprose = <!--yes-->
}}

Required fields:

rev#
The name of the reviewer. It is recommended to include no more than 10 reviews , but you can add more in exceptional circumstances. For instance, a particularly popular song or album which has been re-released and has several prominent reviews over decades' time.
rev#score
The rating given by the reviewer.

All of the following fields are optional:

title
Can be used to provide a custom title for the table, otherwise, it will default to "Professional ratings".
subtitle
Used to add additional text before the collapsible section. This is necessary to add if want a longer title, as long titles via the "title" parameter will not center correctly.
width
Sets the width of the table; default is 24.2em, to match the width of the song and album infoboxes in most browsers and skins.
ADM
AnyDecentMusic? score.
MC
Metacritic score.
aggregate#
Name of a review aggregator.
aggregate#score
The rating given by the review aggregator.
noprose
Should only be used for articles that do not have a Reception section summarizing the reviews. If set to yes, will categorize articles into Category:Articles with music ratings that need to be turned into prose.

For example, entering

{{Music ratings
| MC = 69/100<ref name="Meta">{{cite web|url=http://www.metacritic.com/music/black-gives-way-to-blue/alice-in-chains|title=Black Gives Way To Blue|publisher=Metacritic|access-date=2 September 2012}}</ref>
| rev1 = [[AllMusic]]
| rev1score = {{Rating|4.5|5}}<ref name="AM">{{Allmusic |class=album |id=r70661 |tab=review |label=Alice in Chains: ''Dirt'' > Review |first=Steve |last=Huey |accessdate=31 January 2010}}</ref>
| rev2 = ''[[Q (magazine)|Q]]''
| rev2score = {{Rating|4|5}}<ref name="Q">{{cite magazine |last=Doe |first=Jane |title=Review: ''Dirt'' |magazine=[[Q (magazine)|Q]] |issue=65 |date=February 2002 |page=120}}</ref>
| rev3 = [[Robert Christgau]]
| rev3score = B<ref name="RC">{{cite web |first=Robert |last=Christgau |title=Review: ''Dirt'' |url=http://www.robertchristgau.com/get_artist.php?name=Alice+in+Chains |publisher=[[Robert Christgau]] |access-date=31 January 2010}}</ref>
}}

will render

Andoza:Music ratings

and generate the following footnotes with the sources:

Tracking categories

[manbasini tahrirlash]

Template data

[manbasini tahrirlash]
Bu TemplateData TemplateWizard, VisualEditor va boshqa vositalar uchun ishlab chiqilgan.

Music ratings uchun TemplateData

This template creates a table with reviews for songs and albums. Only add a rating if you cite it with a reference. The template is not to be a substitute for a section in paragraph form.

Andoza parametrlari[„TemplateData“ni boshqarish]

This template prefers block formatting of parameters.

ParametrTavsifTuriStatus
1st reviewerrev1

The name of the first reviewer.

Stringrequired
1st reviewer's ratingrev1score rev1Score

The rating given by the first reviewer.

Stringrequired
2nd reviewerrev2

The name of the second reviewer. More reviewers can be added with parameters in the format rev[#] (the next one would be rev3). It is recommended to include no more than 10 reviews, but more can be added in exceptional circumstances.

Stringixtiyoriy
2nd reviewer's ratingrev2score rev2Score

The rating given by the second reviewer. More ratings can be added with parameters in the format rev[#]score (the next one would be rev3score). It is recommended to include no more than 10 reviews, but more can be added in exceptional circumstances.

Stringixtiyoriy
3rd reviewerrev3

tavsif yoʻq

Stringixtiyoriy
3rd reviewer's ratingrev3score rev3Score

tavsif yoʻq

Stringixtiyoriy
4th reviewerrev4

tavsif yoʻq

Stringixtiyoriy
4th reviewer's ratingrev4score rev4Score

tavsif yoʻq

Stringixtiyoriy
5th reviewerrev5

tavsif yoʻq

Stringixtiyoriy
5th reviewer's ratingrev5score rev5Score

tavsif yoʻq

Stringixtiyoriy
6th reviewerrev6

tavsif yoʻq

Stringixtiyoriy
6th reviewer's ratingrev6score rev6Score

tavsif yoʻq

Stringixtiyoriy
7th reviewerrev7

tavsif yoʻq

Stringixtiyoriy
7th reviewer's ratingrev7score rev7Score

tavsif yoʻq

Stringixtiyoriy
8th reviewerrev8

tavsif yoʻq

Stringixtiyoriy
8th reviewer's ratingrev8score rev8Score

tavsif yoʻq

Stringixtiyoriy
9th reviewerrev9

tavsif yoʻq

Stringixtiyoriy
9th reviewer's ratingrev9score rev9Score

tavsif yoʻq

Stringixtiyoriy
10th reviewerrev10

tavsif yoʻq

Stringixtiyoriy
10th reviewer's ratingrev10score rev10Score

tavsif yoʻq

Stringixtiyoriy
AnyDecentMusic scoreADM

The AnyDecentMusic? score. Appears under the "Aggregate scores" header.

Stringixtiyoriy
Metacritic scoreMC

The Metacritic score. Appears under the "Aggregate scores" header.

Stringixtiyoriy
1st review aggregatoraggregate1

The name of the first review aggregator.

Stringixtiyoriy
1st review aggregator's ratingaggregate1score

The rating given by the first review aggregator.

Stringixtiyoriy
2nd review aggregatoraggregate2

The name of the second review aggregator.

Stringixtiyoriy
2nd review aggregator's ratingaggregate2score

The rating given by the second review aggregator.

Stringixtiyoriy
Table titletitle

A custom title for the table, replacing "professional ratings".

Stringixtiyoriy
Table subtitlesubtitle

Additional text before the collapsible section. This is necessary to add if you want a longer title, as long titles in the "title" parameter will not work right.

Stringixtiyoriy
Table widthwidth

The width of the table.

Stringixtiyoriy
Table alignalign

The value is "left" if you want to place the table on the left.

Avto-qiymat
left
Qatorixtiyoriy
Article lacks prose sectionnoprose

Set to yes if there is just a single ratings template in the reception section and prose text is missing

Avto-qiymat
yes
Qatorixtiyoriy
Table state (collapse)state

Automatically collapses the template and adds a "show" button.

Taklif etilgan qiymatlar
collapsed
Avto-qiymat
collapsed
Qatordeprecated

-- This module implements [[Template:Album ratings]].

local mTableTools = require('Module:TableTools')
local yesno = require('Module:Yesno')
local p = {}

local function makeCell(html, s)
	html
		:tag('td')
			:css('text-align', 'center')
			:css('vertical-align', 'middle')
			:wikitext(s)
end

local function makeRow(review, score)
	local row = mw.html.create('tr')
	makeCell(row, review)
	makeCell(row, score)
	return row
end

local function makeHeaderRow(header, background, scope)
	local row = mw.html.create('tr')
	row
		:tag('th')
			:attr('scope', scope ~= false and 'col' or nil)
			:attr('colspan', 2)
			:css('text-align', 'center')
			:css('background', background ~= false and '#d1dbdf' or nil)
			:css('font-size', '100%')
			:wikitext(header)
	return row
end

local function makeRatingHeaderRow()
	local row = mw.html.create('tr')
	row
		:tag('th')
			:attr('scope', 'col')
			:wikitext('Manba')
			:done()
		:tag('th')
			:attr('scope', 'col')
			:wikitext('Reyting')
	return row
end

local function getScore(scoreArgs, length)
	for i = 1, length do
		local arg = scoreArgs[i]
		if arg then
			return arg
		end
	end
	return nil
end

local function hasDuplicateScores(scoreArgs, length)
	local count = 0
	for i = 1, length do
		local arg = scoreArgs[i]
		if arg then
			count = count + 1
		end
	end
	return count > 1
end

local function ucfirst(s)
	local first = s:sub(1, 1)
	local others = s:sub(2, -1)
	return first:upper() .. others
end

local function getArgPermutations(args, prefix, num, suffix)
	local prefixUpper = ucfirst(prefix)
	local suffixUpper = ucfirst(suffix)
	return {
		args[prefix .. num .. suffix],
		args[prefixUpper .. num .. suffix],
		args[prefix .. num .. suffixUpper],
		args[prefixUpper .. num .. suffixUpper],
	}, 4 -- The 4 is the length of the array; this is needed as the args may be nil
end

local function makeWikilink(page, display)
	if not page and not display then
		error('no arguments provided to makeWikilink', 2)
	elseif display and not page then
		return display
	elseif page and not display or page == display then
		return string.format('[[%s]]', page)
	else
		return string.format('[[%s|%s]]', page, display)
	end
end

local function findSortText(wikitext)
	-- Simplified wikitext parser that returns a value that can be used for
	-- sorting.
	wikitext = mw.text.killMarkers(wikitext)
	-- Replace piped links with their display values
	wikitext = wikitext:gsub('%[%[[^%]]*|([^%]]-)%]%]', '%1')
	-- Replace non-piped links with their display values
	wikitext = wikitext:gsub('%[%[([^%]]-)%]%]', '%1')
	-- Strip punctuation
	wikitext = wikitext:gsub('%p', '')
	-- Trim whitespace
	wikitext = wikitext:gsub('^%s*', ''):gsub('%s*$', '')
	return wikitext
end

function p._main(args)
	local root = mw.html.create()
	local tableRoot = root:tag('table')

	-- Table base
	tableRoot
		:addClass('wikitable')
		:addClass( (args.align == 'left') and 'floatleft' or 'floatright' )
		:css('float', (args.align == 'left') and 'left' or 'right')
		:css('clear', (args.align == 'left') and 'left' or 'right')
		:css('width', args.width or '24.2em')
		:css('font-size', '88%')
		:css('text-align', 'center')
		:css('margin', (args.align == 'left') and '0.5em 1em 0.5em 0' or '0.5em 0 0.5em 1em')
		:css('padding', 0)
		:css('border-spacing', 0)
		:tag('caption')
			:attr('scope', 'col')
			:attr('colspan', 2)
			:css('font-size', '115%')
			:wikitext(args.title or 'Professional Reytinglar')

	-- Subtitle
	if args.subtitle then
		tableRoot:node(makeHeaderRow(args.subtitle, false, false))
	end

	-- Aggregate rows
	local aggregateNums = mTableTools.affixNums(args, 'aggregate')
	if args.MC or args.ADM or #aggregateNums > 0 then
		tableRoot:node(makeHeaderRow('Aggregate scores', true, true))
		tableRoot:node(makeRatingHeaderRow())

		-- Assemble all of the aggregate scores
		local aggregates = {}
		if args.MC then
			table.insert(aggregates, {
				name = '[[Metacritic]]',
				sort = 'Metacritic',
				score = args.MC,
			})
		end
		if args.ADM then
			table.insert(aggregates, {
				name = '[[AnyDecentMusic?]]',
				sort = 'AnyDecentMusic?',
				score = args.ADM,
			})
		end
		for i, num in ipairs(aggregateNums) do
			local name = args['aggregate' .. num]
			local sort = findSortText(name)
			local score = args['aggregate' .. num .. 'score']
			table.insert(aggregates, {
				name = name,
				sort = sort,
				score = score,
			})
		end

		-- Sort the aggregates
		if not args.aggregatenosort then
			table.sort(aggregates, function (t1, t2)
				return t1.sort < t2.sort
			end)
		end

		-- Add the aggregates to the HTML
		for i, t in ipairs(aggregates) do
			tableRoot:node(makeRow(t.name, t.score))
		end
	end

	-- Review rows
	local reviewNums = mTableTools.affixNums(args, 'rev')
	local duplicateScores = false
	tableRoot:node(makeHeaderRow('Review scores', true, true))
	tableRoot:node(makeRatingHeaderRow())
	for i, num in ipairs(reviewNums) do
		local scoreArgs, nScoreArgs = getArgPermutations(args, 'rev', num, 'score')
		tableRoot:node(makeRow(
			args['rev' .. num],
			getScore(scoreArgs, nScoreArgs)
		))
		if not duplicateScores and hasDuplicateScores(scoreArgs, nScoreArgs) then
			duplicateScores = true
		end
	end

	-- Tracking category
	if mw.title.getCurrentTitle().namespace == 0 and yesno(args.noprose) then
		root:wikitext('[[Category:Articles with music ratings that need to be turned into prose]]')
	end
	if duplicateScores then
		root:wikitext('[[Category:Pages using music ratings with duplicate score parameters]]')
	end

	return tostring(root)
end

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame, {
		wrappers = 'Template:Music ratings'
	})
	return p._main(args)
end

return p