Module:GetDisplayTitle
From Elwiki
Documentation for this module may be created at Module:GetDisplayTitle/doc
local p = {}
function p.getDisplayTitle(frame)
local title = mw.title.getCurrentTitle()
local content = title:getContent() -- 獲取頁面原始 wikitext
if content then
local displayTitle = content:match('{{DISPLAYTITLE:(.-)}}') -- 提取 DISPLAYTITLE 的內容
if displayTitle then
return displayTitle
end
end
return title.text -- 如果沒找到,回退到頁面名稱
end
return p