Line 27: |
Line 27: |
| local authors = private.parseCommaDelimited(frame.args["author"] or '') | | local authors = private.parseCommaDelimited(frame.args["author"] or '') |
| local ids = private.parseCommaDelimited(frame.args["id"] or '') | | local ids = private.parseCommaDelimited(frame.args["id"] or '') |
− | local nexusID = private.emptyToNil(frame.args["nexus id"]) | + | local nexusId = private.emptyToNil(frame.args["nexus id"]) |
| local github = private.emptyToNil(frame.args["github"]) | | local github = private.emptyToNil(frame.args["github"]) |
| local summary = private.emptyToNil(frame.args["summary"]) | | local summary = private.emptyToNil(frame.args["summary"]) |
Line 35: |
Line 35: |
| local unofficialVersion = private.emptyToNil(frame.args["unofficial version"]) | | local unofficialVersion = private.emptyToNil(frame.args["unofficial version"]) |
| local unofficialUrl = private.emptyToNil(frame.args["unofficial url"]) | | local unofficialUrl = private.emptyToNil(frame.args["unofficial url"]) |
− | local chucklefishID = private.emptyToNil(frame.args["cf id"]) | + | local chucklefishId = private.emptyToNil(frame.args["cf id"]) |
− | local customUrl = private.emptyToNil(frame.args["url"]) | + | local curseforgeId = private.emptyToNil(frame.args["curseforge id"]) |
− | local customSource = private.emptyToNil(frame.args["source"]) | + | local curseforgeKey = private.emptyToNil(frame.args["curseforge key"]) |
− | local links = private.parseCommaDelimited(frame.args["links"]) | + | local moddropId = private.emptyToNil(frame.args["moddrop id"]) |
− | local warnings = private.parseCommaDelimited(frame.args["warnings"]) | + | local customUrl = private.emptyToNil(frame.args["url"]) |
| + | local customSource = private.emptyToNil(frame.args["source"]) |
| + | local pullRequestUrl = private.emptyToNil(frame.args["pull request"]) |
| + | local links = private.parseCommaDelimited(frame.args["links"]) |
| + | |
| + | local warnings = private.parseCommaDelimited(frame.args["warnings"]) |
| + | local devNote = private.emptyToNil(frame.args["dev note"]) |
| + | local contentPackFor = private.emptyToNil(frame.args["content pack for"]) |
| + | local mapLocalVersions = private.emptyToNil(frame.args["map local versions"]) |
| + | local mapRemoteVersions = private.emptyToNil(frame.args["map remote versions"]) |
| + | local changeUpdateKeys = private.emptyToNil(frame.args["change update keys"]) |
| | | |
| local betaSummary = private.emptyToNil(frame.args["beta summary"]) | | local betaSummary = private.emptyToNil(frame.args["beta summary"]) |
Line 63: |
Line 73: |
| -- get main URL | | -- get main URL |
| local url = nil | | local url = nil |
− | if nexusID then | + | if nexusId then |
− | url = "https://www.nexusmods.com/stardewvalley/mods/" .. mw.uri.encode(nexusID, "PATH") | + | url = "https://www.nexusmods.com/stardewvalley/mods/" .. mw.uri.encode(nexusId, "PATH") |
− | elseif chucklefishID then | + | elseif moddropId then |
− | url = "https://community.playstarbound.com/resources/" .. mw.uri.encode(chucklefishID, "PATH") | + | url = "https://www.moddrop.com/stardew-valley/mods/" .. mw.uri.encode(moddropId, "PATH") |
| + | elseif curseforgeId then |
| + | url = "https://www.curseforge.com/stardewvalley/mods/" .. mw.uri.encode(curseforgeId, "PATH") |
| + | elseif chucklefishId then |
| + | url = "https://community.playstarbound.com/resources/" .. mw.uri.encode(chucklefishId, "PATH") |
| else | | else |
| url = customUrl | | url = customUrl |
Line 87: |
Line 101: |
| row:addClass("mod") | | row:addClass("mod") |
| row:attr("id", names[1] and mw.uri.anchorEncode(names[1])); | | row:attr("id", names[1] and mw.uri.anchorEncode(names[1])); |
| + | row:attr("data-id", table.concat(ids, ",")) |
| row:attr("data-name", table.concat(names, ",")) | | row:attr("data-name", table.concat(names, ",")) |
− | row:attr("data-id", table.concat(ids, ","))
| |
| row:attr("data-author", table.concat(authors, ",")) | | row:attr("data-author", table.concat(authors, ",")) |
− | row:attr("data-url", url) | + | row:attr("data-cf-id", chucklefishId) |
− | row:attr("data-nexus-id", nexusID) | + | row:attr("data-curseforge-id", curseforgeId) |
− | row:attr("data-cf-id", chucklefishID) | + | row:attr("data-curseforge-key", curseforgeKey) |
| + | row:attr("data-moddrop-id", moddropId) |
| + | row:attr("data-nexus-id", nexusId) |
| row:attr("data-github", github) | | row:attr("data-github", github) |
| row:attr("data-custom-source", customSource) | | row:attr("data-custom-source", customSource) |
| + | row:attr("data-url", url) |
| row:attr("data-status", compat.status) | | row:attr("data-status", compat.status) |
| row:attr("data-summary", compat.summary) | | row:attr("data-summary", compat.summary) |
Line 105: |
Line 122: |
| row:attr("data-beta-unofficial-version", betaCompat and betaCompat.unofficialVersion) | | row:attr("data-beta-unofficial-version", betaCompat and betaCompat.unofficialVersion) |
| row:attr("data-beta-unofficial-url", betaCompat and betaCompat.unofficialUrl) | | row:attr("data-beta-unofficial-url", betaCompat and betaCompat.unofficialUrl) |
| + | row:attr("data-pr", pullRequestUrl) |
| row:attr("data-warnings", private.emptyToNil(table.concat(warnings, ","))) | | row:attr("data-warnings", private.emptyToNil(table.concat(warnings, ","))) |
| + | row:attr("data-content-pack-for", contentPackFor) |
| + | row:attr("data-dev-note", devNote) |
| + | row:attr("data-map-local-versions", mapLocalVersions) |
| + | row:attr("data-map-remote-versions", mapRemoteVersions) |
| + | row:attr("data-change-update-keys", changeUpdateKeys) |
| row:attr("style", "line-height: 1em; background: " .. background .. ";") | | row:attr("style", "line-height: 1em; background: " .. background .. ";") |
| row:newline() | | row:newline() |
Line 168: |
Line 191: |
| | | |
| -- beta status | | -- beta status |
− | if betaCompat ~= nill then | + | if betaCompat ~= nil then |
| field:wikitext("<br />") | | field:wikitext("<br />") |
| field:wikitext("'''SDV beta only:''' " .. betaCompat.summaryIcon .. " " .. betaCompat.summary) | | field:wikitext("'''SDV beta only:''' " .. betaCompat.summaryIcon .. " " .. betaCompat.summary) |
Line 222: |
Line 245: |
| field:wikitext("[[#" .. (names[1] or '') .. "|#]] ") | | field:wikitext("[[#" .. (names[1] or '') .. "|#]] ") |
| | | |
− | -- reference links | + | -- pull request |
− | do | + | if pullRequest then |
− | local linkCount = #links | + | field:wikitext("[" .. pullRequest .. " PR] ") |
− | for i = 1, linkCount do
| |
− | field:wikitext("[" .. links[i] .. " " .. i .. "] ")
| |
− | end
| |
| end | | end |
| | | |
− | -- 'no id' warning | + | -- dev note |
− | if #ids == 0 then | + | if devNote then |
− | field:wikitext("⚠ no id") | + | local devNoteField = mw.html.create("abbr") |
| + | devNoteField:attr("title", devNote) |
| + | devNoteField:wikitext("[dev note]") |
| + | |
| + | field:node(devNoteField) |
| end | | end |
| | | |
− | -- backwards-compatible metadata (temporary) | + | -- validation |
− | field:wikitext('<div div class="mod-metadata" style="display: none;">') | + | if #ids == 0 then |
− | field:wikitext('<div class="mod-anchor">' .. (names[1] and mw.uri.anchorEncode(names[1]) or '') .. "</div>")
| + | field:wikitext("[⚠ no id] ") |
− | field:wikitext('<div class="mod-id">' .. mw.text.encode(table.concat(ids, ",")) .. "</div>")
| |
− | field:wikitext('<div class="mod-url">' .. mw.text.encode(url or '') .. "</div>")
| |
− | if nexusID ~= nil then
| |
− | field:wikitext('<div class="mod-nexus-id">' .. mw.text.encode(nexusID or '') .. "</div>")
| |
− | end
| |
− | if chucklefishID ~= nil then
| |
− | field:wikitext('<div class="mod-cf-id">' .. mw.text.encode(chucklefishID or '') .. "</div>") | |
− | end
| |
− | if github ~= nil then
| |
− | field:wikitext('<div class="mod-github">' .. mw.text.encode(github or '') .. '</div>')
| |
− | end
| |
− | if customSource ~= nil then
| |
− | field:wikitext('<div class="mod-custom-source">' .. mw.text.encode(customSource or '') .. '</div>')
| |
− | end
| |
− | field:wikitext('<div class="mod-status">' .. mw.text.encode(compat.status) .. '</div>')
| |
− | if compat.brokeIn ~= nil then
| |
− | field:wikitext('<div class="mod-broke-in">' .. mw.text.encode(compat.brokeIn) .. '</div>')
| |
− | end
| |
− | if compat.unofficialVersion ~= nil and compat.unofficialUrl ~= nil then
| |
− | field:wikitext('<div class="mod-unofficial-version">' .. mw.text.encode(compat.unofficialVersion) .. '</div>')
| |
− | field:wikitext('<div class="mod-unofficial-url">' .. mw.text.encode(compat.unofficialUrl) .. '</div>')
| |
− | end
| |
− | if betaCompat ~= nil then
| |
− | field:wikitext('<div class="mod-beta-status">' .. mw.text.encode(betaCompat.status) .. '</div>')
| |
− | if betaCompat.brokeIn ~= nil then
| |
− | field:wikitext('<div class="mod-beta-broke-in">' .. mw.text.encode(betaCompat.brokeIn) .. '</div>')
| |
− | end
| |
− | if betaCompat.unofficialVersion ~= nil and betaCompat.unofficialUrl ~= nil then
| |
− | field:wikitext('<div class="mod-beta-unofficial-version">' .. mw.text.encode(betaCompat.unofficialVersion) .. '</div>')
| |
− | field:wikitext('<div class="mod-beta-unofficial-url">' .. mw.text.encode(betaCompat.unofficialUrl) .. '</div>')
| |
− | end
| |
| end | | end |
− | if #warnings > 0 then | + | if (not curseforgeId) ~= (not curseforgeKey) then |
− | field:wikitext('<div class="mod-warnings">' .. mw.text.encode(table.concat(warnings, ",")) .. '</div>') | + | field:wikitext("<abbr title=\"The mod data is invalid: can't specify Curseforge key or ID without the other.\">[⚠ invalid data]</abbr>") |
| end | | end |
− | field.wikitext("</div>")
| |
| | | |
| row:node(field) | | row:node(field) |
Line 329: |
Line 321: |
| | | |
| -- derive summary | | -- derive summary |
− | if summary == nil then | + | if not summary then |
| if status == "ok" then | | if status == "ok" then |
| summary = "use latest version." | | summary = "use latest version." |
Line 349: |
Line 341: |
| end | | end |
| elseif status == "obsolete" then | | elseif status == "obsolete" then |
− | summary = "obsolete." | + | summary = "remove this mod (obsolete)." |
| elseif status == "abandoned" then | | elseif status == "abandoned" then |
− | summary = "no longer maintained." | + | summary = "remove this mod (no longer maintained)." |
| else | | else |
| summary = "'''error:''' unknown status '" .. status .. "'." | | summary = "'''error:''' unknown status '" .. status .. "'." |