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

جز
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
جزبدون خلاصۀ ویرایش
خط ۳۳: خط ۳۳:
--Searches display text only
--Searches display text only
local function searchDisp(haystack, needle)
local function searchDisp(haystack, needle)
return mw.ustring.find(
return string.find(
mw.ustring.sub(haystack, (mw.ustring.find(haystack, '|') or 0) + 1), needle
string.sub(haystack, (string.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("و", ...) end
function p.andList (...) return p.conjList("and", ...) end
function p.orList (...) return p.conjList("یا", ...) end
function p.orList (...) return p.conjList("or", ...) end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
خط ۹۳: خط ۹۳:
title = mw.title.getCurrentTitle().text,
title = mw.title.getCurrentTitle().text,
otherText = 'دیگر کاربردها',
otherText = 'دیگر کاربردها',
forSeeForm = 'برای %s %s را ببینید.',
forSeeForm = 'برای %s, ببینید %s.',
}
}


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

ویرایش