Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Gonnym/episodewikidata
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!
local getArgs = require('Module:Arguments').getArgs local getWikiDataValue = require('Module:WikidataIB/sandbox')._getValue p = {} local function getPreviousEpisodeFromWikiData() return getWikiDataValue({"P155", fetchwikidata = "ALL", onlysourced = "no"}) end local function getNextEpisodeFromWikiData() return getWikiDataValue({"P156", fetchwikidata = "ALL", onlysourced = "no"}) end function p.getPreviousEpisodeFromWikiData() return getWikiDataValue({"P155", fetchwikidata = "ALL", onlysourced = "no", qid = "Q20785929"}) end function p.getNextEpisodeFromWikiData() return getWikiDataValue({"P156", fetchwikidata = "ALL", onlysourced = "no", qid = "Q20785929"}) end local function getFormattedPreviousEpisodeLink(args) local previousEpisodeRaw = args.rprev or args.RPrev local previousEpisode = args.prev or getPreviousEpisodeFromWikiData() local previousEpisodeLink local hasLink = true if (previousEpisodeRaw) then previousEpisodeLink = previousEpisodeRaw elseif (previousEpisode) then previousEpisodeLink = '"' .. previousEpisode .. '"' else previousEpisodeLink = "—" hasLink = false end return previousEpisodeLink, hasLink end local function getFormattedNextEpisodeLink(args) local nextEpisodeRaw = args.rnext or args.RNext local nextEpisode = args.next or getNextEpisodeFromWikiData() local nextEpisodeLink local hasLink = true if (nextEpisodeRaw) then nextEpisodeLink = nextEpisodeRaw elseif (nextEpisode) then nextEpisodeLink = '"' .. nextEpisode .. '"' else nextEpisodeLink = "—" hasLink = false end return nextEpisodeLink, hasLink end function p.getEpisodeChronology(frame) local args = getArgs(frame) local previousEpisodeLink, hasPreviousLink = getFormattedPreviousEpisodeLink(args) local nextEpisodeLink, hasNextLink = getFormattedNextEpisodeLink(args) if (hasPreviousLink or hasNextLink) then -- return frame:expandTemplate{title = 'succession links', args = {left = previousEpisodeLink, right=nextEpisodeLink}} local chronologyString = '<div style="width: 100%">' .. '<div style="width: 50%; float: left; text-align: center;"> β \'\'\'Previous\'\'\'<br />' .. previousEpisodeLink .. '</div>' .. '<div style="width: 50%; float: right; text-align: center;"> \'\'\'Next\'\'\' β<br />' .. nextEpisodeLink .. '</div>' .. '</div>' return chronologyString else return nil end end function p.getHeaderTitle(frame) local args = getArgs(frame) local previousEpisode = args.prev or args.rprev or args.RPrev or getPreviousEpisodeFromWikiData() local nextEpisode = args.next or args.rnext or args.RNext or getNextEpisodeFromWikiData() if (previousEpisode or nextEpisode) then return "Episode chronology" end 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)
Template used on this page:
Module:Sandbox/Gonnym/episodewikidata/doc
(
edit
)