;
×
创建新页面
在此填写您的页面标题:
我们当前在Undertale社区维基上拥有210个页面。请在上方输入您的页面名称或点击以下任意标题来开始编写页面!



Undertale社区维基
欢迎来到Undertale社区维基(*`∀´*)ノ亻,如果想要参与条目创建或编辑,请先登录

可在模块:Citebody/doc创建此模块的帮助文档

local p = {}
local b = require("Module:Basic")

function p.tumblr(frame)
    local args = frame.args
    local id = args[1]
    local url_text = args["url_text"]
    local content_text = args["content_text"]
    local arc = args["arc"]
    local blog = args["blog"]
    local publishing_time = args["publishing_time"]
    local archive_time = args["archive_time"]
    local result = ""

    if b.empty(arc) then
        local url = 'https://arc.utcwiki.com/tumblr/api/v1/posts/show?id=' .. id .. '&wiki=1&only=blog_name,first_archive_time,publishing_time'
        local data = mw.ext.externalData.getExternalData{ url = url }
        local arc_result = data.__json.response.posts[1]
        blog = arc_result["blog_name"]
        publishing_time = os.date("%Y年%m月%d日", arc_result["data"]["timestamp"])
        archive_time = os.date("%Y年%m月%d日", arc_result["first_archive_timestamp"])
    end

    blog = blog:gsub("^%l", mw.ustring.upper)

    if b.empty(content_text) then
        result = "“" .. content_text .. "”<br>——"
    end
    if not b.empty(url_text) then
        url_text = id
    end

    result = result .. "[https://" .. blog .. ".tumblr.com/" .. id .. " " .. url_text .. "]" .. "," .. blog .. ",发布于" .. publishing_time

    if b.empty(arc) then
        result =  result .. "," .. "[https://arc.utcwiki.com/tumblr/" .. id .. " 存档]于" .. archive_time
    end

    result = result .. "。"

    return result
end
return p