Module:SiteList

From Porn Base Central
Revision as of 22:52, 21 July 2023 by PeaceDeadC (talk | contribs)
Jump to navigation Jump to search

Documentation for this module may be created at Module:SiteList/doc

local p = {}
local siteDB = require('Module:SiteDatabase')

function p.siteList(frame)
  local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:SiteList'})

  local site = args.site
  local id = args.id or ''
  local sceneid = args.sceneid or ''
  local alias = args.alias or mw.title.getCurrentTitle().text
  local notes = args.notes or 'N/A'

  local siteData = siteDB.sites[site]

  if siteData then
    local url = siteData.url
    if id ~= '' then
      url = siteData.model_url .. id .. '.html'
    elseif sceneid ~= '' then
      url = siteData.scene_url .. sceneid .. '.html'
    end
    local link = '[' .. url .. ' ' .. site .. '] <small>(' .. siteData.category .. ')</small>'

    if mw.title.getCurrentTitle().namespace == 0 then
      link = link .. siteData.model_category
    end

    return link
  else
    return 'None'
  end
end

return p