Module:Gutenberg: Difference between revisions

Content deleted Content added
Edit request by User:EncyclopediaUpdaticus
Add "Edit At Wikidata" link if using ID from Wikidata. Tested first with /sandbox and preview in article.
 
(2 intermediate revisions by 2 users not shown)
Line 19:
id = trimArg(args[1]) or trimArg(args.id)
if not id then
local bestP1938 = mw.wikibase.getBestStatements(mw.wikibase.getEntityIdForCurrentPage(), 'P1938')[1]
error("Parameter id is missing. See [[Template:" .. tname .. "]] documentation")
if bestP1938 and bestP1938.mainsnak.snaktype == 'value' then
else
id = bestP1938.mainsnak.datavalue.value
if tonumber(id) then -- it's a number
local entity = mw.wikibase.getEntityObject() or {}
urlhead = urlheadnumb
tagline = tagline .. " [[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/" .. entity.id .. "#P1938|Edit this at Wikidata]]"
else
error("Parameter id is missing. See [[Template:" .. tname .. "]] documentation")
urlhead = urlheadname
id = mw.ustring.gsub(id," ", "+")
end
end
if tonumber(id) then -- it's a number
urlhead = urlheadnumb
else
urlhead = urlheadname
id = mw.ustring.gsub(id," ", "+")
end
 
-- Argument |name=
Line 107 ⟶ 113:
local author = nil -- flag if an author (default: no)
local url = nil
local urlhead = "httphttps://fadedpage.com/"
local urlbook = "showbook.php?pid="
local urlauth = "csearch.php?author="