کاربر ناشناس
بدون خلاصۀ ویرایش
جز (اصلاح علامت در الگوی مشابه الگو:اصلی) |
بدون خلاصۀ ویرایش |
||
خط ۳۳: | خط ۳۳: | ||
--Searches display text only | --Searches display text only | ||
local function searchDisp(haystack, needle) | local function searchDisp(haystack, needle) | ||
return | return mw.ustring.find( | ||
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(" | function p.andList (...) return p.conjList("و", ...) end | ||
function p.orList (...) return p.conjList(" | 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 = ' | andKeyword = 'و', | ||
title = mw.title.getCurrentTitle().text, | title = mw.title.getCurrentTitle().text, | ||
otherText = ' | otherText = 'دیگر کاربردها', | ||
forSeeForm = ' | forSeeForm = 'برای %s %s را ببینید.', | ||
} | } | ||
خط ۱۰۰: | خط ۱۰۰: | ||
local replacements = { | local replacements = { | ||
["%.%.$"] = ".", | ["%.%.$"] = ".", | ||
["% | ["%؟%.$"] = "؟", | ||
["%!%.$"] = "!", | ["%!%.$"] = "!", | ||
["%.%]%]%.$"] = ".]]", | ["%.%]%]%.$"] = ".]]", | ||
["% | ["%؟%]%]%.$"] = "؟]]", | ||
["%!%]%]%.$"] = "!]]" | ["%!%]%]%.$"] = "!]]" | ||
} | } | ||
for k, v in pairs(replacements) do text = | 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 = | local forSeeStr = mw.ustring.format(options.forSeeForm, useStr, pagesStr) | ||
forSeeStr = punctuationCollapse(forSeeStr) | forSeeStr = punctuationCollapse(forSeeStr) | ||
table.insert(strList, forSeeStr) | table.insert(strList, forSeeStr) |