Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Premeditated/Reliable-sources
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
require("strict") local Date = require('Module:Date')._Date local data = mw.loadData("Module:Sandbox/Premeditated/Reliable-sources/data") local ref_sites = data.sites local tracking_cats = data.tracking_cats local os_date = os.date("%d %B %Y") local p = {} local tracking_categories = '' local namespace = mw.title.getCurrentTitle().namespace local add_tracking_category = function(cat) if namespace == 0 then tracking_categories = tracking_categories .. cat end end -- The following values are set by get_statements local the_frame -- Used to for frame:extensionTag local the_qid -- Used to make links to Wikidata and to get more statements if needed later local the_pid -- Used to make links to Wikidata -- The following value is set by getReferences() sooon local ref_texts = {} local function has_value (tab, val) for index, value in ipairs(tab) do if value == val then return index end end return false end local function getdomain(url) -- extract the full hostname with all subdomains local hostname = url:match '^https?://([^/]+)' or '' -- then, match the last 2 elements, separated by a dot return hostname:match '(%w+%.%w+)$' end local function getReferences(frame, claim) local result = "" -- traverse through all references for ref in pairs(claim.references or {}) do local refparts -- traverse through all parts of the current reference for snakkey, snakval in orderedpairs(claim.references[ref].snaks or {}, claim.references[ref]["snaks-order"]) do if refparts then refparts = refparts .. ", " else refparts = "" end -- output the label of the property of the reference part, e.g. "imported from" for P143 refparts = refparts .. tostring(mw.wikibase.label(snakkey)) .. ": " -- output all values of this reference part, e.g. "German Wikipedia" and "English Wikipedia" if the referenced claim was imported from both sites for snakidx = 1, #snakval do if snakidx > 1 then refparts = refparts .. ", " end refparts = refparts .. getSnakValue(snakval[snakidx]) end end if refparts then result = result .. frame:extensionTag("ref", refparts) end end return result end local function orderedpairs(array, order) if not order then return pairs(array) end -- return iterator function local i = 0 return function() i = i + 1 if order[i] then return order[i], array[order[i]] end end end local function getSnakValue(snak, parameter) if snak.snaktype == "value" then -- call the respective snak parser if snak.datavalue.type == "string" then return snak.datavalue.value elseif snak.datavalue.type == "globecoordinate" then return printDatavalueCoordinate(snak.datavalue.value, parameter) elseif snak.datavalue.type == "quantity" then return printDatavalueQuantity(snak.datavalue.value, parameter) elseif snak.datavalue.type == "time" then return printDatavalueTime(snak.datavalue.value, parameter) elseif snak.datavalue.type == "wikibase-entityid" then return printDatavalueEntity(snak.datavalue.value, parameter) elseif snak.datavalue.type == "monolingualtext" then return printDatavalueMonolingualText(snak.datavalue.value, parameter) end end return mw.wikibase.renderSnak(snak) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Module:Arguments
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Sandbox/Premeditated/Reliable-sources/doc
(
edit
)
Module:Yesno
(
edit
)