Difference between revisions 21306659 and 21306660 on frwiktionarylocal export = {} local m_languages = require('Module:languages') -- The main entry point. -- This is the only function that can be invoked from a template. function export.show(frame) if mw.title.getCurrentTitle().nsText == "Template" then return "(This template should be used on pages in the Category: namespace.)" (contracted; show full) end -- Add cleanup category for empty categories if isEmpty and not current:canBeEmpty() then table.insert(categories, "[[Category:Empty categories]]") end local editlink = show_editlink(current)⏎ ⏎ -- Generate the displayed information table.insert(display, show_breadcrumbs(current)) table.insert(display, show_description(current)) table.insert(display, show_children(current)) table.insert(display, show_TOC(info)) show_categories(current, categories) return table.concat(categories, "") .. editlink .. "\n" .. table.concat(display, "\n\n") .. "<br clear=\"all\"/>" end function show_error(text) return mw.getCurrentFrame():expandTemplate{title = "maintenance box", args = { "red", image = "[[File:Ambox warning pn.svg|50px]]", title = "The automatically-generated contents of this category has errors.", (contracted; show full) table.insert(categories, "[[" .. umbrella .. "|" .. current:getCategoryName() .. "]]") else table.insert(categories, "[[Category:" .. umbrella:getCategoryName() .. "|" .. current:getCategoryName() .. "]]") end end end function show_editlink(current) return "<div class=\"noprint plainlinks category-edit-box\">[" .. mw.getCurrentFrame():callParserFunction{name = "fullurl", args = {current:getDataModule(), action = "edit"}} .. " Edit category data]</div>" end⏎ ⏎ -- Show navigational "breadcrumbs" at the top of the page. function show_breadcrumbs(current) local steps = {} -- Start at the current label and move our way up the "chain" from child to parent, until we can't go further. while current do local category = nil local display_name = nil if type(current) == "string" then category = current display_name = current:gsub("^Category:", "") else category = "Category:" .. current:getCategoryName() display_name = current:getBreadcrumbName() end display_name = mw.getContentLanguage():ucfirst(display_name) table.insert(steps, 1, "» [[:" .. category .. "|" .. display_name .. "]]") -- Move up the "chain" by one level. if type(current) == "string" then current = nil else current = current:getParents() if current then current = current[1].name end end end return "<small>" .. table.concat(steps, " ") .. "</small>" end -- Show a short description text for the category. function show_description(current) return (current:getDescription() or "") .. mw.getCurrentFrame():expandTemplate{title = "edit", args = {current:getDataModule(), type = "sup"}} end -- Show a list of child categories. function show_children(current) local children = current:getChildren() if not children then (contracted; show full) return mw.getCurrentFrame():expandTemplate{title = TOC_template.text, args = {}} end end return nil end return export All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://fr.wiktionary.org/w/index.php?diff=prev&oldid=21306660.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|