From 78f829f7719af405e9901a5d6f5e8641deb246fe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 Jan 2024 10:53:40 +0900 Subject: [PATCH] Update Scribunto module(s) (#184) Co-authored-by: GitHub --- lua/en/Hatnote%20list | 17 ++------ lua/en/Navbar | 4 +- lua/en/String | 2 +- lua/en/Wd | 15 ++++--- lua/ko/Citation%2FCS1 | 4 +- lua/ko/Citation%2FCS1%2FConfiguration | 32 ++++++++++++++ lua/ko/Citation%2FCS1%2FIdentifiers | 61 +++++++++++++++++++++++++++ lua/ko/Citation%2FCS1%2FWhitelist | 5 +++ lua/ko/Langname%2Fdata | 21 ++++++--- lua/ko/Navbox | 4 +- scribunto.lock | 20 ++++----- 11 files changed, 143 insertions(+), 42 deletions(-) diff --git a/lua/en/Hatnote%20list b/lua/en/Hatnote%20list index 6fc9760..71e17ee 100644 --- a/lua/en/Hatnote%20list +++ b/lua/en/Hatnote%20list @@ -99,18 +99,9 @@ local forSeeDefaultOptions = { forSeeForm = 'For %s, see %s.', } ---Collapses duplicate punctuation +--Collapses duplicate punctuation at end of string, ignoring italics and links local function punctuationCollapse (text) - local replacements = { - ["%.%.$"] = ".", - ["%?%.$"] = "?", - ["%!%.$"] = "!", - ["%.%]%]%.$"] = ".]]", - ["%?%]%]%.$"] = "?]]", - ["%!%]%]%.$"] = "!]]" - } - for k, v in pairs(replacements) do text = string.gsub(text, k, v) end - return text + return text:match("[.?!]('?)%1(%]?)%2%.$") and text:sub(1, -2) or text end -- Structures arguments into a table for stringification, & options @@ -153,7 +144,7 @@ function p.forSeeArgsToTable (args, from, options) -- If the param after next is "and", do inner loop to collect params -- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3} while args[i + 2] == options.andKeyword do - if args[i + 3] then + if args[i + 3] then table.insert(forRow.pages, args[i + 3]) end -- Increment to next "and" @@ -164,7 +155,7 @@ function p.forSeeArgsToTable (args, from, options) -- Append the row table.insert(forTable, forRow) until terminated or i > maxArg - + return forTable end diff --git a/lua/en/Navbar b/lua/en/Navbar index 6b2195d..62b8688 100644 --- a/lua/en/Navbar +++ b/lua/en/Navbar @@ -71,9 +71,9 @@ local function make_list(title_text, has_brackets, displayed_links, is_mini, fon { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template', ['link'] = talkpage, ['url'] = false }, { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template', - ['link'] = title:fullUrl('action=edit'), ['url'] = true }, + ['link'] = 'Special:EditPage/' .. title.fullText, ['url'] = false }, { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template', - ['link'] = title:fullUrl('action=history'), ['url'] = true }, + ['link'] = 'Special:PageHistory/' .. title.fullText, ['url'] = false }, { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template', ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true }, { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', diff --git a/lua/en/String b/lua/en/String index 7d11aee..8e063fb 100644 --- a/lua/en/String +++ b/lua/en/String @@ -62,7 +62,7 @@ OR Parameters s: The string to return a subset of - i: The fist index of the substring to return, defaults to 1. + i: The first index of the substring to return, defaults to 1. j: The last index of the string to return, defaults to the last character. The first character of the string is assigned an index of 1. If either i or j diff --git a/lua/en/Wd b/lua/en/Wd index 1559bbc..8ecd8f8 100644 --- a/lua/en/Wd +++ b/lua/en/Wd @@ -68,7 +68,8 @@ p.flags = { p.args = { eid = "eid", page = "page", - date = "date" + date = "date", + globalSiteId = "globalSiteId" } local aliasesP = { @@ -1820,7 +1821,7 @@ function State:getReference(statement) local additionalRefProperties = {} -- will hold properties of the reference which are not in statement.snaks, namely backup title from "subject named as" and URL from an external ID local wikidataPropertiesOfSource -- will contain "Wikidata property" properties of the item in stated in, if any - local version = 4 -- increment this each time the below logic is changed to avoid conflict errors + local version = 5 -- increment this each time the below logic is changed to avoid conflict errors if statement.snaks then -- don't include "imported from", which is added by a bot @@ -2007,7 +2008,7 @@ function State:getReference(statement) -- (3) if the citation couldn't be displayed using Cite web or Cite Q, but has properties other than the removed ones, throw an error elseif not referenceEmpty then - value = "" .. errorText("malformed-reference") .. "" + value = "" .. errorText("malformed-reference") .. "" end if value ~= "" then @@ -2204,7 +2205,7 @@ function State:iterate(statements, hooks, matchHook) return self:out() end -local function getEntityId(arg, eid, page, allowOmitPropPrefix) +local function getEntityId(arg, eid, page, allowOmitPropPrefix, globalSiteId) local id = nil local prop = nil @@ -2235,7 +2236,7 @@ local function getEntityId(arg, eid, page, allowOmitPropPrefix) page = mw.text.trim(page:sub(2)) end - id = mw.wikibase.getEntityIdForTitle(page) or "" + id = mw.wikibase.getEntityIdForTitle(page, globalSiteId) or "" end if not id then @@ -2282,7 +2283,7 @@ local function claimCommand(args, funcName) until not cfg:processFlagOrCommand(lastArg) -- get the entity ID from either the positional argument, the eid argument or the page argument - cfg.entityID, cfg.propertyID = getEntityId(lastArg, args[p.args.eid], args[p.args.page]) + cfg.entityID, cfg.propertyID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], false, args[p.args.globalSiteId]) if cfg.entityID == "" then return "" -- we cannot continue without a valid entity ID @@ -2454,7 +2455,7 @@ local function generalCommand(args, funcName) until not cfg:processFlag(lastArg) -- get the entity ID from either the positional argument, the eid argument or the page argument - cfg.entityID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], true) + cfg.entityID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], true, args[p.args.globalSiteId]) if cfg.entityID == "" or not mw.wikibase.entityExists(cfg.entityID) then return "" -- we cannot continue without an entity diff --git a/lua/ko/Citation%2FCS1 b/lua/ko/Citation%2FCS1 index 5e3cb6c..a9992f6 100644 --- a/lua/ko/Citation%2FCS1 +++ b/lua/ko/Citation%2FCS1 @@ -2300,8 +2300,8 @@ local Encyclopedia = A['Encyclopedia']; if first_set ({AccessDate, At, Chapter, Format, Page, Pages, Periodical, PublisherName, URL, -- a crude list of parameters that are not supported by cite arxiv ID_list['ASIN'], ID_list['BIBCODE'], ID_list['DOI'], ID_list['ISBN'], ID_list['ISSN'], - ID_list['JFM'], ID_list['JSTOR'], ID_list['LCCN'], ID_list['MR'], ID_list['OCLC'], ID_list['OL'], - ID_list['OSTI'], ID_list['PMC'], ID_list['PMID'], ID_list['RFC'], ID_list['SSRN'], ID_list['USENETID'], ID_list['ZBL']},27) then + ID_list['JFM'], ID_list['JSTOR'], ID_list['LCCN'], ID_list['MR'], ID_list['NAID'], ID_list['OCLC'], ID_list['OL'], + ID_list['OSTI'], ID_list['PMC'], ID_list['PMID'], ID_list['RFC'], ID_list['S2CID'], ID_list['SSRN'], ID_list['USENETID'], ID_list['ZBL']},27) then table.insert( z.message_tail, { set_error( 'arxiv_params_not_supported', {}, true ) } ); -- add error message AccessDate= ''; -- set these to empty string; not supported in cite arXiv diff --git a/lua/ko/Citation%2FCS1%2FConfiguration b/lua/ko/Citation%2FCS1%2FConfiguration index ebccc4e..b62ec62 100644 --- a/lua/ko/Citation%2FCS1%2FConfiguration +++ b/lua/ko/Citation%2FCS1%2FConfiguration @@ -974,6 +974,12 @@ local error_conditions = { category = '인용 오류 - MR', hidden = false }, + bad_naid = { + message = '|naid= 값 확인 필요', + anchor = 'bad_naid', + category = '인용 오류 - NAID', + hidden = false + }, bad_ol = { message = '|ol= 값 확인 필요', anchor = 'bad_ol', @@ -999,6 +1005,11 @@ local error_conditions = { anchor = 'bad_oclc', category = '인용 오류 - OCLC', hidden = false }, + bad_s2cid = { + message = 'Check |s2cid= 값 확인 필요', + anchor = 'bad_s2cid', + category = '인용 오류 - S2CID', + hidden = false }, bad_ssrn = { message = '|ssrn= 값 확인 필요', anchor = 'bad_ssrn', @@ -1355,6 +1366,16 @@ local id_handlers = { encode = true, separator = ' ', }, + ['NAID'] = { + parameters = {'NAID', 'naid'}, + link = 'CiNii', + label = 'NAID', + mode = 'external', + prefix = 'https://ci.nii.ac.jp/naid/', + COinS = 'info:naid', + encode = false, + separator = ' ', + }, ['OCLC'] = { parameters = {'OCLC', 'oclc'}, link = '온라인 컴퓨터 도서관 센터', @@ -1416,6 +1437,17 @@ local id_handlers = { encode = false, separator = ' ', }, + ['S2CID'] = { + parameters = {'s2cid', 'S2CID'}, + link = '시맨틱 스칼라', + redirect = '시맨틱 스칼라', + label = 'S2CID', + mode = 'external', + prefix = 'https://api.semanticscholar.org/CorpusID:', + COinS = 'pre', -- use prefix value + encode = false, + separator = ' ', + }, ['SSRN'] = { parameters = {'SSRN', 'ssrn'}, link = '사회 과학 연구 네트워크', diff --git a/lua/ko/Citation%2FCS1%2FIdentifiers b/lua/ko/Citation%2FCS1%2FIdentifiers index 15f5ce4..17fedd4 100644 --- a/lua/ko/Citation%2FCS1%2FIdentifiers +++ b/lua/ko/Citation%2FCS1%2FIdentifiers @@ -746,6 +746,27 @@ local function mr (id) end +--[[--------------------------< N A I D >---------------------------------------------------------------------- + +NAID must be eleven or twelve digits starts with non-zero. + +]] + +local function naid(id) + local handler = cfg.id_handler; + local matched; + matched = id:match ('^[1-9]%d%d%d%d%d%d%d%d%d%d%d?$'); + if not matched then + text = text .. ' ' .. set_message ('bad_naid'); -- set an error message + id.coins_list_t['NAID'] = nil; -- when error, unset so not included in COinS + end + + local text = external_link_id({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect, prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode}); + + return text; +end + + --[[--------------------------< O C L C >---------------------------------------------------------------------- Validate and format an oclc id. https://www.oclc.org/batchload/controlnumber.en.html {{dead link}} @@ -920,6 +941,42 @@ local function pmid(id) end +--[[--------------------------< S 2 C I D >-------------------------------------------------------------------- + +Format an S2CID, do simple error checking + +S2CIDs are sequential numbers beginning at 1 and counting up. This code checks the S2CID to see that it is only +digits and is less than test_limit; the value in local variable test_limit will need to be updated periodically +as more S2CIDs are issued. + +]] + +local function s2cid (id) + local access = id.access; + local handler = id.handler; + local id_num; + local text; + + id_num = id:match ('^[1-9]%d*$'); -- id must be all digits; must not begin with 0; no open access flag + + if is_set (id_num) then -- id_num has a value so test it + id_num = tonumber (id_num); -- convert id_num to a number for range testing + if handler.id_limit < id_num then -- if S2CID is outside test limit boundaries + set_message ('bad_s2cid'); -- set an error message + options.coins_list_t['S2CID'] = nil; -- when error, unset so not included in COinS + end + else -- when id format incorrect + set_message ('bad_s2cid'); -- set an error message + options.coins_list_t['S2CID'] = nil; -- when error, unset so not included in COinS + end + + text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect, + prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access}); + + return text; +end + + --[[--------------------------< S S R N >---------------------------------------------------------------------- Format an ssrn, do simple error checking @@ -1070,6 +1127,8 @@ local function build_id_list( id_list, options ) table.insert( new_list, {handler.label, lccn( v ) } ); elseif k == 'MR' then table.insert( new_list, {handler.label, mr( v ) } ); + elseif k == 'NAID' then + table.insert( new_list, {handler.label, naid( v ) } ); elseif k == 'OCLC' then table.insert( new_list, {handler.label, oclc( v ) } ); elseif k == 'OL' or k == 'OLA' then @@ -1078,6 +1137,8 @@ local function build_id_list( id_list, options ) table.insert( new_list, {handler.label, pmc( v, options.Embargo ) } ); elseif k == 'PMID' then table.insert( new_list, {handler.label, pmid( v ) } ); + elseif k == 'S2CID' then + table.insert( new_list, {handler.label, s2cid( v ) } ); elseif k == 'SSRN' then table.insert( new_list, {handler.label, ssrn( v ) } ); elseif k == 'USENETID' then diff --git a/lua/ko/Citation%2FCS1%2FWhitelist b/lua/ko/Citation%2FCS1%2FWhitelist index e2b9e96..6db5233 100644 --- a/lua/ko/Citation%2FCS1%2FWhitelist +++ b/lua/ko/Citation%2FCS1%2FWhitelist @@ -263,6 +263,8 @@ local basic_arguments = { ['mode'] = true, ['mr'] = true, ['MR'] = true, + ['naid'] = true, + ['NAID'] = true, ['name-list-format'] = true, ['network'] = true, ['newsgroup'] = true, @@ -346,6 +348,9 @@ local basic_arguments = { ['subject-link'] = true, ['subscription'] = false, ['surname'] = true, + ['s2cid'] = true, + ['S2CID'] = true, + ['s2cid-access'] = true, ['template doc demo'] = true, -- DEPRECATED ['template-doc-demo'] = true, ['time'] = true, diff --git a/lua/ko/Langname%2Fdata b/lua/ko/Langname%2Fdata index c68c198..dcc5dc1 100644 --- a/lua/ko/Langname%2Fdata +++ b/lua/ko/Langname%2Fdata @@ -13,7 +13,7 @@ local langdata = {} -- 언어 이름과 실제 문서가 다른 경우 langdata.lang_article = { - ["ber"] = "베르베르어", + ["ber"] = "베르베르어파", ["ii"] = "이어", ["iii"] = "눠쑤어", ["io"] = "이도", @@ -65,7 +65,7 @@ langdata.lang_name = { ["ain"] = "아이누어", -- CLDR 중복 ["als"] = "토스크 알바니아어", ["ami"] = "아미어", - ["ams"] = "남부 아마미어", + ["ams"] = "남아마미어", ["ang"] = "고대 영어", ["ar"] = "아랍어", -- CLDR 중복 ["arn"] = "마푸둥군어", @@ -75,7 +75,7 @@ langdata.lang_name = { ["ast"] = "아스투리아스어", ["av"] = "아바르어", ["ba"] = "바시키르어", - ["bar"] = "오스트로바이에른어", + ["bar"] = "바이에른어", ["bdf"] = "바뉴마스어", ["be"] = "벨라루스어", ["ber"] = "베르베르어", @@ -90,6 +90,8 @@ langdata.lang_name = { ["cal"] = "캐롤라인어", ["cbk"] = "차바카노어", ["cdo"] = "민둥어", + ["ce"] = "체첸어", -- CLDR 중복 + ["ce-latn"] = "체첸어", ["chk"] = "추크어", ["cim"] = "침바르어", ["ckt"] = "축치어", @@ -112,6 +114,7 @@ langdata.lang_name = { ["egl"] = "에밀리아어", ["el"] = "그리스어", -- CLDR 중복 ["ell"] = "현대 그리스어", + ["emk"] = "동마닌카어", ["en"] = "영어", -- CLDR 중복 ["en-au"] = "오스트레일리아 영어", ["en-ca"] = "캐나다 영어", @@ -134,6 +137,7 @@ langdata.lang_name = { ["fr-ch"] = "스위스 프랑스어", ["frp"] = "프랑코프로방스어", ["frr"] = "북프리슬란트어", + ["fuf"] = "풀라어", ["fur"] = "프리울리어", ["fy"] = "서프리슬란트어", ["ga"] = "아일랜드어", -- CLDR 중복 @@ -142,6 +146,7 @@ langdata.lang_name = { ["gbw"] = "카비카비어", ["gem"] = "게르만어", ["gez"] = "그으즈어", + ["ghc"] = "초기 현대 아일랜드어", ["gmh"] = "중세 고지 독일어", ["goh"] = "고대 고지 독일어", ["grc"] = "고대 그리스어", @@ -189,6 +194,7 @@ langdata.lang_name = { ["ko-kr"] = "한국어", ["ko-cn"] = "중국조선어", ["ko-jp"] = "재일한국어", + ["kls"] = "칼라쉬어", ["kpy"] = "코랴크어", ["kr"] = "카누리어", ["krc"] = "카라차이발카르어", @@ -215,12 +221,14 @@ langdata.lang_name = { ["lua"] = "루바어", ["lzz"] = "라즈어", ["mdf"] = "목샤어", + ["mdh"] = "마긴다나오어", ["mg"] = "말라가시어", ["mga"] = "중세 아일랜드어", ["mh"] = "마셜어", ["mhn"] = "모케노어", ["min"] = "미낭카바우어", ["mn"] = "몽골어", + ["mnk"] = "만딩카어", ["mnp"] = "민베이어", ["mns"] = "만시어", ["mo"] = "몰도바어", -- CLDR 오류 @@ -246,6 +254,7 @@ langdata.lang_name = { ["no"] = "노르웨이어", -- CLDR 중복 ["non"] = "고대 노르드어", ["nov"] = "노비알", + ["nrf"] = "노르만어", ["nrn"] = "노른어", ["nso"] = "북소토어", ["ny"] = "치체와어", @@ -287,13 +296,14 @@ langdata.lang_name = { ["rom"] = "롬어", ["ru"] = "러시아어", -- CLDR 중복 ["rue"] = "루신어", - ["ryn"] = "북부 아마미어", + ["ryn"] = "북아마미어", ["rys"] = "야에야마어", ["ryu"] = "오키나와어", ["sa"] = "산스크리트어", -- CLDR 중복 ["sah"] = "야쿠트어", ["sc"] = "사르데냐어", ["sco"] = "스코트어", + ["sco-ulster"] = "스코트어", -- CLDR 중복 ["sd"] = "신드어", ["sg"] = "상고어", ["sga"] = "고대 아일랜드어", @@ -306,7 +316,7 @@ langdata.lang_name = { ["sjn"] = "신다린", ["sk"] = "슬로바키아어", -- CLDR 중복 ["sl"] = "슬로베니아어", -- CLDR 중복 - ["sme"] = "북부 사미어", + ["sme"] = "북사미어", ["smg"] = "사모기티아어", ["so"] = "소말리어", ["srn"] = "스라난 통고", @@ -347,6 +357,7 @@ langdata.lang_name = { ["wo"] = "월로프어", ["wuu"] = "우어", ["xaa"] = "안달루시아 아랍어", + ["xbc"] = "박트리아어", ["xby"] = "부출라어", ["xng"] = "중세 몽골어", ["xno"] = "앵글로노르만어", diff --git a/lua/ko/Navbox b/lua/ko/Navbox index c961a75..1851bf9 100644 --- a/lua/ko/Navbox +++ b/lua/ko/Navbox @@ -502,9 +502,9 @@ local param_ko = { for i = 1, 100 do param_ko['묶음' .. i] = 'group' .. i - param_ko['묶음' .. i .. '모양'] = 'group' .. i .. 'title' + param_ko['묶음' .. i .. '모양'] = 'group' .. i .. 'style' param_ko['내용' .. i] = 'list' .. i - param_ko['내용' .. i .. '모양'] = 'list' .. i .. 'title' + param_ko['내용' .. i .. '모양'] = 'list' .. i .. 'style' end local function localname(parameter) diff --git a/scribunto.lock b/scribunto.lock index 413e4bd..5df4ab3 100644 --- a/scribunto.lock +++ b/scribunto.lock @@ -36,7 +36,7 @@ }, "@en/Hatnote list": { "pageid": 50085079, - "revid": 1062173192, + "revid": 1184984294, "title": "Module:Hatnote list", "dependencies": [ "@en/Arguments", @@ -64,7 +64,7 @@ }, "@en/Navbar": { "pageid": 38827227, - "revid": 1130341346, + "revid": 1179557823, "title": "Module:Navbar", "dependencies": [ "@en/Arguments", @@ -79,7 +79,7 @@ }, "@en/String": { "pageid": 38569505, - "revid": 970815276, + "revid": 1181867616, "title": "Module:String", "dependencies": [ "@en/String" @@ -95,7 +95,7 @@ }, "@en/Wd": { "pageid": 51376229, - "revid": 1164720990, + "revid": 1191341478, "title": "Module:Wd" }, "@en/Wd/i18n": { @@ -136,7 +136,7 @@ }, "@ko/Citation/CS1": { "pageid": 950941, - "revid": 35215065, + "revid": 35835557, "title": "\ubaa8\ub4c8:Citation/CS1", "dependencies": [ "@ko/Citation/CS1/COinS", @@ -169,7 +169,7 @@ }, "@ko/Citation/CS1/Configuration": { "pageid": 950942, - "revid": 32892756, + "revid": 35835615, "title": "\ubaa8\ub4c8:Citation/CS1/Configuration", "dependencies": [ "@ko/Langname/data" @@ -192,7 +192,7 @@ }, "@ko/Citation/CS1/Identifiers": { "pageid": 1481764, - "revid": 33523354, + "revid": 35835561, "title": "\ubaa8\ub4c8:Citation/CS1/Identifiers" }, "@ko/Citation/CS1/Identifiers/sandbox": { @@ -222,7 +222,7 @@ }, "@ko/Citation/CS1/Whitelist": { "pageid": 950943, - "revid": 32607616, + "revid": 35835552, "title": "\ubaa8\ub4c8:Citation/CS1/Whitelist" }, "@ko/Citation/CS1/Whitelist/sandbox": { @@ -319,7 +319,7 @@ }, "@ko/Langname/data": { "pageid": 930466, - "revid": 35343244, + "revid": 36068888, "title": "\ubaa8\ub4c8:Langname/data" }, "@ko/Navbar": { @@ -333,7 +333,7 @@ }, "@ko/Navbox": { "pageid": 930488, - "revid": 35127656, + "revid": 36040579, "title": "\ubaa8\ub4c8:Navbox", "dependencies": [ "@ko/Arguments",