Changes

Jump to: navigation, search

Module:Set page header

1,082 bytes added, 7 months ago
Making the region and edition matching more dynamic, less dependent on the "CG" in the page name
medium = {},
edition = nil,
releaseDate = nil, isParentSet = nil,
}
local function getRegion( pagename )
-- Get content after the first hyphen after the last `(` in the page name -- up until the next `-` or `)` -- More specifically match -- `(` -- Any amount of non-`(` non-`-` -- `-` -- Any amount of non-`(` non-`-` (Capture the text in this group) -- An optional `-` -- An optional amout of non-`(` non-`-` -- A `)` -- the end of the string local index = pagename:match( 'CG%([^%(-]*-([^%a+(-]*)-?[^%(-?]*%)$' )
local region = DATA.getRegion( index ) -- TODO: handle erroneous region (nil)?
local function getEdition( pagename )
-- Get content after the second hyphen after the last `(` in the page name. local index = pagename:match( 'CG%([^%(-]*-[^%a+(-]*-([^%-(]*)%w+)$' )
local edition = DATA.getEdition( index ) -- TODO: handle erroneous edition (nil)?
end
if ( ns == 'Set Card Lists' and releaseData.isParentSet ) then table.insert( categories, '[[Category:Set Card Lists for parent sets]]' ) end  -- Set lists with no release dates -- Excludes lists for parent sets, whose children each have individual release dates if ( ns == 'Set Card Lists' and not releaseData.releaseDate and not releaseData.isParentSet ) then
table.insert( categories, '[[Category:Set Card Lists with no release date]]' )
end
-- Bit sloppy, but we need to fallback to this if "Worldwide English release date" is empty
'?English release date = englishReleaseDate',
'?-Parent set = isParentSet',
mainlabel = '-'
}
releaseData.name = queriedData.name
releaseData.localName = args.name or queriedData.localName
releaseData.isParentSet = queriedData.isParentSet and true or false
-- For now, only do the release date for list pages
-- Don't add it to parent set lists e.g. the overall "Shonen Jump promotional cards" list -- which have multiple releases, each with their own set list. if ( ns == 'Set Card Lists' and not queriedData.isParentSet ) then
releaseData.releaseDate = args.releaseDate or queriedData.releaseDate
-- If 'Worldwide English' and the `releaseDate` is empty, check the `englishReleaseDate`
if ( not releaseData.releaseDate and releaseData.region.full == 'Worldwide English' ) then
releaseData.releaseDate = queriedData.englishReleaseDate
end

Navigation menu