İçeriğe atla
Ana menü
Ana menü
kenar çubuğuna taşı
gizle
Gezinti
Anasayfa
Son değişiklikler
Rastgele sayfa
Sanat masası
Bağış yap
Özel sayfalar
Ara
Ara
Görünüm
Hesap oluştur
Oturum aç
Kişisel araçlar
Hesap oluştur
Oturum aç
"
Modül:Infobox/utilities
" sayfasını değiştirmektesiniz
Modül
Tartışma
English
Oku
Kaynağı düzenle
Geçmişi gör
Araçlar
Araçlar
kenar çubuğuna taşı
gizle
Eylemler
Oku
Kaynağı düzenle
Geçmişi gör
Genel
Sayfaya bağlantılar
İlgili değişiklikler
Sayfa bilgisi
Görünüm
kenar çubuğuna taşı
gizle
Uyarı:
Oturum açmadınız. Bir düzenleme yaptığınızda, sizin için geçici bir hesap oluşturulur.
Daha fazla bilgi
. Bu hesabın süresi dolduğunda bildirimler almaya devam etmek ve diğer özelliklere erişmek için
oturum açın
ya da
hesap oluşturun
.
Anti spam denetimi. Bunu
doldurmayın
!
require('strict'); local getArgs = require ('Module:Arguments').getArgs; --[[--------------------------< I S _ C J K _ C O D E >-------------------------------------------------------- return true if code is one of the listed Chinese, Japanese, Korean ISO 639 codes, false else. ]] local function is_cjk_code (code) local cjk = { ['zh'] = true, ['cdo'] = true, ['cjy'] = true, ['cmn'] = true, -- Chinese language codes ['cpi'] = true, ['cpx'] = true, ['czh'] = true, ['czo'] = true, ['gan'] = true, ['hak'] = true, ['hsn'] = true, ['ltc'] = true, ['lzh'] = true, ['mnp'] = true, ['nan'] = true, ['och'] = true, ['wuu'] = true, ['yue'] = true, ['zhx'] = true, ['ja'] = true, ['jpx'] = true, ['ojp'] = true, -- Japanese language codes ['ko'] = true, ['okm'] = true, ['oko'] = true, -- Korean language codes } return cjk[code] or false; end --[[--------------------------< S E T _ I T A L I C S >-------------------------------------------------------- Created for use with Template:Infobox book and Template:Infobox document and perhaps others to replace hard-coded italic markup in the call to {{lang}}. This module attempts to make sure that {{lang}} correctly applies italic markup according to MOS:FOREIGNITALIC. |italics={{#invoke:Infobox/utilities|set_italics|{{{orig_lang_code|}}}|{{{title_orig}}}}}}} ]] local function set_italics (frame) local args=getArgs(frame); local code = args[1] or args['code'] or ''; -- empty string causes 'yes' return; {{lang}} will handle the missing code error local text = args[2] or args['text'] or ''; -- empty string causes 'yes' return; {{lang}} will handle the missing text error local is_latn = require ("Module:Unicode data").is_Latin; code = code:gsub ('^(%a+).*', '%1'); -- strip subtags from IETF tag to leave just the language subtag if is_cjk_code (code) and not is_latn (text) then -- is_latn() is in Module:Unicode data return 'no'; -- only case for 'no' end return 'yes'; -- everything else is yes end --[[--------------------------< C O M P >---------------------------------------------------------------------- compare function for result{} table descending sort ]] local function comp (a, b) return tonumber (a[1]) > tonumber (b[1]); end --[[--------------------------< S O R T _ C O M M O N >-------------------------------------------------------- common function to render sorted distribution, ethnicity, and occupation lists. inputs: result - table of percentages and labels ref - value from |distribution ref=, |ethnicity ref=, or |occupation ref= as appropriate frame - calling frame required for expandTemplate() returns sorted list on success; empty string else ]] local function sort_common (result, ref, frame) for i=#result, 1, -1 do if not tonumber (result[i][1]) then -- if cannot be converted to a number table.remove (result, i); -- delete end end if 0 == #result then -- if we get here and the result table is empty return ''; -- abandon returning empty string end table.sort (result, comp); -- sort what remains for i, v in ipairs (result) do result[i] = table.concat (result[i]); -- make each table in result{} a string end result[1] = table.concat ({result[1], ref and ref or ''}); -- add reference(s) from |<list> ref= to first item in the list return frame:expandTemplate { title = 'Unbulleted list', args = result}; -- render the unbulleted list end --[[--------------------------< D I S R I B U T I O N _ S O R T >---------------------------------------------- {{#invoke:Infobox/utilities|distribution_sort|{{{percent urban|}}}|{{{percent rural|}}}|{{{distribution ref|}}} }} ]] local function distribution_sort(frame) local args = getArgs(frame) local result = { {args[1], ' kentsel'}, {args[2], ' kırsal'}, } local output = {} for i = 1, #result do if result[i][1] and result[i][1] ~= '' then local number = string.gsub(result[i][1], '%.', ',') table.insert(output, '%' .. number .. result[i][2]) end end if #output == 0 then return '' end return table.concat(output, '<br/>') end --[[--------------------------< E T H N I C I T Y _ S O R T >-------------------------------------------------- {{#invoke:Infobox/utilities|ethnicity_sort|{{{percent white|}}}|{{{percent black|}}}|{{{percent asian|}}}|{{{percent hispanic|}}}|{{{percent native american|}}}|{{{percent native hawaiian|}}}|{{{percent more than one race|}}}|{{{percent other race|}}}|{{{ethnicity ref|}}} }} ]] local function ethnicity_sort(frame) local args = getArgs(frame) local result = { {args[1], ' [[Beyaz Amerikalılar|Beyaz]]'}, {args[2], ' [[Afroamerikalılar|Siyahi]]'}, {args[3], ' [[Asyalı Amerikalılar|Asyalı]]'}, {args[4], ' [[Hispanik ve Latin Amerikalılar|Hispanik]]'}, {args[5], ' [[Amerika Birleşik Devletleri Kızılderilileri|Yerli Amerikalı]]'}, {args[6], ' [[Pasifik adalı Amerikalılar|Pasifik adalılar]]'}, {args[7], ' [[Çok ırklı Amerikalılar|Çok ırklı]]'}, {args[8], ' diğer'}, } local output = {} for i = 1, #result do local raw = args[i] or "" local s = string.gsub(raw, ",", ".") local value = tonumber(s) if value then table.insert(output, {value, result[i][2]}) end end table.sort(output, function(a, b) return a[1] > b[1] end) local formatted = {} for _, entry in ipairs(output) do local number = tostring(entry[1]):gsub("%.", ",") table.insert(formatted, "%" .. number .. entry[2]) end if #formatted == 0 then return '' end return table.concat(formatted, '<br/>') end --[[--------------------------< O C C U P A T I O N _ S O R T >------------------------------------------------ {{#invoke:Infobox/utilities|distribution_sort|{{{percent blue collar|}}}|{{{percent white collar|}}}|{{{percent grey collar|}}}|{{{occupation ref|}}} }} ]] local function occupation_sort(frame) local args = getArgs(frame) local result = { {args[1], ' [[Mavi yakalı işçi|mavi yakalı]]'}, {args[2], ' [[Beyaz yakalı işçi|beyaz yakalı]]'}, {args[3], ' [[Gri yakalı işçi|gri yakalı]]'}, } local output = {} for i = 1, #result do if result[i][1] and result[i][1] ~= '' then local number = string.gsub(result[i][1], '%.', ',') table.insert(output, '%' .. number .. result[i][2]) end end if #output == 0 then return '' end return table.concat(output, '<br/>') end --[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------ ]] return { distribution_sort = distribution_sort, -- {{Şablon U.S. congressional district}} ethnicity_sort = ethnicity_sort, occupation_sort = occupation_sort, set_italics = set_italics, -- {{Infobox book}} }
Özet:
Sanarşiv web sitesine yapılan tüm katkıların diğer katılımcılar tarafından düzenlenebileceğini, değiştirilebileceğini veya kaldırılabileceğini lütfen unutmayın. Yazınızın acımasızca düzenlenmesini istemiyorsanız, buraya göndermeyin.
Ayrıca, bunu kendiniz yazdığınızı veya herkese açık bir alandan veya benzeri ücretsiz bir kaynaktan kopyaladığınıza söz veriyorsunuz (ayrıntılar için
Sanarşiv:Telif hakları
sayfasına bakın).
Telif hakkıyla korunan eseri izinsiz göndermeyin!
İptal
Değişiklik yardımı
(yeni pencerede açılır)
Bu sayfada yer alan sayfa:
Modül:Infobox/utilities/belge
(
değiştir
)
Ara
Ara
"
Modül:Infobox/utilities
" sayfasını değiştirmektesiniz
Konu ekle