请输入您要查询的百科知识:

 

词条 Module:Sandbox/BrownHairedGirl/xyz
释义

local p = {}

function make_cat_link(catname, disp)

local displaytext

if (disp ~= "") then

displaytext = disp

else

displaytext = catname

end

local link = "" .. displaytext .. ""

local fmtlink

local linktitle = mw.title.new( catname, "Category" )

if (linktitle.exists) then

fmtlink = link

else

fmtlink = "" .. displaytext .. ""

end

return fmtlink

end

function make_cat_link4(catname, disp)

local link = "{{LinkCatIfExists2|" .. catname

if (disp ~= "") then

link = link .. "|" .. disp

end

link = link .. "}}"

return link

end

function make_decade_cat_link(prefix, start, rest, decadenum)

local decadestart = (prefix * 100) + (decadenum * 10)

local decadename = decadestart .. "s"

return make_cat_link(start .. decadename .. rest, decadename)

end

function ordinal_numbers(n)

  local ordinal, digit = {"st", "nd", "rd"}, string.sub(n, -1)  if tonumber(digit) > 0 and tonumber(digit) <= 3 and mw.ustring.sub(n,-2) ~= 11 and mw.ustring.sub(n,-2) ~= 12 and mw.ustring.sub(n,-2) ~= 13 then    return n .. ordinal[tonumber(digit)]  else    return n .. "th"  end

end

function make_century_name(n)

local centuryordinal = ordinal_numbers(n)

return centuryordinal .. " century"

end

function p.main(frame)

local pagename

local nilly

if (frame.args[1] ~= "") then -- a parameter was supplied, so use it as page title

nilly = "no nil. value='" .. frame.args[1] .. "'"

if (string.match(frame.args[1], "^Category *: *")) then

pagename = mw.ustring.gsub(frame.args[1], "^Category *: *", "");

else

pagename = frame.args[1]

end

else -- use the page title

nilly = "nil"

pagename = mw.title.getCurrentTitle().text

end

if (false) then

return nilly

end

local dddo = mw.ustring.match(pagename, "%d%d*0s")

if (dddo == nil) then

return "Error: no 'YYOs' in '" .. pagename .. "'"

end

local dd = mw.ustring.match(dddo, "^%d*")

local yy = (dd - (dd % 100))/ 100

local startoftitle = mw.ustring.gsub(pagename, dddo .. ".*$", "")

local restoftitle = mw.ustring.gsub(pagename, "^.*" .. dddo, "")

local diagnotics = "; pagename\* " .. pagename .. "\;dddo\*" .. dddo .. "\;dd\*" .. dd

diagnotics = diagnotics .. "\;yy\*" .. yy .. "\;startoftitle\*'" .. startoftitle .. "'"

diagnotics = diagnotics .. "\;restoftitle\*'" .. restoftitle .. "'"

local retval

retval = "{| class=\\"toccolours\\" style=\\"border:1px solid black; padding:5px\\"\|-\|style=\\"text-align:center\\"| " .. startoftitle

if (startoftitle == "") then

retval = retval .. "Decades "

else

retval = retval .. " decades "

end

retval = retval .. " of the " .. make_century_name(yy+1) .. restoftitle .. "\|-\| "

retval = retval .. "" .. make_decade_cat_link(yy, startoftitle, restoftitle, -1) .. " • " .. ""

local i;

for i = 0, 9 do

retval = retval .. make_decade_cat_link(yy, startoftitle, restoftitle, i)

if i < 9 then

retval = retval .. " • "

end

end

retval = retval .. "" .. " • " .. make_decade_cat_link(yy, startoftitle, restoftitle, 10) .. ""

retval = retval .. "\|}"

return retval

end

return p

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/10 14:20:36