Difference between revisions 21306625 and 21306626 on frwiktionarylocal export = {} local m_submodule = nil -- 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 (contracted; show full) return table.concat(categories, "") .. table.concat(display, "\n\n") .. "<br clear=\"all\"/>" end -- Check the name of the current page, and return an error if it's not right. function check_name(template, info) local errortext = nil local category = nil ⏎ if notlocal current = m_submodule.new(info)⏎ ⏎ if not current then errortext = "The label \"" .. (info.label or "") .. "\" given to the " .. mw.getCurrentFrame():expandTemplate{title = "temp", args = {template}} .. " template is not valid. " .. "You may have mistyped it, or it simply has not been created yet. To add a new label, please consult the documentation of the template." category = "[[Category:Categories with invalid label]]" else local expected_name = (info.code and m_submodule.new(info):getBasicName() or m_submodule.new(info)current:getBasicName() or current:getUmbrellaName()) if expected_name ~= mw.title.getCurrentTitle().text then errortext = "Based on the parameters given to the " .. mw.getCurrentFrame():expandTemplate{title = "temp", args = {template}} .. " template, this category should be called '''[[:Category:" .. expected_name .. "]]'''." category = "[[Category:Categories with incorrect name]]" end end if errortext then return (category or "") .. 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.", text = errortext, }} else return nil end end -- Show the parent categories that the current category should be placed in. function show_categories(info, categories) local lang = require("Module:languages").getByCode(mw.getContentLanguage():getCode()) -- Used to create English sort keys if info.sc then local parent = (info.code and m_submodule.new({codinfo = mw.clone(info) pinfo.sc = nil local parent = m_submodule.new(pinfo) local parent_name = (info.code, label = info.label, sc = nil}):getBasicName() or m_submodule.new({code = info.code, label = info.label, sc = nil}) and parent:getBasicName() or parent:getUmbrellaName()) local sortparent = key = lang:makeSortKey(require("Module:scripts").getByCode(info.sc):getCanonicalName()) table.insert(categories, "[[Category:" .. parent_name .. "|" .. lang:makeSortKey(sortparent)sortkey .. "]]") else local parents = (info.code and m_submodule.new(info):getBasicParentLabels() or m_submodule.new(info):getUmbrellaParentLabels()) if not parents then return end (contracted; show full) end parent_display_name = mw.getContentLanguage():ucfirst(parent_display_name) table.insert(steps, 1, "» [[:" .. parent_category .. "|" .. parent_display_name .. "]]") end if info.sc then local category = "Category:" .. (info.code and m_submodule.new({code = info.code, label = info.label, sc = nil}):getBasicName() or m_submodule.new({code = info.code, label = info.label, sc = nil}):getUmbrellaName()) local display_name = m_submodule.new({code = info.code, label = info.label, sc = nil})pinfo = mw.clone(info) pinfo.sc = nil local parent = m_submodule.new(pinfo) local category = "Category:" .. (info.code and parent:getBasicName() or parent:getUmbrellaName()) local display_name = parent:getBreadcrumbName() table.insert(steps, "» [[:" .. category .. "|" .. mw.getContentLanguage():ucfirst(display_name) .. "]]") end local category = "Category:" .. (info.code and m_submodule.new(info):getBasicName() or m_submodule.new(info):getUmbrellaName()) local display_name = m_submodule.new(info):getBreadcrumbName() table.insert(steps, "» [[:" .. category .. "|" .. mw.getContentLanguage():ucfirst(display_name) .. "]]") (contracted; show full) local children_list = {} local children = m_submodule.new(info):getBasicChildLabels() if not children then return nil end for _, child in ipairs(children) do if type(child) == "string" then child = m_submodule.new({code = info.code, label = child, sc = info.sc}) require("Module:debug").track("category tree/child string") end⏎ ⏎ local child_basic = child:getBasicName() local child_page = mw.title.new("Category:" .. child_basic) if child_page.exists then local child_description = child:getBasicDescription() table.insert(children_list, "* [[:Category:" .. child_basic .. "]]: " .. child_description) end end return table.concat(children_list, "\n") end -- Show a table of contents with links to each letter in the language's script. function show_TOC(info) if not info.code then return nil end local num_pages = mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "pages") -- No need for a TOC if all entry names can fit on one page. if num_pages > 200 then -- This category is very large, see if there is an "extended" version of the TOC. if num_pages > 2500 then local TOC_template_extended = mw.title.new("Template:" .. info.code .. "-categoryTOC/full") if TOC_template_extended.exists then return mw.getCurrentFrame():expandTemplate{title = TOC_template_extended.text, args = {}} end end local TOC_template = mw.title.new("Template:" .. info.code .. "-categoryTOC") if TOC_template.exists then 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=21306626.
![]() ![]() 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.
|