加帕里图书馆 - 兽娘动物园中文维基
动物朋友 けものフレンズ KemonoFriends百科

模块:TitleCustomizer

来自加帕里图书馆
黯狐留言 | 贡献2025年12月11日 (四) 04:26的版本
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到导航 跳转到搜索

此模块的文档可以在模块:TitleCustomizer/doc创建

local p = {}

-- 函数:生成带有自定义标题文本的隐藏元素
function p.getTitleData(frame)
    local args = frame:getParent().args
    -- 确保获取到传入的自定义文本
    local customText = args[1] or args.text or ''

    -- 使用 mw.html.create 安全地创建隐藏的 HTML 元素
    -- 使用 class ".js-custom-title-data" 作为 JavaScript 的数据锚点
    local html = mw.html.create('span')
        :addClass('js-custom-title-data')
        :css('display', 'none') -- 强制隐藏元素
        :wikitext(customText) 

    return tostring(html)
end

return p