Difference between revisions 21306556 and 21306557 on frwiktionarylocal export = {} -- 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.)" elseif mw.title.getCurrentTitle().nsText ~= "Category" then (contracted; show full) local subcategories = {} for i = 1, 40 do local subcat = get_item(info, "sub" .. i) if subcat ~= "" then local subcat_name = get_item({code = info.code, label = subcat, sc = info.sc, template = info.template}, "basic") if info.template == "scriptcatboiler" then error(subcat_name) end⏎ local subcat_page = mw.title.new("Category:" .. subcat_name) if subcat_page.exists then local subcat_description = get_item({code = info.code, label = subcat, sc = info.sc, template = info.template}, "description") table.insert(subcategories, "* [[:Category:" .. subcat_name .. "]]: " .. subcat_description) end end end if #subcategories > 0 then return table.concat(subcategories, "\n") else return nil end 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=21306557.
![]() ![]() 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.
|