Mô đun:Cat main
Tài liệu mô đun
-- This module implements {{cat main}}.local mHatnote = require('Mô đun:Hatnote')local yesno = require('Mô đun:Yesno')local mTableTools -- lazily initialiselocal mArguments -- lazily initialiselocal p = {}function p.catMain(frame)mTableTools = require('Mô đun:TableTools')mArguments = require('Mô đun:Arguments')local args = mArguments.getArgs(frame, {wrappers = 'Bản mẫu:Bài chính thể loại'})local pages = mTableTools.compressSparseArray(args)local options = {article = args.article,selfref = args.selfref}return p._catMain(options, unpack(pages))endfunction p._catMain(options, ...)options = options or {}-- Get the links table.local links = mHatnote.formatPages(...)if not links[1] thenlocal page = mw.title.getCurrentTitle().textlinks[1] = mHatnote._formatLink(page)endfor i, link in ipairs(links) dolinks[i] = string.format("'''%s'''", link)end-- Get the pagetype.local pagetypeif yesno(options.article) ~= false thenpagetype = 'Bài viết'elsepagetype = 'Trang'end-- Work out whether we need to be singular or plural.local stringToFormatif #links > 1 thenstringToFormat = '%s chính của [[Wikipedia:Thể loại|thể loại]] này là %s.'elsestringToFormat = '%s chính của [[Wikipedia:Thể loại|thể loại]] này là %s.'end-- Get the text.local text = string.format(stringToFormat,pagetype,mw.text.listToText(links))-- Pass it through to Module:Hatnote.local hnOptions = {}hnOptions.selfref = options.selfrefhnOptions.extraclasses = 'relarticle mainarticle'return mHatnote._hatnote(text, hnOptions)endreturn p
🔥 Top keywords: Đài Truyền hình Kỹ thuật số VTCTrang ChínhGiỗ Tổ Hùng VươngTrương Mỹ LanĐặc biệt:Tìm kiếmHùng VươngVương Đình HuệUEFA Champions LeagueKuwaitChiến dịch Điện Biên PhủFacebookĐài Truyền hình Việt NamTrần Cẩm TúĐội tuyển bóng đá quốc gia KuwaitGoogle DịchViệt NamCúp bóng đá U-23 châu ÁCúp bóng đá U-23 châu Á 2024Real Madrid CFBảng xếp hạng bóng đá nam FIFACleopatra VIITô LâmTim CookNguyễn Phú TrọngHồ Chí MinhHai Bà TrưngManchester City F.C.VnExpressChủ tịch nước Cộng hòa xã hội chủ nghĩa Việt NamNguyễn Ngọc ThắngĐền HùngCúp bóng đá trong nhà châu Á 2024Võ Văn ThưởngOne PieceLịch sử Việt NamCuộc đua xe đạp toàn quốc tranh Cúp truyền hình Thành phố Hồ Chí Minh 2024Phạm Minh ChínhTikTokĐinh Tiên Hoàng