پودمان:Hatnote list: تفاوت میان نسخه‌ها

۵۷ بایت اضافه‌شده ،  ‏۲ فوریهٔ ۲۰۲۲
بدون خلاصۀ ویرایش
جز (اصلاح علامت در الگوی مشابه الگو:اصلی)
بدون خلاصۀ ویرایش
خط ۳۳: خط ۳۳:
--Searches display text only
--Searches display text only
local function searchDisp(haystack, needle)
local function searchDisp(haystack, needle)
return string.find(
return mw.ustring.find(
string.sub(haystack, (string.find(haystack, '|') or 0) + 1), needle
mw.ustring.sub(haystack, (mw.ustring.find(haystack, '|') or 0) + 1), needle
)
)
end
end
خط ۷۸: خط ۷۸:


-- Stringifies lists with "and" or "or"
-- Stringifies lists with "and" or "or"
function p.andList (...) return p.conjList("and", ...) end
function p.andList (...) return p.conjList("و", ...) end
function p.orList (...) return p.conjList("or", ...) end
function p.orList (...) return p.conjList("یا", ...) end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
خط ۹۰: خط ۹۰:
--default options table used across the forSee family of functions
--default options table used across the forSee family of functions
local forSeeDefaultOptions = {
local forSeeDefaultOptions = {
andKeyword = 'and',
andKeyword = 'و',
title = mw.title.getCurrentTitle().text,
title = mw.title.getCurrentTitle().text,
otherText = 'other uses',
otherText = 'دیگر کاربردها',
forSeeForm = 'For %s, see %s.',
forSeeForm = 'برای %s %s را ببینید.',
}
}


خط ۱۰۰: خط ۱۰۰:
local replacements = {
local replacements = {
["%.%.$"] = ".",
["%.%.$"] = ".",
["%?%.$"] = "?",
["%؟%.$"] = "؟",
["%!%.$"] = "!",
["%!%.$"] = "!",
["%.%]%]%.$"] = ".]]",
["%.%]%]%.$"] = ".]]",
["%?%]%]%.$"] = "?]]",
["%؟%]%]%.$"] = "؟]]",
["%!%]%]%.$"] = "!]]"
["%!%]%]%.$"] = "!]]"
}
}
for k, v in pairs(replacements) do text = string.gsub(text, k, v) end
for k, v in pairs(replacements) do text = mw.ustring.gsub(text, k, v) end
return text
return text
end
end
خط ۱۸۵: خط ۱۸۵:
link = mHatnote.disambiguate(options.title)
link = mHatnote.disambiguate(options.title)
}
}
local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr)
local forSeeStr = mw.ustring.format(options.forSeeForm, useStr, pagesStr)
forSeeStr = punctuationCollapse(forSeeStr)
forSeeStr = punctuationCollapse(forSeeStr)
table.insert(strList, forSeeStr)
table.insert(strList, forSeeStr)
کاربر ناشناس