Module:Link and Form:New song: Difference between pages

From SPCodex, The Smashing Pumpkins wiki
(Difference between pages)
No edit summary
 
No edit summary
 
Line 1: Line 1:
local str = {}
<noinclude>
This is the form to create a new Song article. Enter the name of the song below to get started.


function str.producer( frame )
If a song with the same name already exists, you will be sent to a form to edit that song.
local new_args = str._getParameters( frame.args, { 'source' } )
local content = new_args['source'] or ''
if content == '' then
return content
end


for _i, subject in ipairs({ 'Billy Corgan', 'Butch Vig' }) do
{{#forminput:form=New song}}
mw.ustring.gsub( content, subject, '[[:Category:Songs produced by ' .. subject .. '|' .. subject .. ']]' )
end


return content
</noinclude><includeonly><templatestyles src="Form:New song/styles.css" />
end
<div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>
{{{for template|Infobox song|label=Infobox}}}
{| class="formtable"
! '''Name''': {{input-required}}
| style="padding-left:10px" | {{{field|name|label=Name|default= {{PAGENAME}} }}}
|-
! Type:
| style="padding-left:10px" | {{{field|type|mandatory|cargo table=songs|cargo field=type|show on select=cover=>original_artist;single=>cover;single=>discogs;single=>musicbrainz;promo=>cover;promo=>discogs;promo=>musicbrainz}}}
|- id="cover"
! Cover artwork:
| style="padding-left:10px" | {{{field|cover|cargo table=songs|cargo field=cover}}}
|-
! Artist: {{input-required}}
| style="padding-left:10px" | {{{field|artist|mandatory|input type=text with autocomplete|cargo table=songs|cargo field=artist}}}
|- id="original_artist"
! Original artist:
| style="padding-left:10px" | {{{field|original_artist|cargo table=songs|cargo field=original_artist}}}
|-
! Album:
| style="padding-left:10px" | {{{field|album|input type=text with autocomplete|cargo table=songs|cargo field=main_album}}}
|-
! Release date:
| style="padding-left:10px" | {{{field|released|input type=datepicker|date format=yy-mm-dd}}}
|-
! Length:
| style="padding-left:10px" | {{{field|length|input type=regexp|regexp=/^(?:(?:\d{1,2}:)?\d{1,2}:\d{2})?$/}}}
|-
! Writer(s): {{input-required}}
| style="padding-left:10px" | {{{field|writer|mandatory|input type=text with autocomplete|cargo table=songs|cargo field=writer}}}
|-
! Producer(s):
| style="padding-left:10px" | {{{field|producer|input type=text with autocomplete|cargo table=albums|cargo field=producer}}}
|-
! Spotify ID:
| style="padding-left:10px" | {{{field|spotify}}}
|- id="discogs"
! Discogs master ID:
| style="padding-left:10px" | {{{field|discogs}}}
|- id="musicbrainz"
! MusicBrainz release-group ID:
| style="padding-left:10px" | {{{field|musicbrainz}}}
|}
{{{end template}}}


--[[
'''Introduction:'''
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters.  This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function str._getParameters( frame_args, arg_list )
local new_args = {}
local index = 1
local value


for _, arg in ipairs( arg_list ) do
{{{standard input|free text|rows=10|editor=visualeditor|default="'''{{PAGENAME}}'''" is a song by [[The Smashing Pumpkins]] …}}}
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index + 1
end
new_args[arg] = value
end


return new_args
==Lyrics==
end
{{{section|Lyrics|level=2|hidden}}}{{{for template|lyrics}}}{{{field|1|input type=textarea}}}


return str
{{{end template}}}
 
{{{for template|Availability}}}{{{end template}}}
 
----
 
{{{standard input|summary}}}
 
{{{standard input|minor edit}}} {{{standard input|watch}}}
 
{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}
</includeonly>

Revision as of 04:21, 4 January 2022

This is the form to create a new Song article. Enter the name of the song below to get started.

If a song with the same name already exists, you will be sent to a form to edit that song.