پودمان:Hatnote list: تفاوت میان نسخهها
جز
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش |
جزبدون خلاصۀ ویرایش |
||
| خط ۳۳: | خط ۳۳: | ||
--Searches display text only | --Searches display text only | ||
local function searchDisp(haystack, needle) | local function searchDisp(haystack, needle) | ||
return | return string.find( | ||
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(" | function p.andList (...) return p.conjList("and", ...) end | ||
function p.orList (...) return p.conjList(" | 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 = | 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 = | local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr) | ||
forSeeStr = punctuationCollapse(forSeeStr) | forSeeStr = punctuationCollapse(forSeeStr) | ||
table.insert(strList, forSeeStr) | table.insert(strList, forSeeStr) | ||