13,398
edits
No edit summary |
(Per talk page) |
||
Line 18: | Line 18: | ||
v="Wikiversity logo 2017.svg", | v="Wikiversity logo 2017.svg", | ||
species="Wikispecies-logo.svg", | species="Wikispecies-logo.svg", | ||
iw=" | iw="Bharatpedia-logo-v2.svg", | ||
iw1=" | iw1="Bharatpedia-logo-v2.svg", | ||
iw2=" | iw2="Bharatpedia-logo-v2.svg", | ||
d=" | d="Bharatdata-logo.svg", | ||
m=" | m="Bharatmedia Community Logo.svg", | ||
mw="MediaWiki-2020-icon.svg"} | mw="MediaWiki-2020-icon.svg"} | ||
Line 38: | Line 38: | ||
v="Wikiversity", | v="Wikiversity", | ||
species="Wikispecies", | species="Wikispecies", | ||
iw=" | iw="Bharatpedia", | ||
iw1=" | iw1="Bharatpedia", | ||
iw2=" | iw2="Bharatpedia", | ||
d=" | d="Bharatdata", | ||
m="Meta-Wiki", | m="Meta-Wiki", | ||
mw="MediaWiki"} | mw="MediaWiki"} | ||
Line 94: | Line 94: | ||
local trackingType = { | local trackingType = { | ||
wdMismatch="Pages using Sister project links with | wdMismatch="Pages using Sister project links with bharatdata mismatch", | ||
wdNamespace="Pages using Sister project links with | wdNamespace="Pages using Sister project links with bharatdata namespace mismatch", | ||
wdHidden="Pages using Sister project links with hidden | wdHidden="Pages using Sister project links with hidden bharatdata", | ||
defaultSearch="Pages using Sister project links with default search"} | defaultSearch="Pages using Sister project links with default search"} | ||
Line 185: | Line 185: | ||
-- prefix = prefix string for wiki to lookup | -- prefix = prefix string for wiki to lookup | ||
-- qid = QID of entity to search for, current page entity by default | -- qid = QID of entity to search for, current page entity by default | ||
local function | local function fetchBharatdata(prefix,qid) | ||
local sisterDbName = sisterDb[prefix] | local sisterDbName = sisterDb[prefix] | ||
return sisterDbName and getSitelink(sisterDbName,qid) | return sisterDbName and getSitelink(sisterDbName,qid) | ||
Line 196: | Line 196: | ||
-- args.default = link when blank | -- args.default = link when blank | ||
-- args.auto = new auto mode (don't fall back to search) | -- args.auto = new auto mode (don't fall back to search) | ||
-- args.sitelink = | -- args.sitelink = bharatdata sitelink (if available) | ||
-- args.qid = QID of entity | -- args.qid = QID of entity | ||
-- args.search = fallback string to search for | -- args.search = fallback string to search for | ||
Line 206: | Line 206: | ||
return nil --- either editor specified "no", or "blank" (and default=no), then skip this sister | return nil --- either editor specified "no", or "blank" (and default=no), then skip this sister | ||
end | end | ||
local sitelink = args.sitelink or | local sitelink = args.sitelink or fetchBharatdata(args.sisterPrefix,args.qid) | ||
if args.auto and not sitelink and args[1][2] == nil then | if args.auto and not sitelink and args[1][2] == nil then | ||
return nil --- in auto mode, if link is blank and no sitelink, then skip | return nil --- in auto mode, if link is blank and no sitelink, then skip | ||
end | end | ||
-- fallback order of sister link: first specified page, then | -- fallback order of sister link: first specified page, then bharatdata, then search | ||
local link = args[1][1] or sitelink or (args.search and "Special:"..args.search) | local link = args[1][1] or sitelink or (args.search and "Special:"..args.search) | ||
if not link then | if not link then | ||
Line 230: | Line 230: | ||
tracking.wdMismatch = args.sisterPrefix | tracking.wdMismatch = args.sisterPrefix | ||
end | end | ||
-- if no page link, nor a | -- if no page link, nor a bharatdata entry, and search is on, then warn | ||
elseif not (args[1][2] or sitelink) and args.search then | elseif not (args[1][2] or sitelink) and args.search then | ||
tracking.defaultSearch = args.sisterPrefix | tracking.defaultSearch = args.sisterPrefix | ||
Line 256: | Line 256: | ||
local ns_len = mw.ustring.len(ns) | local ns_len = mw.ustring.len(ns) | ||
local result = {} | local result = {} | ||
result.sitelink = | result.sitelink = fetchBharatdata(args.prefix, args.qid) | ||
local subtype = false | local subtype = false | ||
if args.page then | if args.page then | ||
Line 320: | Line 320: | ||
end | end | ||
elseif page[2] or args.auto then | elseif page[2] or args.auto then | ||
sitelink = sitelink or | sitelink = sitelink or fetchBharatdata('voy',args.qid) | ||
if sitelink and mw.ustring.match(sitelink,"phrasebook") then | if sitelink and mw.ustring.match(sitelink,"phrasebook") then | ||
info = "Phrasebook" | info = "Phrasebook" | ||
Line 416: | Line 416: | ||
abovestyle = args.collapsible and 'clear: both' or nil, | abovestyle = args.collapsible and 'clear: both' or nil, | ||
above = mw.ustring.format( | above = mw.ustring.format( | ||
"'''%s''' at | "'''%s''' at Bharatpedia's [[Bharatpedia:Bharatmedia sister projects|<span id=\"sister-projects\">sister projects</span>]]", | ||
args.display or args[1] | args.display or args[1] | ||
), | ), | ||
Line 436: | Line 436: | ||
local pagename = header:tag('b') | local pagename = header:tag('b') | ||
pagename:wikitext(args.display or args[1]) | pagename:wikitext(args.display or args[1]) | ||
local headerText = " at | local headerText = " at Bharatpedia's [[Bharatpedia:Bharatmedia sister projects|" | ||
headerText = headerText..'<span id="sister-projects" style="white-space:nowrap;">sister projects</span>]]:' | headerText = headerText..'<span id="sister-projects" style="white-space:nowrap;">sister projects</span>]]:' | ||
header:wikitext(headerText) | header:wikitext(headerText) | ||
Line 508: | Line 508: | ||
local link = "[["..sister.prefix..":"..sister.link.."|<b><i>"..(args.display or args[1]).."</i></b>]]" | local link = "[["..sister.prefix..":"..sister.link.."|<b><i>"..(args.display or args[1]).."</i></b>]]" | ||
if sister.name == 'Commons' then | if sister.name == 'Commons' then | ||
sister.name = ' | sister.name = 'Bharatmedia Commons' -- make single sister commons box look like {{Commons}} | ||
end | end | ||
local text = sister.name.." has "..mw.ustring.lower(sister.information).." related to "..link | local text = sister.name.." has "..mw.ustring.lower(sister.information).." related to "..link | ||
if sister.name == ' | if sister.name == 'Bharatpedia' then -- make single sister interwiki box look like {{InterWiki}} | ||
text = "[["..sister.prefix..":"..sister.link.."|<b><i>"..sister.information.."</i></b>]] at [[ | text = "[["..sister.prefix..":"..sister.link.."|<b><i>"..sister.information.."</i></b>]] at [[Bharatpedia]], the free encyclopedia" | ||
end | end | ||
box:wikitext(sideBox({ | box:wikitext(sideBox({ | ||
Line 528: | Line 528: | ||
end | end | ||
if #sisterList == 0 and args.auto then | if #sisterList == 0 and args.auto then | ||
box:wikitext(generateWarning({"No sister project links found in | box:wikitext(generateWarning({"No sister project links found in Bharatdata. Try auto=0"})) | ||
end | end | ||
-- Append tracking categories to container div | -- Append tracking categories to container div |
edits