求真百科歡迎當事人提供第一手真實資料,洗刷冤屈,終結網路霸凌。

變更

前往: 導覽搜尋

模块:Hatnote list

增加 339 位元組, 5 年前
無編輯摘要
--default options table used across the list stringification functions
-- 本地化注意
local stringifyListDefaultOptions = {
conjunction = "and", separator = ",", altSeparator = ";", space = " ",
formatted = false
}
-- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§"
local conjunction = s .. options.conjunction .. s
-- 本地化注意 -- separator .. conjunction的结果是“、和” -- if #list == 2 and searchDisp(list[1], "§") or #list > 2 then -- conjunction = separator .. conjunction -- end
-- Return the formatted string
return mw.text.listToText(list, separator .. s, conjunction)
-- Stringifies lists with "and" or "or"
-- 本地化注意function p.andList (...) return conjList("and", ...) endfunction p.orList (...) return conjList("or", ...) end
--------------------------------------------------------------------------------
--default options table used across the forSee family of functions
-- 本地化注意
local forSeeDefaultOptions = {
andKeyword = 'and',
title = mw.title.getCurrentTitle().text,
otherText = 'other uses其他用法', forSeeForm = 'For 关于%s, see ,请参见%s.',
}
--Collapses duplicate punctuation
-- 本地化注意
function punctuationCollapse (text)
local replacements = {
["%.%]%]%.$"] = ".]]",
["%?%]%]%.$"] = "?]]",
["%!%]%]%.$"] = "!]]", ["%。%。$"] = "。", ["%?%。$"] = "?", ["%!%。$"] = "!", ["%。%]%]%。$"] = "。]]", ["%?%]%]%。$"] = "?]]", ["%!%]%]%。$"] = "!]]"
}
for k, v in pairs(replacements) do text = string.gsub(text, k, v) end
匿名用戶