विकिपीडिया bhwiki https://bh.wikipedia.org/wiki/%E0%A4%AE%E0%A5%81%E0%A4%96%E0%A5%8D%E0%A4%AF_%E0%A4%AA%E0%A4%A8%E0%A5%8D%E0%A4%A8%E0%A4%BE MediaWiki 1.47.0-wmf.5 first-letter मीडिया विशेष वार्तालाप प्रयोगकर्ता प्रयोगकर्ता वार्ता विकिपीडिया विकिपीडिया वार्ता चित्र चित्र वार्ता मीडियाविकि मीडियाविकि वार्ता टेम्पलेट टेम्पलेट वार्ता मदद मदद वार्ता श्रेणी श्रेणी वार्ता TimedText TimedText talk Module Module talk Event Event talk वार्तालाप:मधेपुरा जिला 1 5959 796486 796485 2026-06-05T12:13:33Z SM7 3953 Reverted edit by [[Special:Contributions/~2026-33320-24|~2026-33320-24]] ([[User talk:~2026-33320-24|talk]]) to last revision by [[User:Mayur|Mayur]] 77374 wikitext text/x-wiki {{वार्ता शीर्षक}} gpfqtvs6ipx5lqjhtgasmr80u6e2dmv Module:InfoboxImage 828 10452 796814 736107 2023-11-21T13:26:24Z en>WOSlinker 0 update strip maker detection as per request on talk page 796814 Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Female no free image yet.png", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female (blue).svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end function i.InfoboxImage(frame) local image = frame.args["image"]; if image == "" or image == nil then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "[http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[[http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "https:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[https:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,8)) == "[[https:" then return ""; end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = "[[Category:Pages using infoboxes with thumbnail images]]"; end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local upright = frame.args["upright"] or ""; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if maxsize ~= "" and maxsize ~= nil then -- if no sizedefault then set to maxsize if sizedefault == "" or sizedefault == nil then sizedefault = maxsize end -- check to see if size bigger than maxsize if size ~= "" and size ~= nil then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if sizenumber>maxsizenumber and maxsizenumber>0 then size = maxsize; end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if page ~= "" and page ~= nil then result = result .. "|page=" .. page; end if size ~= "" and size ~= nil then result = result .. "|" .. size; elseif sizedefault ~= "" and sizedefault ~= nil then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if alt ~= "" and alt ~= nil then result = result .. "|alt=" .. alt; end if link ~= "" and link ~= nil then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if class ~= nil and class ~= "" then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if title ~= "" and title ~= nil then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if title ~= "" and title ~= nil then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; 66zbu8dcq5z54eqf54ey27ri1xodxpd 796815 796814 2024-07-22T15:59:33Z en>GreenC 0 per talk 796815 Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Female no free image yet.png", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female (blue).svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end function i.InfoboxImage(frame) local image = frame.args["image"]; if image == "" or image == nil then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "http:" then return "[[Category:Pages using infoboxes with URL in image parameter]]"; end if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "[http:" then return "[[Category:Pages using infoboxes with URL in image parameter]]"; end if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[[http:" then return "[[Category:Pages using infoboxes with URL in image parameter]]"; end if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "https:" then return "[[Category:Pages using infoboxes with URL in image parameter]]"; end if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[https:" then return "[[Category:Pages using infoboxes with URL in image parameter]]"; end if mw.ustring.lower(mw.ustring.sub(image,1,8)) == "[[https:" then return "[[Category:Pages using infoboxes with URL in image parameter]]"; end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = "[[Category:Pages using infoboxes with thumbnail images]]"; end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local upright = frame.args["upright"] or ""; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if maxsize ~= "" and maxsize ~= nil then -- if no sizedefault then set to maxsize if sizedefault == "" or sizedefault == nil then sizedefault = maxsize end -- check to see if size bigger than maxsize if size ~= "" and size ~= nil then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if sizenumber>maxsizenumber and maxsizenumber>0 then size = maxsize; end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if page ~= "" and page ~= nil then result = result .. "|page=" .. page; end if size ~= "" and size ~= nil then result = result .. "|" .. size; elseif sizedefault ~= "" and sizedefault ~= nil then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if alt ~= "" and alt ~= nil then result = result .. "|alt=" .. alt; end if link ~= "" and link ~= nil then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if class ~= nil and class ~= "" then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if title ~= "" and title ~= nil then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if title ~= "" and title ~= nil then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; 8dnoem4c76yrjwg6ffn5td0h85gd5tp 796816 796815 2024-07-22T16:47:36Z en>WOSlinker 0 update with [[User:Hike395]]'s changes from sandbox as well 796816 Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } local categories = { url_image_links = "[[Category:Pages using infoboxes with URL in image parameter]]", thumbnail_images = "[[Category:Pages using infoboxes with thumbnail images]]", } function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end function i.InfoboxImage(frame) local image = frame.args["image"]; if image == "" or image == nil then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if string.find(image, "^%[*https?:") then -- Error category. return categories.url_image_links end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = categories.url_image_links; end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local upright = frame.args["upright"] or ""; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if maxsize ~= "" and maxsize ~= nil then -- if no sizedefault then set to maxsize if sizedefault == "" or sizedefault == nil then sizedefault = maxsize end -- check to see if size bigger than maxsize if size ~= "" and size ~= nil then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if sizenumber>maxsizenumber and maxsizenumber>0 then size = maxsize; end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if page ~= "" and page ~= nil then result = result .. "|page=" .. page; end if size ~= "" and size ~= nil then result = result .. "|" .. size; elseif sizedefault ~= "" and sizedefault ~= nil then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if alt ~= "" and alt ~= nil then result = result .. "|alt=" .. alt; end if link ~= "" and link ~= nil then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if class ~= nil and class ~= "" then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if title ~= "" and title ~= nil then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if title ~= "" and title ~= nil then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; 2l3324g4j17iyhw54wqc7pcj2vj4gz1 796817 796816 2024-07-27T16:06:42Z en>Hike395 0 fix tracking cat bug, don't track in user or draft space 796817 Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } local categories = { url_image_links = "[[Category:Pages using infoboxes with URL in image parameter]]", thumbnail_images = "[[Category:Pages using infoboxes with thumbnail images]]", } local function trackable() local ns = mw.title.getCurrentTitle().nsText:lower() return not (ns == 'user' or ns == 'draft') end function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end function i.InfoboxImage(frame) local image = frame.args["image"]; if image == "" or image == nil then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if string.find(image, "^%[*https?:") then -- Error category. return trackable() and categories.url_image_links or "" end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = trackable() and categories.thumbnail_images or "" end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local upright = frame.args["upright"] or ""; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if maxsize ~= "" and maxsize ~= nil then -- if no sizedefault then set to maxsize if sizedefault == "" or sizedefault == nil then sizedefault = maxsize end -- check to see if size bigger than maxsize if size ~= "" and size ~= nil then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if sizenumber>maxsizenumber and maxsizenumber>0 then size = maxsize; end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if page ~= "" and page ~= nil then result = result .. "|page=" .. page; end if size ~= "" and size ~= nil then result = result .. "|" .. size; elseif sizedefault ~= "" and sizedefault ~= nil then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if alt ~= "" and alt ~= nil then result = result .. "|alt=" .. alt; end if link ~= "" and link ~= nil then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if class ~= nil and class ~= "" then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if title ~= "" and title ~= nil then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if title ~= "" and title ~= nil then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; rvh0kbm4ou98e7g7y1d3u9ykan4pa6w 796818 796817 2024-07-28T11:18:58Z en>Gonnym 0 draft is valid and users should be informed that there is an error with what they are doing 796818 Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } local categories = { url_image_links = "[[Category:Pages using infoboxes with URL in image parameter]]", thumbnail_images = "[[Category:Pages using infoboxes with thumbnail images]]", } local function trackable() local ns = mw.title.getCurrentTitle().nsText:lower() return not ns == 'user' end function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end function i.InfoboxImage(frame) local image = frame.args["image"]; if image == "" or image == nil then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if string.find(image, "^%[*https?:") then -- Error category. return trackable() and categories.url_image_links or "" end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = trackable() and categories.thumbnail_images or "" end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local upright = frame.args["upright"] or ""; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if maxsize ~= "" and maxsize ~= nil then -- if no sizedefault then set to maxsize if sizedefault == "" or sizedefault == nil then sizedefault = maxsize end -- check to see if size bigger than maxsize if size ~= "" and size ~= nil then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if sizenumber>maxsizenumber and maxsizenumber>0 then size = maxsize; end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if page ~= "" and page ~= nil then result = result .. "|page=" .. page; end if size ~= "" and size ~= nil then result = result .. "|" .. size; elseif sizedefault ~= "" and sizedefault ~= nil then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if alt ~= "" and alt ~= nil then result = result .. "|alt=" .. alt; end if link ~= "" and link ~= nil then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if class ~= nil and class ~= "" then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if title ~= "" and title ~= nil then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if title ~= "" and title ~= nil then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; e5vybav5g9fztewcf49i66ese18fogf 796819 796818 2024-08-08T19:10:55Z en>WOSlinker 0 exclude user talk from tracking 796819 Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } local categories = { url_image_links = "[[Category:Pages using infoboxes with URL in image parameter]]", thumbnail_images = "[[Category:Pages using infoboxes with thumbnail images]]", } local function trackable() local ns = mw.title.getCurrentTitle().nsText:lower() return not (ns == 'user' or ns == 'user talk') end function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end function i.InfoboxImage(frame) local image = frame.args["image"]; if image == "" or image == nil then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if string.find(image, "^%[*https?:") then -- Error category. return trackable() and categories.url_image_links or "" end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = trackable() and categories.thumbnail_images or "" end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local upright = frame.args["upright"] or ""; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if maxsize ~= "" and maxsize ~= nil then -- if no sizedefault then set to maxsize if sizedefault == "" or sizedefault == nil then sizedefault = maxsize end -- check to see if size bigger than maxsize if size ~= "" and size ~= nil then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if sizenumber>maxsizenumber and maxsizenumber>0 then size = maxsize; end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if page ~= "" and page ~= nil then result = result .. "|page=" .. page; end if size ~= "" and size ~= nil then result = result .. "|" .. size; elseif sizedefault ~= "" and sizedefault ~= nil then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if alt ~= "" and alt ~= nil then result = result .. "|alt=" .. alt; end if link ~= "" and link ~= nil then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if class ~= nil and class ~= "" then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if title ~= "" and title ~= nil then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if title ~= "" and title ~= nil then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; 2ohqqedq1scfevaci8ml267ehill79u 796820 796819 2025-08-11T22:38:05Z en>Pppery 0 Changed protection settings for "[[Module:InfoboxImage]]": [[WP:High-risk templates|High-risk template or module]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite)) 796819 Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } local categories = { url_image_links = "[[Category:Pages using infoboxes with URL in image parameter]]", thumbnail_images = "[[Category:Pages using infoboxes with thumbnail images]]", } local function trackable() local ns = mw.title.getCurrentTitle().nsText:lower() return not (ns == 'user' or ns == 'user talk') end function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end function i.InfoboxImage(frame) local image = frame.args["image"]; if image == "" or image == nil then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if string.find(image, "^%[*https?:") then -- Error category. return trackable() and categories.url_image_links or "" end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = trackable() and categories.thumbnail_images or "" end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local upright = frame.args["upright"] or ""; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if maxsize ~= "" and maxsize ~= nil then -- if no sizedefault then set to maxsize if sizedefault == "" or sizedefault == nil then sizedefault = maxsize end -- check to see if size bigger than maxsize if size ~= "" and size ~= nil then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if sizenumber>maxsizenumber and maxsizenumber>0 then size = maxsize; end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if page ~= "" and page ~= nil then result = result .. "|page=" .. page; end if size ~= "" and size ~= nil then result = result .. "|" .. size; elseif sizedefault ~= "" and sizedefault ~= nil then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if alt ~= "" and alt ~= nil then result = result .. "|alt=" .. alt; end if link ~= "" and link ~= nil then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if class ~= nil and class ~= "" then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if title ~= "" and title ~= nil then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if title ~= "" and title ~= nil then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; 2ohqqedq1scfevaci8ml267ehill79u 796821 796820 2025-08-17T04:35:21Z en>Pppery 0 Copy from sandbox per request 796821 Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } local categories = { url_image_links = "[[Category:Pages using infoboxes with URL in image parameter]]", thumbnail_images = "[[Category:Pages using infoboxes with thumbnail images]]", } local function trackable() local ns = mw.title.getCurrentTitle().nsText:lower() return not (ns == 'user' or ns == 'user talk') end function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end local function isempty(x) return (not x) or x == "" end function i.InfoboxImage(frame) local image = frame.args["image"]; if isempty(image) then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if string.find(image, "^%[*https?:") then -- Error category. return trackable() and categories.url_image_links or "" end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = trackable() and categories.thumbnail_images or "" end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local upright = frame.args["upright"] or "" local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if not isempty(maxsize) then -- if no sizedefault nor upright, then set to maxsize if isempty(sizedefault) and isempty(upright) then sizedefault = maxsize end -- check to see if size bigger than maxsize local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if not isempty(size) then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; if sizenumber > maxsizenumber and maxsizenumber > 0 then size = maxsize; end end -- check to see if upright bigger than maxsize (at default preferred size) if not isempty(upright) then local uprightnumber = tonumber(upright) or (upright == "yes" and 0.75) or 0 if uprightnumber*220 > maxsizenumber and maxsizenumber > 0 then upright = tostring(maxsizenumber/220) end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if not isempty(page) then result = result .. "|page=" .. page; end if not isempty(size) then result = result .. "|" .. size; elseif not isempty(sizedefault) and isempty(upright) then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if not isempty(alt) then result = result .. "|alt=" .. alt; end if not isempty(link) then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if not isempty(class) then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if not isempty(title) then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if not isempty(title) then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; of20f6khqtfidv7aw8kyols9e0xe115 796822 796821 2025-10-18T09:45:47Z en>WOSlinker 0 make changes from sandbox requested by [[User:Hike395]] on talk page 796822 Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {} -- List of placeholder images and tracking categories stored in [[Module:InfoboxImage/data]] -- Other constants: -- the system-wide default thumbnail size (in px) local defaultThumbnailSize = 250 -- If page is not a user page, return tracking category. Else return empty. local function trackingCat(cat) local ns = mw.title.getCurrentTitle().nsText:lower() local categories = mw.loadData('Module:InfoboxImage/data').categories return (ns ~= 'user' and ns ~= 'user talk' and categories[cat]) or "" end -- Determine whether image is a placeholder function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); local placeholder_image = mw.loadData('Module:InfoboxImage/data').placeholder_image return placeholder_image[image] end local function isempty(x) return (not x) or x == "" end -- Main entry point function i.InfoboxImage(frame) local image = frame.args["image"]; if isempty(image) then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if string.find(image, "^%[*https?:") then -- Error category. return trackingCat("url_image_links") end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = trackingCat("thumbnail_images") end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local upright = frame.args["upright"] or "" local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if not isempty(maxsize) then -- if no sizedefault nor upright, then set to maxsize if isempty(sizedefault) and isempty(upright) then sizedefault = maxsize end -- check to see if size bigger than maxsize local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if not isempty(size) then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; if sizenumber > maxsizenumber and maxsizenumber > 0 then size = maxsize; end end -- check to see if upright bigger than maxsize (at default preferred size) if not isempty(upright) then local uprightnumber = tonumber(upright) or (upright == "yes" and 0.75) or 0 if uprightnumber*defaultThumbnailSize > maxsizenumber and maxsizenumber > 0 then upright = tostring(maxsizenumber/defaultThumbnailSize) end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if not isempty(page) then result = result .. "|page=" .. page; end if not isempty(size) then result = result .. "|" .. size; elseif not isempty(sizedefault) and isempty(upright) then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if not isempty(alt) then result = result .. "|alt=" .. alt; end if not isempty(link) then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if not isempty(class) then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if not isempty(title) then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if not isempty(title) then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; jhks6vfk9v2iehyrc6dp50ju1s294vf 796823 796822 2026-06-06T02:58:27Z SM7 3953 9 revisions imported from [[:en:Module:InfoboxImage]] 796822 Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {} -- List of placeholder images and tracking categories stored in [[Module:InfoboxImage/data]] -- Other constants: -- the system-wide default thumbnail size (in px) local defaultThumbnailSize = 250 -- If page is not a user page, return tracking category. Else return empty. local function trackingCat(cat) local ns = mw.title.getCurrentTitle().nsText:lower() local categories = mw.loadData('Module:InfoboxImage/data').categories return (ns ~= 'user' and ns ~= 'user talk' and categories[cat]) or "" end -- Determine whether image is a placeholder function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); local placeholder_image = mw.loadData('Module:InfoboxImage/data').placeholder_image return placeholder_image[image] end local function isempty(x) return (not x) or x == "" end -- Main entry point function i.InfoboxImage(frame) local image = frame.args["image"]; if isempty(image) then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if string.find(image, "^%[*https?:") then -- Error category. return trackingCat("url_image_links") end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = trackingCat("thumbnail_images") end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,8) == mw.ustring.char(127).."'\"`UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local upright = frame.args["upright"] or "" local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if not isempty(maxsize) then -- if no sizedefault nor upright, then set to maxsize if isempty(sizedefault) and isempty(upright) then sizedefault = maxsize end -- check to see if size bigger than maxsize local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if not isempty(size) then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; if sizenumber > maxsizenumber and maxsizenumber > 0 then size = maxsize; end end -- check to see if upright bigger than maxsize (at default preferred size) if not isempty(upright) then local uprightnumber = tonumber(upright) or (upright == "yes" and 0.75) or 0 if uprightnumber*defaultThumbnailSize > maxsizenumber and maxsizenumber > 0 then upright = tostring(maxsizenumber/defaultThumbnailSize) end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if not isempty(page) then result = result .. "|page=" .. page; end if not isempty(size) then result = result .. "|" .. size; elseif not isempty(sizedefault) and isempty(upright) then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if not isempty(alt) then result = result .. "|alt=" .. alt; end if not isempty(link) then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if not isempty(class) then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if not isempty(title) then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if not isempty(title) then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; jhks6vfk9v2iehyrc6dp50ju1s294vf जीटी रोड 0 16129 796501 747718 2026-06-05T12:49:49Z SM7 3953 SM7 पन्ना [[जी.टी. रोड]] के [[जीटी रोड]] पर स्थानांतरण कइलें: बेहतर/कॉमन भोजपुरी नाँव (Better/common name) ([[WP:COMMONNAME]]) 747718 wikitext text/x-wiki {{Infobox road |name = Grand Trunk Road |header_type = historic |alternate_name = GT Road |cities = [[Chittagong]], [[Dhaka]], [[Rajshahi]], [[Purnea]], [[Patna]], [[Varanasi]], [[Agra]], [[Mathura]], [[दिल्ली]], [[Sonipat]], [[Panipat]], [[Kurukshetra]], [[Ambala]], [[Ludhiana]], [[Amritsar]], [[Lahore]], [[Gujranwala]], [[Rawalpindi]], [[Peshawar]], [[Jalalabad]], [[Kabul]] | image = | time_period = c. 322 and 187 BCE |length_mi = |length_km = 2500 |length_round = |length_ref = <ref>{{cite book|last1=Bergsma|first1=Harold|title=India: Essays and Insights by a Gora|date=2011|publisher=Lulu|isbn=8183320619|page=137|url=https://books.google.com.bd/books?isbn=1105344290|accessdate=19 July 2016}}</ref> | length_notes = | established = before 322 BCE | formed = | history = [[Maurya Empire]] | known_for = [[Maurya Empire]], [[Kos Minar]], [[Dhaba]], [[Sher Shah Suri]] | status = Currently functional | reestablished_and_extended_by=[[Sher Shah Suri]] | significance = [[Outline of South Asian history|South Asian history]] |direction_a = East |terminus_a = [[Chittagong]], [[Bangladesh]] |direction_b = West |terminus_b = [[Kabul]], [[Afghanistan]] }} '''जी टी रोड''' या ग्रैंड ट्रंक रोड भारत में एगो सड़क बा । जेकरा के शेरशाह सूरी बनवइले रहन। जी टी रोड अंग्रेज लोग एकर ई नाम रखले रहे । अब ऐकर नाम एनएच1 और एनएच2 बा । पहिले ई सड़क कोलकाता से पेसावार तक रहे। {{Clear}} ==संदर्भ== {{Reflist}} {{सड़क-आधार}} [[श्रेणी:एशिया में परिवहन]] [[श्रेणी:भारत में सड़क परिवहन]] [[श्रेणी:भारत के सड़क]] 1shoi3xsxqwe5c5rv9agirpr6d5xt3w Module:Infobox 828 27376 796824 736012 2025-12-12T23:40:10Z en>Pppery 0 Decat tweaks per request on talk 796824 Scribunto text/plain local p = {} local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false local yesno = require("Module:Yesno") local lists = { plainlist_t = { patterns = { '^plainlist$', '%splainlist$', '^plainlist%s', '%splainlist%s' }, found = false, styles = 'Plainlist/styles.css' }, hlist_t = { patterns = { '^hlist$', '%shlist$', '^hlist%s', '%shlist%s' }, found = false, styles = 'Hlist/styles.css' } } local function has_list_class(args_to_check) for _, list in pairs(lists) do if not list.found then for _, arg in pairs(args_to_check) do for _, pattern in ipairs(list.patterns) do if mw.ustring.find(arg or '', pattern) then list.found = true break end end if list.found then break end end end end end local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = '' while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '') s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = '' for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = '' end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- [[Special:Diff/849054481]] -- remove when [[:phab:T191516]] is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end -- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', '') end end -- Returns the union of the values of two tables, as a sequence. local function union(t1, t2) local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end -- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end -- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs) if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class, args.headerclass }) root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data and not yesno(args.decat) then root:wikitext( '[[Category:Pages using infobox templates with ignored data cells]]' ) end elseif rowArgs.data and rowArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class }) local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or '') end end local function renderTitle() if not args.title then return end has_rows = true has_list_class({args.titleclass}) root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end local function renderAboveRow() if not args.above then return end has_rows = true has_list_class({ args.aboveclass }) root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end local function renderBelowRow() if not args.below then return end has_rows = true has_list_class({ args.belowclass }) root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ subheaderArgs.rowclass, subheaderArgs.class }) local row = root:tag('tr') row:addClass(subheaderArgs.rowclass) local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or '') end end local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end local function addImageRow(imageArgs) if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ imageArgs.rowclass, imageArgs.class }) local row = root:tag('tr') row:addClass(imageArgs.rowclass) local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or '') end end local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end -- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, '' ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ''):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end -- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows() local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end local function renderNavBar() if not args.name then return end has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(require('Module:Italic title')._main({})) end end -- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end -- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if yesno(args.decat) then return end if args.child == 'yes' then if args.title then root:wikitext( '[[Category:Pages using embedded infobox templates with the title parameter]]' ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext('[[Category:Articles using infobox templates with no data rows]]') end end --[=[ Loads the templatestyles for the infobox. TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar. ]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame() local hlist_templatestyles = '' if lists.hlist_t.found then hlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.hlist_t.styles } } end local plainlist_templatestyles = '' if lists.plainlist_t.found then plainlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.plainlist_t.styles } } end -- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } } local templatestyles = '' if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end local child_templatestyles = '' if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end local grandchild_templatestyles = '' if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end return table.concat({ -- hlist -> plainlist -> base is best-effort to preserve old Common.css ordering. -- this ordering is not a guarantee because the rows of interest invoking -- each class may not be on a specific page hlist_templatestyles, plainlist_templatestyles, base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles }) end -- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end -- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table') root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle) has_list_class({ args.bodyclass }) renderTitle() renderAboveRow() else root = mw.html.create() root :wikitext(args.title) end structure_infobox_common() return loadTemplateStyles() .. root end -- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= '' then args[argName] = origArgs[argName] end end -- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end -- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end -- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end -- Parse the data parameters in the same order that the old {{infobox}} did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters() preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end -- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end parseDataParameters() return _infobox() end -- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end parseDataParameters() return _infobox() end return p bb4pz1h38yoxlugokx6zs6hjugdhkwl 796825 796824 2026-06-06T02:59:06Z SM7 3953 1 revision imported from [[:en:Module:Infobox]] 796824 Scribunto text/plain local p = {} local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false local yesno = require("Module:Yesno") local lists = { plainlist_t = { patterns = { '^plainlist$', '%splainlist$', '^plainlist%s', '%splainlist%s' }, found = false, styles = 'Plainlist/styles.css' }, hlist_t = { patterns = { '^hlist$', '%shlist$', '^hlist%s', '%shlist%s' }, found = false, styles = 'Hlist/styles.css' } } local function has_list_class(args_to_check) for _, list in pairs(lists) do if not list.found then for _, arg in pairs(args_to_check) do for _, pattern in ipairs(list.patterns) do if mw.ustring.find(arg or '', pattern) then list.found = true break end end if list.found then break end end end end end local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = '' while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '') s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = '' for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = '' end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- [[Special:Diff/849054481]] -- remove when [[:phab:T191516]] is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end -- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', '') end end -- Returns the union of the values of two tables, as a sequence. local function union(t1, t2) local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end -- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end -- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs) if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class, args.headerclass }) root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data and not yesno(args.decat) then root:wikitext( '[[Category:Pages using infobox templates with ignored data cells]]' ) end elseif rowArgs.data and rowArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class }) local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or '') end end local function renderTitle() if not args.title then return end has_rows = true has_list_class({args.titleclass}) root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end local function renderAboveRow() if not args.above then return end has_rows = true has_list_class({ args.aboveclass }) root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end local function renderBelowRow() if not args.below then return end has_rows = true has_list_class({ args.belowclass }) root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ subheaderArgs.rowclass, subheaderArgs.class }) local row = root:tag('tr') row:addClass(subheaderArgs.rowclass) local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or '') end end local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end local function addImageRow(imageArgs) if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ imageArgs.rowclass, imageArgs.class }) local row = root:tag('tr') row:addClass(imageArgs.rowclass) local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or '') end end local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end -- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, '' ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ''):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end -- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows() local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end local function renderNavBar() if not args.name then return end has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(require('Module:Italic title')._main({})) end end -- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end -- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if yesno(args.decat) then return end if args.child == 'yes' then if args.title then root:wikitext( '[[Category:Pages using embedded infobox templates with the title parameter]]' ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext('[[Category:Articles using infobox templates with no data rows]]') end end --[=[ Loads the templatestyles for the infobox. TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar. ]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame() local hlist_templatestyles = '' if lists.hlist_t.found then hlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.hlist_t.styles } } end local plainlist_templatestyles = '' if lists.plainlist_t.found then plainlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.plainlist_t.styles } } end -- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } } local templatestyles = '' if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end local child_templatestyles = '' if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end local grandchild_templatestyles = '' if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end return table.concat({ -- hlist -> plainlist -> base is best-effort to preserve old Common.css ordering. -- this ordering is not a guarantee because the rows of interest invoking -- each class may not be on a specific page hlist_templatestyles, plainlist_templatestyles, base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles }) end -- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end -- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table') root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle) has_list_class({ args.bodyclass }) renderTitle() renderAboveRow() else root = mw.html.create() root :wikitext(args.title) end structure_infobox_common() return loadTemplateStyles() .. root end -- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= '' then args[argName] = origArgs[argName] end end -- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end -- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end -- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end -- Parse the data parameters in the same order that the old {{infobox}} did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters() preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end -- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end parseDataParameters() return _infobox() end -- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end parseDataParameters() return _infobox() end return p bb4pz1h38yoxlugokx6zs6hjugdhkwl राजघाट पुल 0 52585 796503 796477 2026-06-05T12:51:45Z SM7 3953 सुधार कइल गइल 796503 wikitext text/x-wiki {{Infobox bridge | name = राजघाट पुल | image = Malviya Bridge 2.JPG | image_upright = | alt = | caption = राजघाट पुल | coordinates = {{coord|25.322382|83.034582|display=inline,title}} | os_grid_reference = | carries = रेल, सड़क | crosses = [[गंगा]] | locale = [[राजघाट]], [[बनारस]] | official_name = मालवीय पुल<br>डफरिन ब्रिज (पुरान नाँव) | other_name = काशी पुल | named_for = [[मदन मोहन मालवीय]]<br>लार्ड डफरिन (पुरान नाँव) | owner = | maint = | heritage = | id = | id_type = | website = | preceded = | followed = | design = | material = | material1 = | material2 = | length = 1048.5 मीटर<ref>{{Cite web |url=http://irsme.nic.in/files/mmfiles/BRIDGES_RRB.pdf |title=Bridges: The Spectacular Feat of Indian Engineering By R.R.Bhandari |access-date=2017-12-20 |archive-date=2016-03-05 |archive-url=https://web.archive.org/web/20160305002840/http://irsme.nic.in/files/mmfiles/BRIDGES_RRB.pdf |url-status=dead }}</ref> | width = | height = | depth = | traversable = | towpath = | mainspan = | number_spans = | piers_in_water = | load = | clearance_above = | clearance_below = | lanes = | life = | num_track = | track_gauge = | structure_gauge = | electrification = | architect = | designer = | contracted_designer = | winner = | engineering = | builder = | fabricator = | begin = | complete = 1887 | cost = | open = <!-- or | opening = --> | inaugurated = | rebuilt = | collapsed = | closed = | replaces = | replaced_by = | traffic = | toll = | map_type = India Uttar Pradesh | map_relief = | map_dot_label = | map_image = | map_size = | map_alt = | map_caption = उत्तर प्रदेश में लोकेशन }} '''मदन मोहन मालवीय पुल''', जेकरा लोग '''राजघाट पुल''' के आम नाँव से जाने ला, [[उत्तर प्रदेश]] के [[बनारस]] शहर में [[गंगा नदी]] पर बनल दुतल्ला पुल बाटे जेह पर रेल आ सड़क आवागमन होला। एकर पुराना नाँव '''डफरिन ब्रिज''' हवे।<ref>{{cite web|author=Ajay Chaturvedi Publish: Aug, 05 2017 12:10:00 (IST) |url=https://www.patrika.com/varanasi-news/kashi-malviya-bridge-bad-condition-reality-news-in-hindi-1-1690671/ |title=Kashi Malviya bridge bad condition reality news in hindi सवा सौ साल पुराना काशी का धरोहर मालवीय ब्रिज जर्जर Patrika Hindi |publisher=Patrika.com |date=2017-08-05 |accessdate=2017-12-20}}</ref><ref>{{cite web|url=http://www.dnaindia.com/locality/varanasi/varanasis-malviya-bridge-shambles-39292 |title=राष्ट्रीय धरोहर मालवीय पुल हुआ जर्ज़र |language={{in lang|en}} |publisher=Dnaindia.com |date= |accessdate=2017-12-20}}</ref> 1887 में बन के पूरा भइल ई पुल ''अवध एंड रोहिलखंड रेलवे'' द्वारा बनावल गइल। ई बनारस के मुगलसराय से जोड़े ला। नगीचे मौजूद राजघाट के नांव पर आम लोग एकरा के एही नाँव से जाने ला। एकरे लगे मौजूद [[काशी रेलवे स्टेशन]] के नाँव पर एकरा के काशी पुल भी कहल जाला। एकरे ऊपरी डेक पर से सड़क गुजरे ले आ ई प्रसिद्ध [[ग्रैंड ट्रंक रोड]] (जीटी रोड) हवे जे इहाँ गंगा नदी के पार करे ला। 1948 में एकर नाँव बदल के मालवीय पुल क दिहल गइल। {{clear}} ==संदर्भ== {{Reflist|35em}} [[श्रेणी:बनारस]] {{struct-stub}} jcosh5z3lvdrjn17m5lagft833pijw9 टेम्पलेट:बनारस 10 52595 796519 534906 2026-06-05T17:18:42Z SM7 3953 सुधार कइल गइल 796519 wikitext text/x-wiki {{Navbox |name = बनारस |title =[[बनारस]] बिस्तार से |state = {{{state|autocollapse}}} |listclass = hlist |titlestyle = background:#FFC569; <!--lighter orange to ease eye-strain--> |imageleft = <!--Section 1 Start--> |group1 =[[बनारस#इतिहास|इतिहास]] |list1 = :कुछ समय बदे जान के खाली छोड़ल गइल बा <!--Section 2 Start--> |group2 = प्रशासन |list2 = {{Navbox|child |group1 = मंडल |list1 = [[वाराणसी मंडल]] |group2 = जिला |list2 = [[वाराणसी जिला]] |group3 = तहसील |list3 = [[पिंडरा]], [[बनारस सदर तहसील|सदर]] <!-- |group4 = कस्बा |list4 = [[अमरा खैरिया चक]], [[बेनीपुर]], [[भगवानपुर, बनारस|भगवानपुर]], [[बिरभानपुर]], [[दीनदासपुर]], [[गंगापुर, बनारस|गंगापुर]], [[Harpal Pur]], [[ककार्मत्ता]], [[Kandwa]], [[Kotwa]], [[Lohta]], [[Maruadih]], [[Phulwaria]], [[Ramnagar, Varanasi|Ramnagar]], [[Salarpur]], [[Shivdaspur]], [[Sir Gobardhan]], [[Susuwahi]], [[Suzabad]], [[Umarha]], [[Varanasi]], [[बनारस कैंट|कैंट]] --> }} <!--Section 3 Start--> |group3 = [[भाषा]]-बोली |list3 = :[[बंगाली भाषा|बंगाली]] :[[भोजपुरी]] :[[अंगरेजी भाषा|अंगरेजी]] :[[हिंदी भाषा|हिंदी]] :[[हिंदुस्तानी भाषा|हिंदुस्तानी]] :[[उर्दू]] <!--Section 4 Start--> <!-- ************* कमेन्ट आउट ************************** |group4 = Political<br>representation |list4 = {{Navbox|child |group1 = [[Member of Parliament, Lok Sabha|MP]] |list1 = :[[Narendra Modi]] ([[Prime Minister of India|Incumbent Prime Minister of India]]) |group2 = [[Member of the Legislative Assembly (India)|MLA]] |list2 = :[[Ajay Rai]] :[[Jyotsana Srivastava]] :[[Mahendra Singh Patel]] :[[Ravindra Jaiswal]] :[[Shyamdev Roy Chaudhari|Shyamdev Roy Chaudhari (Dada)]] :[[Surendra Singh Patel]] :[[Tribhuvan Ram]] :[[Uday Lal Maurya]] }} ************* कमेन्ट आउट अंत ************************** --> <!--Section 5 Start--> <!-- ************* कमेन्ट आउट ************************** |group5 =[[Constituency]] |list5 = {{Navbox |child |group1 = [[Lok Sabha]] |list1 = :[[Varanasi (Lok Sabha constituency)|Varanasi]] |group2 = [[Vidhan Sabha]] |list2 = :[[Ajagara (Assembly constituency)|Ajagara]] :[[Pindra (Assembly constituency)|Pindra]] :[[Rohaniya (Assembly constituency)|Rohaniya]] :[[Sevapuri (Assembly constituency)|Sevapuri]] :[[Shivpur (Assembly constituency)|Shivpur]] :[[Varanasi Cantt. (Assembly constituency)|Varanasi Cantt.]] :[[Varanasi North (Assembly constituency) |Varanasi North]] :[[Varanasi South (Assembly constituency)|Varanasi South]] }} ********************* कमेन्ट आउट अंत ******************* --> <!--Section 6 Start--> |group6 = परिवहन |list6 = {{Navbox |child |group1 = [[एवियेशन|हवाई]] |list1 = :[[लाल बहादुर शास्त्री एयरपोर्ट]] |group2 = [[रेल परिवहन|रेल]] |list2 = :{{rws|बाबतपुर}} :{{rws|भुल्लनपुर}} :{{rws|काशी}} :{{rws|मंडुआडीह}} :{{rws|बनारस कैंट}} :{{rws|वाराणसी सिटी}} :[[बनारस मेट्रो]] |group3 =सड़क |list3 = :[[जीटी रोड]] :[[नेशनल हाइवे 28 (भारत)|नेशनल हाइवे 28]] :[[नेशनल हाइवे 35 (भारत)|नेशनल हाइवे 35]] :[[राजघाट पुल]] |group4 =जल |list4 = :[[बनारस मल्टी-मोडल टर्मिनल]] }} <!--Section 7 Start--> |group7 = [[भारत में शिक्षा|शिक्षा]] |list7 = {{Navbox |child |group1 =[[विश्वविद्यालय]] |list1 = :[[बनारस हिंदू विश्वविद्यालय]] :[[तिब्बती इन्वर्सिटी]] :[[काशी विद्यापीठ|काशी बिद्यापीठ]] :[[संपूर्णानंद संस्कृत विश्वविद्यालय]] |group2 = मेडिकल कालेज |list2 = :[[आयुर्वेद संकाय, बीएचयू|आयुर्वेद संकाय]] :[[मेडिकल कालेज, बीएचयू|बीएचयू मेडिकल कालेज]] |group3 = कालेज |list3 = :[[आर्य महिला महाविद्यालय]] :[[डीएवी पीजी कालेज, बनारस|डीएवी पीजी कालेज]] <!-- :[[Faculty of Arts, Banaras Hindu University|Faculty of Arts]] --> <!-- :[[Faculty of Commerce, Banaras Hindu University|Faculty of Commerce]] --> <!-- :[[Faculty of Science, Banaras Hindu University|Faculty of Science]] --> <!-- :[[Faculty of Social Sciences, Banaras Hindu University|Faculty of Social Sciences]] --> :[[हरिश्चंद्र पीजी कालेज]] :[[महिला महाविद्यालय]] <!-- :[[School of Management Sciences, Varanasi|SMS]] --> :[[अग्रसेन कन्या पीजी कालेज]] <!-- :[[Subhash Chandra Mahavidyalaya]] --> <!-- :[[Sunbeam College for Women]] --> :[[उदय प्रताप कालेज]] :[[वसंत कन्या महाविद्यालय]] :[[वसंता कॉलेज फॉर वीमन]] |group4 = सीबीएससी बोर्ड |list4 = :[[सेंट्रल हिंदू ब्वायज इस्कूल]] :[[सेंट्रल हिंदू गर्ल्स इस्कूल]] |group5 = यूपी बोर्ड |list5 = :[[एंग्लो-बंगाली कालेज, बनारस]] |group6 = आईसीएससी |list6 = :[[सेंट जोसेफ्स कान्वेंट, बनारस|सेंट जोसेफ्स कान्वेंट]] :[[सेंट जॉन्स कान्वेंट, बनारस|सेंट जॉन्स कान्वेंट]] :[[डब्लू एच स्मिथ मेमोरियल स्कूल]] }} <!--Section 8 Start--> |group8 =पूजा स्थल |list8 = {{Navbox |child |group1 =[[बौद्ध मंदिर]] |list1 = :[[सारनाथ]] }} {{Navbox |child |group1 =चर्च |list1 = :[[सेंट मैरीज कैथेड्रल, बनारस|सेंट मैरीज चर्च]] }} {{Navbox |child |group1 =[[हिंदू मंदिर]] |list1 = {{Navbox |child |group1 =अघोरी |list1 = :[[बाबा कीनाराम स्थल]] |group2 =[[भारत माता]] |list2 = :[[भारत माता मंदिर]] |group3 =[[दुर्गा]] या उनुके [[अवतार]] |list3 = :[[दुर्गा मंदिर, बनारस|दुर्गा मंदिर]] :[[संकटा देवी मंदिर]] |group4 =[[हनुमान]] |list4 = :[[संकट मोचन]] |group5 =[[पार्वती]] या उनुके [[अवतार]] |list5 = :[[अन्नपूर्णा देवी मंदिर]] :[[ललिता गौरी मंदिर]] :[[विशालाक्षी मंदिर]] |group6 =[[शिव]] या उनके [[अवतार]] |list6 = :[[काल भैरव मंदिर, बनारस|काल भैरव मंदिर]] :[[काशी विश्वनाथ मंदिर]] :[[मृत्युंजय महादेव]] :[[नैपाली मंदिर]] :[[विश्वनाथ मंदिर|बिड़ला मंदिर, बीएचयू]] :[[तिलभांडेश्वर महादेव मंदिर]] |group7 =अन्य |list7 = :[[तुलसी मानस मंदिर]] }}}} {{Navbox |child |group2 =[[महजिद]] |list2 = :[[ज्ञानवापी महजिद]] }} {{Navbox |child |group2 =[[रबिदासी पंथ|रबिदासी]] |list2 = :[[श्री गुरु रबिदास जनम अस्थान]] }} <!--Section 9 Start--> |group9 =[[बनारस के घाट|घाट]] |list9 = :[[अस्सी घाट]] :[[दसासुमेर घाट]] :[[गंगा महल घाट]] :[[ललिता घाट]] :[[मणिकर्णिका घाट]] :[[मुंशी घाट]] :[[संत रविदास घाट]] :[[सिंधिया घाट]] :[[तुलसी घाट]] <!--Section 10 Start--> |group10 =आकर्षण |list10 = :[[अशोक स्तंभ#लिस्ट|अशोक स्तंभ]] :[[भारत कला भवन]] :[[भारत माता मंदिर]] :[[गंगा]] :[[बनारस के घाट|घाट]] :[[जंतर मंतर, बनारस|जंतर मंतर]] :[[रामनगर किला]] <!--Section 11 Start--> |group11 =[[अस्पताल]] |list11 = :[[सर सुंदरलाल अस्पताल]] <!--Section 12 Start--> <!--Data end--> }} <noinclude> {{collapsible option}} [[Category:उत्तर प्रदेश टेम्पलेट|Varanasi]] </noinclude> 61tgiccm85gyveog8f5dmwimx1bowtx 796521 796519 2026-06-05T17:20:08Z SM7 3953 सुधार कइल गइल 796521 wikitext text/x-wiki {{Navbox |name = बनारस |title =[[बनारस]] बिस्तार से |state = {{{state|autocollapse}}} |listclass = hlist |titlestyle = background:#FFC569; <!--lighter orange to ease eye-strain--> |imageleft = <!--Section 1 Start--> |group1 =[[बनारस#इतिहास|इतिहास]] |list1 = :कुछ समय बदे जान के खाली छोड़ल गइल बा <!--Section 2 Start--> |group2 = प्रशासन |list2 = {{Navbox|child |group1 = मंडल |list1 = [[वाराणसी मंडल]] |group2 = जिला |list2 = [[वाराणसी जिला]] |group3 = तहसील |list3 = [[पिंडरा]], [[बनारस सदर तहसील|सदर]] <!-- |group4 = कस्बा |list4 = [[अमरा खैरिया चक]], [[बेनीपुर]], [[भगवानपुर, बनारस|भगवानपुर]], [[बिरभानपुर]], [[दीनदासपुर]], [[गंगापुर, बनारस|गंगापुर]], [[Harpal Pur]], [[ककार्मत्ता]], [[Kandwa]], [[Kotwa]], [[Lohta]], [[Maruadih]], [[Phulwaria]], [[Ramnagar, Varanasi|Ramnagar]], [[Salarpur]], [[Shivdaspur]], [[Sir Gobardhan]], [[Susuwahi]], [[Suzabad]], [[Umarha]], [[Varanasi]], [[बनारस कैंट|कैंट]] --> }} <!--Section 3 Start--> |group3 = [[भाषा]]-बोली |list3 = :[[बंगाली भाषा|बंगाली]] :[[भोजपुरी]] :[[अंगरेजी भाषा|अंगरेजी]] :[[हिंदी भाषा|हिंदी]] :[[हिंदुस्तानी भाषा|हिंदुस्तानी]] :[[उर्दू]] <!--Section 4 Start--> <!-- ************* कमेन्ट आउट ************************** |group4 = Political<br>representation |list4 = {{Navbox|child |group1 = [[Member of Parliament, Lok Sabha|MP]] |list1 = :[[Narendra Modi]] ([[Prime Minister of India|Incumbent Prime Minister of India]]) |group2 = [[Member of the Legislative Assembly (India)|MLA]] |list2 = :[[Ajay Rai]] :[[Jyotsana Srivastava]] :[[Mahendra Singh Patel]] :[[Ravindra Jaiswal]] :[[Shyamdev Roy Chaudhari|Shyamdev Roy Chaudhari (Dada)]] :[[Surendra Singh Patel]] :[[Tribhuvan Ram]] :[[Uday Lal Maurya]] }} ************* कमेन्ट आउट अंत ************************** --> <!--Section 5 Start--> <!-- ************* कमेन्ट आउट ************************** |group5 =[[Constituency]] |list5 = {{Navbox |child |group1 = [[Lok Sabha]] |list1 = :[[Varanasi (Lok Sabha constituency)|Varanasi]] |group2 = [[Vidhan Sabha]] |list2 = :[[Ajagara (Assembly constituency)|Ajagara]] :[[Pindra (Assembly constituency)|Pindra]] :[[Rohaniya (Assembly constituency)|Rohaniya]] :[[Sevapuri (Assembly constituency)|Sevapuri]] :[[Shivpur (Assembly constituency)|Shivpur]] :[[Varanasi Cantt. (Assembly constituency)|Varanasi Cantt.]] :[[Varanasi North (Assembly constituency) |Varanasi North]] :[[Varanasi South (Assembly constituency)|Varanasi South]] }} ********************* कमेन्ट आउट अंत ******************* --> <!--Section 6 Start--> |group6 = परिवहन |list6 = {{Navbox |child |group1 = [[एवियेशन|हवाई]] |list1 = :[[लाल बहादुर शास्त्री एयरपोर्ट]] |group2 = [[रेल परिवहन|रेल]] |list2 = :{{rws|बाबतपुर}} :{{rws|भुल्लनपुर}} :{{rws|काशी}} :{{rws|बनारस}} :{{rws|बनारस कैंट}} :{{rws|वाराणसी सिटी}} :[[बनारस मेट्रो]] |group3 =सड़क |list3 = :[[जीटी रोड]] :[[नेशनल हाइवे 28 (भारत)|नेशनल हाइवे 28]] :[[नेशनल हाइवे 35 (भारत)|नेशनल हाइवे 35]] :[[राजघाट पुल]] |group4 =जल |list4 = :[[बनारस मल्टी-मोडल टर्मिनल]] }} <!--Section 7 Start--> |group7 = [[भारत में शिक्षा|शिक्षा]] |list7 = {{Navbox |child |group1 =[[विश्वविद्यालय]] |list1 = :[[बनारस हिंदू विश्वविद्यालय]] :[[तिब्बती इन्वर्सिटी]] :[[काशी विद्यापीठ|काशी बिद्यापीठ]] :[[संपूर्णानंद संस्कृत विश्वविद्यालय]] |group2 = मेडिकल कालेज |list2 = :[[आयुर्वेद संकाय, बीएचयू|आयुर्वेद संकाय]] :[[मेडिकल कालेज, बीएचयू|बीएचयू मेडिकल कालेज]] |group3 = कालेज |list3 = :[[आर्य महिला महाविद्यालय]] :[[डीएवी पीजी कालेज, बनारस|डीएवी पीजी कालेज]] <!-- :[[Faculty of Arts, Banaras Hindu University|Faculty of Arts]] --> <!-- :[[Faculty of Commerce, Banaras Hindu University|Faculty of Commerce]] --> <!-- :[[Faculty of Science, Banaras Hindu University|Faculty of Science]] --> <!-- :[[Faculty of Social Sciences, Banaras Hindu University|Faculty of Social Sciences]] --> :[[हरिश्चंद्र पीजी कालेज]] :[[महिला महाविद्यालय]] <!-- :[[School of Management Sciences, Varanasi|SMS]] --> :[[अग्रसेन कन्या पीजी कालेज]] <!-- :[[Subhash Chandra Mahavidyalaya]] --> <!-- :[[Sunbeam College for Women]] --> :[[उदय प्रताप कालेज]] :[[वसंत कन्या महाविद्यालय]] :[[वसंता कॉलेज फॉर वीमन]] |group4 = सीबीएससी बोर्ड |list4 = :[[सेंट्रल हिंदू ब्वायज इस्कूल]] :[[सेंट्रल हिंदू गर्ल्स इस्कूल]] |group5 = यूपी बोर्ड |list5 = :[[एंग्लो-बंगाली कालेज, बनारस]] |group6 = आईसीएससी |list6 = :[[सेंट जोसेफ्स कान्वेंट, बनारस|सेंट जोसेफ्स कान्वेंट]] :[[सेंट जॉन्स कान्वेंट, बनारस|सेंट जॉन्स कान्वेंट]] :[[डब्लू एच स्मिथ मेमोरियल स्कूल]] }} <!--Section 8 Start--> |group8 =पूजा स्थल |list8 = {{Navbox |child |group1 =[[बौद्ध मंदिर]] |list1 = :[[सारनाथ]] }} {{Navbox |child |group1 =चर्च |list1 = :[[सेंट मैरीज कैथेड्रल, बनारस|सेंट मैरीज चर्च]] }} {{Navbox |child |group1 =[[हिंदू मंदिर]] |list1 = {{Navbox |child |group1 =अघोरी |list1 = :[[बाबा कीनाराम स्थल]] |group2 =[[भारत माता]] |list2 = :[[भारत माता मंदिर]] |group3 =[[दुर्गा]] या उनुके [[अवतार]] |list3 = :[[दुर्गा मंदिर, बनारस|दुर्गा मंदिर]] :[[संकटा देवी मंदिर]] |group4 =[[हनुमान]] |list4 = :[[संकट मोचन]] |group5 =[[पार्वती]] या उनुके [[अवतार]] |list5 = :[[अन्नपूर्णा देवी मंदिर]] :[[ललिता गौरी मंदिर]] :[[विशालाक्षी मंदिर]] |group6 =[[शिव]] या उनके [[अवतार]] |list6 = :[[काल भैरव मंदिर, बनारस|काल भैरव मंदिर]] :[[काशी विश्वनाथ मंदिर]] :[[मृत्युंजय महादेव]] :[[नैपाली मंदिर]] :[[विश्वनाथ मंदिर|बिड़ला मंदिर, बीएचयू]] :[[तिलभांडेश्वर महादेव मंदिर]] |group7 =अन्य |list7 = :[[तुलसी मानस मंदिर]] }}}} {{Navbox |child |group2 =[[महजिद]] |list2 = :[[ज्ञानवापी महजिद]] }} {{Navbox |child |group2 =[[रबिदासी पंथ|रबिदासी]] |list2 = :[[श्री गुरु रबिदास जनम अस्थान]] }} <!--Section 9 Start--> |group9 =[[बनारस के घाट|घाट]] |list9 = :[[अस्सी घाट]] :[[दसासुमेर घाट]] :[[गंगा महल घाट]] :[[ललिता घाट]] :[[मणिकर्णिका घाट]] :[[मुंशी घाट]] :[[संत रविदास घाट]] :[[सिंधिया घाट]] :[[तुलसी घाट]] <!--Section 10 Start--> |group10 =आकर्षण |list10 = :[[अशोक स्तंभ#लिस्ट|अशोक स्तंभ]] :[[भारत कला भवन]] :[[भारत माता मंदिर]] :[[गंगा]] :[[बनारस के घाट|घाट]] :[[जंतर मंतर, बनारस|जंतर मंतर]] :[[रामनगर किला]] <!--Section 11 Start--> |group11 =[[अस्पताल]] |list11 = :[[सर सुंदरलाल अस्पताल]] <!--Section 12 Start--> <!--Data end--> }} <noinclude> {{collapsible option}} [[Category:उत्तर प्रदेश टेम्पलेट|Varanasi]] </noinclude> kofb11q5nxtafyepe52stuxv639y57x Module:Infobox mapframe 828 61762 796828 678397 2025-11-24T04:39:55Z en>Hike395 0 rm controversial warning message 796828 Scribunto text/plain local mf = require('Module:Mapframe') local getArgs = require('Module:Arguments').getArgs local yesno = require('Module:Yesno') local infoboxImage = require('Module:InfoboxImage').InfoboxImage -- Defaults local DEFAULT_FRAME_WIDTH = "270" local DEFAULT_FRAME_HEIGHT = "200" local DEFAULT_ZOOM = 10 local DEFAULT_GEOMASK_STROKE_WIDTH = "1" local DEFAULT_GEOMASK_STROKE_COLOR = "#777777" local DEFAULT_GEOMASK_FILL = "#888888" local DEFAULT_GEOMASK_FILL_OPACITY = "0.25" local DEFAULT_SHAPE_STROKE_WIDTH = "2" local DEFAULT_SHAPE_STROKE_COLOR = "#FF0000" local DEFAULT_SHAPE_FILL = "#606060" local DEFAULT_SHAPE_FILL_OPACITY = "0.1" local DEFAULT_LINE_STROKE_WIDTH = "5" local DEFAULT_LINE_STROKE_COLOR = "#FF0000" local DEFAULT_MARKER_COLOR = "#5E74F3" local util = {} function util.noop(info) local DEFAULT_NOOP_OUTPUT = "" -- uncomment this when debugging -- DEFAULT_NOOP_OUTPUT = "debug: mapframe no-op: " .. info -- mw.log(DEFAULT_NOOP_OUTPUT) return DEFAULT_NOOP_OUTPUT end -- Trim whitespace from args, and remove empty args function util.trimArgs(argsTable) local cleanArgs = {} for key, val in pairs(argsTable) do if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val ~= '' then cleanArgs[key] = val end else cleanArgs[key] = val end end return cleanArgs end function util.getBestStatement(item_id, property_id) if not(item_id) or not(mw.wikibase.isValidEntityId(item_id)) or not(mw.wikibase.entityExists(item_id)) then return false end local statements = mw.wikibase.getBestStatements(item_id, property_id) if not statements or #statements == 0 then return false end local hasNoValue = ( statements[1].mainsnak and statements[1].mainsnak.snaktype == 'novalue' ) if hasNoValue then return false end return statements[1] end function util.hasWikidataProperty(item_id, property_id) return util.getBestStatement(item_id, property_id) and true or false end function util.getStatementValue(statement) return statement and statement.mainsnak and statement.mainsnak.datavalue and statement.mainsnak.datavalue.value or nil end function util.relatedEntity(item_id, property_id) local value = util.getStatementValue( util.getBestStatement(item_id, property_id) ) return value and value.id or false end function util.idType(id) if not id then return nil elseif mw.ustring.match(id, "[Pp]%d+") then return "property" elseif mw.ustring.match(id, "[Qq]%d+") then return "item" else return nil end end function util.shouldAutoRun(frame) -- Check if should be running local pargs = frame.getParent(frame).args local explicitlyOn = yesno(mw.text.trim(pargs.mapframe or "")) -- true of false or nil if pargs.coordinates == "&#123;&#123;&#123;coordinates&#125;&#125;&#125;" then explicitlyOn = false end local onByDefault = (explicitlyOn == nil) and yesno(mw.text.trim(frame.args.onByDefault or ""), false) -- true or false return explicitlyOn or onByDefault end function util.argsFromAuto(frame) -- Get args from the frame (invoke call) and the parent (template call). -- Frame arguments are default values which are overridden by parent values -- when both are present local args = getArgs(frame, {parentFirst = true}) -- Discard args not prefixed with "mapframe-", remove that prefix from those that remain local fixedArgs = {} for name, val in pairs(args) do local fixedName = string.match(name, "^mapframe%-(.+)$" ) if fixedName then fixedArgs[fixedName] = val -- allow coord, coordinates, etc to be unprefixed elseif name == "coordinates" or name == "coord" or name == "coordinate" and not fixedArgs.coord then fixedArgs.coord = val -- allow id, qid to be unprefixed, map to id (if not already present) elseif name == "id" or name == "qid" and not fixedArgs.id then fixedArgs.id = val -- allow captionstyle to be unprefixed, for compatibility with [[Module:Infobox]] elseif name == "captionstyle" and not fixedArgs.captionstyle then fixedArgs.captionstyle = val end end return fixedArgs end function util.parseCustomWikitext(customWikitext) -- infoboxImage will format an image if given wikitext containing an -- image, or else pass through the wikitext unmodified return infoboxImage({ args = { image = customWikitext } }) end function util.trackAndWarn(trackingCat, warning) local title = mw.title.getCurrentTitle() local results = title and title.namespace == 0 and trackingCat and '[[Category:'..trackingCat..']]' or '' if warning then local warn = require('Module:If preview')._warning results = results..warn({warning}) end return results end function util.ternary(flag, other) other = other or 'other' flag = flag == 'none' and 'no' or flag local yesNoOut = yesno(flag,other) local yes = (yesNoOut == true) local no = (yesNoOut == false) return yes, no end local p = {} p._caption = function(args) if args.caption then return args.caption elseif args.switcher then return util.noop("no caption or switcher") end local maskItem local maskType = util.idType(args.geomask) if maskType == 'item' then maskItem = args.geomask elseif maskType == "property" then maskItem = util.relatedEntity(args.id or mw.wikibase.getEntityIdForCurrentPage(), args.geomask) end local maskItemLabel = maskItem and mw.wikibase.getLabel( maskItem ) return maskItemLabel and "Location in "..maskItemLabel or util.noop("missing maskItemLabel with type " .. (maskType or "nil") .. " and item " .. (maskItem or "nil")) end --A list of types for objects that are too small to allow Kartographer to take over zoom local tinyType = { landmark=true, railwaystation=true, edu=true, pass=true, camera=true } p._main = function(_config) -- accumulate tracking cats local tracking = '' -- `config` is the args passed to this module local config = util.trimArgs(_config) -- allow alias for config.coord config.coord = config.coord or config.coordinates -- Require wikidata item, or specified coords local wikidataId = config.id or mw.wikibase.getEntityIdForCurrentPage() if not(wikidataId) and not(config.coord) then return false, util.trackAndWarn('Pages using infobox mapframe with missing coordinates') end -- Require coords (specified or from wikidata), so that map will be centred somewhere -- (P625 = coordinate location) local wdCoordinates = util.getStatementValue(util.getBestStatement(wikidataId, 'P625')) if not (config.coord or wdCoordinates) then return false, util.trackAndWarn('Pages using infobox mapframe with missing coordinates') end -- `args` is the arguments which will be passed to the mapframe module local args = {} -- Some defaults/overrides for infobox presentation args.display = "inline" args.frame = "yes" args.plain = "yes" args["frame-width"] = config["frame-width"] or config.width or DEFAULT_FRAME_WIDTH args["frame-height"] = config["frame-height"] or config.height or DEFAULT_FRAME_HEIGHT args["frame-align"] = "center" args["frame-coord"] = config["frame-coordinates"] or config["frame-coord"] -- Note: config["coordinates"] or config["coord"] should not be used for the alignment of the frame; -- see talk page ( https://en.wikipedia.org/wiki/Special:Diff/876492931 ) -- deprecated lat and long parameters args["frame-lat"] = config["frame-lat"] or config["frame-latitude"] args["frame-long"] = config["frame-long"] or config["frame-longitude"] -- if zoom isn't specified from config, first check wikidata local zoom = config.zoom or util.getStatementValue(util.getBestStatement(wikidataId, 'P6592')) if not zoom then -- Calculate zoom from length or area (converted to km or km2) -- Zoom so that length or area is completely included in mapframe local getZoom = require('Module:Infobox dim')._zoom zoom = getZoom({length_km=config.length_km, length_mi=config.length_mi, width_km=config.width_km, width_mi=config.width_mi, area_km2=config.area_km2, area_mi2=config.area_mi2, area_ha=config.area_ha, area_acre=config.area_acre, type=config.type, population=config.population, viewport_px=math.min(args["frame-width"],args["frame-height"]), latitude=wdCoordinates and wdCoordinates.latitude}) end args.zoom = zoom or DEFAULT_ZOOM -- Use OSM relation ID if available; otherwise use geoshape if that is available -- (geoshape is required for defunct entities, which are outside OSM's scope) local hasOsmRelationId = util.hasWikidataProperty(wikidataId, 'P402') -- P402 is OSM relation ID local hasGeoshape = util.hasWikidataProperty(wikidataId, 'P3896') -- P3896 is geoshape local wikidataProvidesGeo = hasOsmRelationId or hasGeoshape -- determine marker argument value, determine whether to show marker local forcePoint, suppressPoint = util.ternary(config.point) local forceMarker, suppressMarker = util.ternary(config.marker,true) forcePoint = forcePoint or forceMarker suppressPoint = suppressPoint or suppressMarker local showMarker = not suppressPoint and (forcePoint or not wikidataProvidesGeo or config.coord) -- wikidata = "yes" turns on both shape and line -- wikidata = "no" turns off both shape and line -- otherwise show both if wikidata provides geo local forceWikidata, suppressWikidata = util.ternary(config.wikidata) local showShape = not suppressWikidata and (forceWikidata or wikidataProvidesGeo or not config.coord) local showLine = showShape -- determine shape parameter value, determine whether to show or suppress shape -- also determine whether to invert shape local forceShape, suppressShape = util.ternary(config.shape) showShape = wikidataId and not suppressShape and (forceShape or showShape) local shapeType = config.shape == 'inverse' and 'shape-inverse' or 'shape' -- determine line parameter value, determine whether to show or suppress line local forceLine, suppressLine = util.ternary(config.line) showLine = wikidataId and not suppressLine and (forceLine or showLine) local maskItem -- Switcher if config.switcher == "zooms" then -- switching between zoom levels local maxZoom = math.max(tonumber(args.zoom), 3) -- what zoom would have otherwise been (if 3 or more, otherwise 3) local minZoom = 1 -- completely zoomed out local midZoom = math.floor((maxZoom + minZoom)/2) -- midway between maxn and min args.switch = "zoomed in, zoomed midway, zoomed out" args.zoom = string.format("SWITCH:%d,%d,%d", maxZoom, midZoom, minZoom) elseif config.switcher == "auto" then -- switching between P276 and P131 areas with recursive lookup, e.g. item's city, -- that city's state, and that state's country args.zoom = nil -- let kartographer determine the zoom local maskLabels = {} local maskItems = {} local maskItemId = util.relatedEntity(wikidataId, "P276") or util.relatedEntity(wikidataId, "P131") local maskLabel = mw.wikibase.getLabel(maskItemId) while maskItemId and maskLabel and mw.text.trim(maskLabel) ~= "" do table.insert(maskLabels, maskLabel) table.insert(maskItems, maskItemId) maskItemId = maskItemId and util.relatedEntity(maskItemId, "P131") maskLabel = maskItemId and mw.wikibase.getLabel(maskItemId) end if #maskLabels > 1 then args.switch = table.concat(maskLabels, "###") maskItem = "SWITCH:" .. table.concat(maskItems, ",") elseif #maskLabels == 1 then maskItem = maskItemId[1] end elseif config.switcher == "geomasks" and config.geomask then -- switching between items in geomask parameter args.zoom = nil -- let kartographer determine the zoom local separator = (mw.ustring.find(config.geomask, "###", 0, true ) and "###") or (mw.ustring.find(config.geomask, ";", 0, true ) and ";") or "," local pattern = "%s*"..separator.."%s*" local maskItems = mw.text.split(mw.ustring.gsub(config.geomask, "SWITCH:", ""), pattern) local maskLabels = {} if #maskItems > 1 then for i, item in ipairs(maskItems) do table.insert(maskLabels, mw.wikibase.getLabel(item)) end args.switch = table.concat(maskLabels, "###") maskItem = "SWITCH:" .. table.concat(maskItems, ",") end end -- resolve geomask item id (if not using geomask switcher) if not maskItem then -- local maskType = util.idType(config.geomask) if maskType == 'item' then maskItem = config.geomask elseif maskType == "property" then maskItem = util.relatedEntity(wikidataId, config.geomask) end end -- if asking for shape or line from Wikidata -- and if Wikidata actually has shape/line data (wikidataProvidesGeo=true) -- and if no geomask -- and if zoom not explicitly set -- and if the object size inferred from its type is not too small -- then let Kartographer "take over" zoom if (showLine or showShape) and wikidataProvidesGeo and not maskItem and not config.zoom and not (config.type and tinyType[config.type]) then args.zoom = nil end if not maskItem and not showShape and not showLine and not showMarker then return false, util.trackAndWarn('Pages using infobox mapframe with no geometry','No geometry specified for mapframe') end -- Keep track of arg numbering local argNumber = '' local function incrementArgNumber() if argNumber == '' then argNumber = 2 else argNumber = argNumber + 1 end end -- Geomask if maskItem then args["type"..argNumber] = "shape-inverse" args["id"..argNumber] = maskItem args["stroke-width"..argNumber] = config["geomask-stroke-width"] or DEFAULT_GEOMASK_STROKE_WIDTH args["stroke-color"..argNumber] = config["geomask-stroke-color"] or config["geomask-stroke-colour"] or DEFAULT_GEOMASK_STROKE_COLOR args["fill"..argNumber] = config["geomask-fill"] or DEFAULT_GEOMASK_FILL args["fill-opacity"..argNumber] = config["geomask-fill-opacity"] or DEFAULT_SHAPE_FILL_OPACITY -- Let kartographer determine zoom and position, unless it is explicitly set in config if not config.zoom and not config.switcher then args.zoom = nil args["frame-coord"] = nil args["frame-lat"] = nil args["frame-long"] = nil local maskArea = util.getStatementValue( util.getBestStatement(maskItem, 'P2046') ) end incrementArgNumber() -- Hack to fix phab:T255932 if not args.zoom then args["type"..argNumber] = "line" args["id"..argNumber] = maskItem args["stroke-width"..argNumber] = 0 incrementArgNumber() end end -- Shape (or shape-inverse) if showShape then args["type"..argNumber] = shapeType if hasGeoshape and not hasOsmRelationId then args["from"..argNumber] = string.sub( util.getStatementValue( util.getBestStatement(wikidataId, 'P3896') ), 6) elseif config.id then args["id"..argNumber] = config.id end args["stroke-width"..argNumber] = config["shape-stroke-width"] or config["stroke-width"] or DEFAULT_SHAPE_STROKE_WIDTH args["stroke-color"..argNumber] = config["shape-stroke-color"] or config["shape-stroke-colour"] or config["stroke-color"] or config["stroke-colour"] or DEFAULT_SHAPE_STROKE_COLOR args["fill"..argNumber] = config["shape-fill"] or DEFAULT_SHAPE_FILL args["fill-opacity"..argNumber] = config["shape-fill-opacity"] or DEFAULT_SHAPE_FILL_OPACITY incrementArgNumber() end -- Line if showLine then args["type"..argNumber] = "line" if hasGeoshape and not hasOsmRelationId then args["from"..argNumber] = string.sub( util.getStatementValue( util.getBestStatement(wikidataId, 'P3896') ), 6) elseif config.id then args["id"..argNumber] = config.id end args["stroke-width"..argNumber] = config["line-stroke-width"] or config["stroke-width"] or DEFAULT_LINE_STROKE_WIDTH args["stroke-color"..argNumber] = config["line-stroke-color"] or config["line-stroke-colour"] or config["stroke-color"] or config["stroke-colour"] or DEFAULT_LINE_STROKE_COLOR incrementArgNumber() end -- Point marker if showMarker then args["type"..argNumber] = "point" if config.id then args["id"..argNumber] = config.id end if config.coord then args["coord"..argNumber] = config.coord end if config.marker then args["marker"..argNumber] = config.marker end args["marker-color"..argNumber] = config["marker-color"] or config["marker-colour"] or DEFAULT_MARKER_COLOR incrementArgNumber() end -- if Wikidata doesn't link to OSM and the map has no mask or point, -- then center the map on the coordinates either from the infobox or from wikidata if not maskItem and not showMarker and not wikidataProvidesGeo then if config.coord then args["frame-coord"] = args["frame-coord"] or config.coord else args["frame-lat"] = args["frame-lat"] or wdCoordinates.latitude args["frame-long"] = args["frame-long"] or wdCoordinates.longitude end tracking = tracking..util.trackAndWarn('Pages using infobox mapframe with forced centering') end -- protect against nil frame arguments args["frame-coord"] = args["frame-coord"] or "" args["frame-lat"] = args["frame-lat"] or "" args["frame-long"] = args["frame-long"] or "" local mapframe = args.switch and mf.multi(args) or mf._main(args) tracking = tracking..((showLine or showShape) and not wikidataProvidesGeo and util.trackAndWarn('Pages using infobox mapframe without shape links in Wikidata') or '') return true, mapframe.. tracking end -- Entry points p.main = function(frame) local parent = frame.getParent(frame) local parentArgs = parent.args local _, mapframe = p._main(parentArgs) return frame:preprocess(mapframe) end p.auto = function(frame) if not util.shouldAutoRun(frame) then return util.noop("auto should not autorun") end local args = util.argsFromAuto(frame) if args.custom then return frame:preprocess(util.parseCustomWikitext(args.custom)) end local _, mapframe = p._main(args) return frame:preprocess(mapframe) end p.autocaption = function(frame) if not util.shouldAutoRun(frame) then return util.noop("autocaption should not autorun") end local args = util.argsFromAuto(frame) local caption = p._caption(args) return caption end p.autoWithCaption = function(frame) if not util.shouldAutoRun(frame) then return util.noop("autoWithCaption should not autorun") end local args = util.argsFromAuto(frame) local wikitext local caption local ok if args.custom then ok = true wikitext = util.parseCustomWikitext(args.custom) else ok, wikitext = p._main(args) end if not ok then return wikitext end wikitext = frame:preprocess(wikitext) caption = p._caption(args) local data = mw.html.create():wikitext(wikitext) data:tag('div') :addClass('infobox-caption') :cssText(args.captionstyle) :wikitext(caption) return tostring(data) end return p 106wy7cnyb31y4vmayxbfey5ym8wtux 796829 796828 2026-06-06T03:03:11Z SM7 3953 1 revision imported from [[:en:Module:Infobox_mapframe]] 796828 Scribunto text/plain local mf = require('Module:Mapframe') local getArgs = require('Module:Arguments').getArgs local yesno = require('Module:Yesno') local infoboxImage = require('Module:InfoboxImage').InfoboxImage -- Defaults local DEFAULT_FRAME_WIDTH = "270" local DEFAULT_FRAME_HEIGHT = "200" local DEFAULT_ZOOM = 10 local DEFAULT_GEOMASK_STROKE_WIDTH = "1" local DEFAULT_GEOMASK_STROKE_COLOR = "#777777" local DEFAULT_GEOMASK_FILL = "#888888" local DEFAULT_GEOMASK_FILL_OPACITY = "0.25" local DEFAULT_SHAPE_STROKE_WIDTH = "2" local DEFAULT_SHAPE_STROKE_COLOR = "#FF0000" local DEFAULT_SHAPE_FILL = "#606060" local DEFAULT_SHAPE_FILL_OPACITY = "0.1" local DEFAULT_LINE_STROKE_WIDTH = "5" local DEFAULT_LINE_STROKE_COLOR = "#FF0000" local DEFAULT_MARKER_COLOR = "#5E74F3" local util = {} function util.noop(info) local DEFAULT_NOOP_OUTPUT = "" -- uncomment this when debugging -- DEFAULT_NOOP_OUTPUT = "debug: mapframe no-op: " .. info -- mw.log(DEFAULT_NOOP_OUTPUT) return DEFAULT_NOOP_OUTPUT end -- Trim whitespace from args, and remove empty args function util.trimArgs(argsTable) local cleanArgs = {} for key, val in pairs(argsTable) do if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val ~= '' then cleanArgs[key] = val end else cleanArgs[key] = val end end return cleanArgs end function util.getBestStatement(item_id, property_id) if not(item_id) or not(mw.wikibase.isValidEntityId(item_id)) or not(mw.wikibase.entityExists(item_id)) then return false end local statements = mw.wikibase.getBestStatements(item_id, property_id) if not statements or #statements == 0 then return false end local hasNoValue = ( statements[1].mainsnak and statements[1].mainsnak.snaktype == 'novalue' ) if hasNoValue then return false end return statements[1] end function util.hasWikidataProperty(item_id, property_id) return util.getBestStatement(item_id, property_id) and true or false end function util.getStatementValue(statement) return statement and statement.mainsnak and statement.mainsnak.datavalue and statement.mainsnak.datavalue.value or nil end function util.relatedEntity(item_id, property_id) local value = util.getStatementValue( util.getBestStatement(item_id, property_id) ) return value and value.id or false end function util.idType(id) if not id then return nil elseif mw.ustring.match(id, "[Pp]%d+") then return "property" elseif mw.ustring.match(id, "[Qq]%d+") then return "item" else return nil end end function util.shouldAutoRun(frame) -- Check if should be running local pargs = frame.getParent(frame).args local explicitlyOn = yesno(mw.text.trim(pargs.mapframe or "")) -- true of false or nil if pargs.coordinates == "&#123;&#123;&#123;coordinates&#125;&#125;&#125;" then explicitlyOn = false end local onByDefault = (explicitlyOn == nil) and yesno(mw.text.trim(frame.args.onByDefault or ""), false) -- true or false return explicitlyOn or onByDefault end function util.argsFromAuto(frame) -- Get args from the frame (invoke call) and the parent (template call). -- Frame arguments are default values which are overridden by parent values -- when both are present local args = getArgs(frame, {parentFirst = true}) -- Discard args not prefixed with "mapframe-", remove that prefix from those that remain local fixedArgs = {} for name, val in pairs(args) do local fixedName = string.match(name, "^mapframe%-(.+)$" ) if fixedName then fixedArgs[fixedName] = val -- allow coord, coordinates, etc to be unprefixed elseif name == "coordinates" or name == "coord" or name == "coordinate" and not fixedArgs.coord then fixedArgs.coord = val -- allow id, qid to be unprefixed, map to id (if not already present) elseif name == "id" or name == "qid" and not fixedArgs.id then fixedArgs.id = val -- allow captionstyle to be unprefixed, for compatibility with [[Module:Infobox]] elseif name == "captionstyle" and not fixedArgs.captionstyle then fixedArgs.captionstyle = val end end return fixedArgs end function util.parseCustomWikitext(customWikitext) -- infoboxImage will format an image if given wikitext containing an -- image, or else pass through the wikitext unmodified return infoboxImage({ args = { image = customWikitext } }) end function util.trackAndWarn(trackingCat, warning) local title = mw.title.getCurrentTitle() local results = title and title.namespace == 0 and trackingCat and '[[Category:'..trackingCat..']]' or '' if warning then local warn = require('Module:If preview')._warning results = results..warn({warning}) end return results end function util.ternary(flag, other) other = other or 'other' flag = flag == 'none' and 'no' or flag local yesNoOut = yesno(flag,other) local yes = (yesNoOut == true) local no = (yesNoOut == false) return yes, no end local p = {} p._caption = function(args) if args.caption then return args.caption elseif args.switcher then return util.noop("no caption or switcher") end local maskItem local maskType = util.idType(args.geomask) if maskType == 'item' then maskItem = args.geomask elseif maskType == "property" then maskItem = util.relatedEntity(args.id or mw.wikibase.getEntityIdForCurrentPage(), args.geomask) end local maskItemLabel = maskItem and mw.wikibase.getLabel( maskItem ) return maskItemLabel and "Location in "..maskItemLabel or util.noop("missing maskItemLabel with type " .. (maskType or "nil") .. " and item " .. (maskItem or "nil")) end --A list of types for objects that are too small to allow Kartographer to take over zoom local tinyType = { landmark=true, railwaystation=true, edu=true, pass=true, camera=true } p._main = function(_config) -- accumulate tracking cats local tracking = '' -- `config` is the args passed to this module local config = util.trimArgs(_config) -- allow alias for config.coord config.coord = config.coord or config.coordinates -- Require wikidata item, or specified coords local wikidataId = config.id or mw.wikibase.getEntityIdForCurrentPage() if not(wikidataId) and not(config.coord) then return false, util.trackAndWarn('Pages using infobox mapframe with missing coordinates') end -- Require coords (specified or from wikidata), so that map will be centred somewhere -- (P625 = coordinate location) local wdCoordinates = util.getStatementValue(util.getBestStatement(wikidataId, 'P625')) if not (config.coord or wdCoordinates) then return false, util.trackAndWarn('Pages using infobox mapframe with missing coordinates') end -- `args` is the arguments which will be passed to the mapframe module local args = {} -- Some defaults/overrides for infobox presentation args.display = "inline" args.frame = "yes" args.plain = "yes" args["frame-width"] = config["frame-width"] or config.width or DEFAULT_FRAME_WIDTH args["frame-height"] = config["frame-height"] or config.height or DEFAULT_FRAME_HEIGHT args["frame-align"] = "center" args["frame-coord"] = config["frame-coordinates"] or config["frame-coord"] -- Note: config["coordinates"] or config["coord"] should not be used for the alignment of the frame; -- see talk page ( https://en.wikipedia.org/wiki/Special:Diff/876492931 ) -- deprecated lat and long parameters args["frame-lat"] = config["frame-lat"] or config["frame-latitude"] args["frame-long"] = config["frame-long"] or config["frame-longitude"] -- if zoom isn't specified from config, first check wikidata local zoom = config.zoom or util.getStatementValue(util.getBestStatement(wikidataId, 'P6592')) if not zoom then -- Calculate zoom from length or area (converted to km or km2) -- Zoom so that length or area is completely included in mapframe local getZoom = require('Module:Infobox dim')._zoom zoom = getZoom({length_km=config.length_km, length_mi=config.length_mi, width_km=config.width_km, width_mi=config.width_mi, area_km2=config.area_km2, area_mi2=config.area_mi2, area_ha=config.area_ha, area_acre=config.area_acre, type=config.type, population=config.population, viewport_px=math.min(args["frame-width"],args["frame-height"]), latitude=wdCoordinates and wdCoordinates.latitude}) end args.zoom = zoom or DEFAULT_ZOOM -- Use OSM relation ID if available; otherwise use geoshape if that is available -- (geoshape is required for defunct entities, which are outside OSM's scope) local hasOsmRelationId = util.hasWikidataProperty(wikidataId, 'P402') -- P402 is OSM relation ID local hasGeoshape = util.hasWikidataProperty(wikidataId, 'P3896') -- P3896 is geoshape local wikidataProvidesGeo = hasOsmRelationId or hasGeoshape -- determine marker argument value, determine whether to show marker local forcePoint, suppressPoint = util.ternary(config.point) local forceMarker, suppressMarker = util.ternary(config.marker,true) forcePoint = forcePoint or forceMarker suppressPoint = suppressPoint or suppressMarker local showMarker = not suppressPoint and (forcePoint or not wikidataProvidesGeo or config.coord) -- wikidata = "yes" turns on both shape and line -- wikidata = "no" turns off both shape and line -- otherwise show both if wikidata provides geo local forceWikidata, suppressWikidata = util.ternary(config.wikidata) local showShape = not suppressWikidata and (forceWikidata or wikidataProvidesGeo or not config.coord) local showLine = showShape -- determine shape parameter value, determine whether to show or suppress shape -- also determine whether to invert shape local forceShape, suppressShape = util.ternary(config.shape) showShape = wikidataId and not suppressShape and (forceShape or showShape) local shapeType = config.shape == 'inverse' and 'shape-inverse' or 'shape' -- determine line parameter value, determine whether to show or suppress line local forceLine, suppressLine = util.ternary(config.line) showLine = wikidataId and not suppressLine and (forceLine or showLine) local maskItem -- Switcher if config.switcher == "zooms" then -- switching between zoom levels local maxZoom = math.max(tonumber(args.zoom), 3) -- what zoom would have otherwise been (if 3 or more, otherwise 3) local minZoom = 1 -- completely zoomed out local midZoom = math.floor((maxZoom + minZoom)/2) -- midway between maxn and min args.switch = "zoomed in, zoomed midway, zoomed out" args.zoom = string.format("SWITCH:%d,%d,%d", maxZoom, midZoom, minZoom) elseif config.switcher == "auto" then -- switching between P276 and P131 areas with recursive lookup, e.g. item's city, -- that city's state, and that state's country args.zoom = nil -- let kartographer determine the zoom local maskLabels = {} local maskItems = {} local maskItemId = util.relatedEntity(wikidataId, "P276") or util.relatedEntity(wikidataId, "P131") local maskLabel = mw.wikibase.getLabel(maskItemId) while maskItemId and maskLabel and mw.text.trim(maskLabel) ~= "" do table.insert(maskLabels, maskLabel) table.insert(maskItems, maskItemId) maskItemId = maskItemId and util.relatedEntity(maskItemId, "P131") maskLabel = maskItemId and mw.wikibase.getLabel(maskItemId) end if #maskLabels > 1 then args.switch = table.concat(maskLabels, "###") maskItem = "SWITCH:" .. table.concat(maskItems, ",") elseif #maskLabels == 1 then maskItem = maskItemId[1] end elseif config.switcher == "geomasks" and config.geomask then -- switching between items in geomask parameter args.zoom = nil -- let kartographer determine the zoom local separator = (mw.ustring.find(config.geomask, "###", 0, true ) and "###") or (mw.ustring.find(config.geomask, ";", 0, true ) and ";") or "," local pattern = "%s*"..separator.."%s*" local maskItems = mw.text.split(mw.ustring.gsub(config.geomask, "SWITCH:", ""), pattern) local maskLabels = {} if #maskItems > 1 then for i, item in ipairs(maskItems) do table.insert(maskLabels, mw.wikibase.getLabel(item)) end args.switch = table.concat(maskLabels, "###") maskItem = "SWITCH:" .. table.concat(maskItems, ",") end end -- resolve geomask item id (if not using geomask switcher) if not maskItem then -- local maskType = util.idType(config.geomask) if maskType == 'item' then maskItem = config.geomask elseif maskType == "property" then maskItem = util.relatedEntity(wikidataId, config.geomask) end end -- if asking for shape or line from Wikidata -- and if Wikidata actually has shape/line data (wikidataProvidesGeo=true) -- and if no geomask -- and if zoom not explicitly set -- and if the object size inferred from its type is not too small -- then let Kartographer "take over" zoom if (showLine or showShape) and wikidataProvidesGeo and not maskItem and not config.zoom and not (config.type and tinyType[config.type]) then args.zoom = nil end if not maskItem and not showShape and not showLine and not showMarker then return false, util.trackAndWarn('Pages using infobox mapframe with no geometry','No geometry specified for mapframe') end -- Keep track of arg numbering local argNumber = '' local function incrementArgNumber() if argNumber == '' then argNumber = 2 else argNumber = argNumber + 1 end end -- Geomask if maskItem then args["type"..argNumber] = "shape-inverse" args["id"..argNumber] = maskItem args["stroke-width"..argNumber] = config["geomask-stroke-width"] or DEFAULT_GEOMASK_STROKE_WIDTH args["stroke-color"..argNumber] = config["geomask-stroke-color"] or config["geomask-stroke-colour"] or DEFAULT_GEOMASK_STROKE_COLOR args["fill"..argNumber] = config["geomask-fill"] or DEFAULT_GEOMASK_FILL args["fill-opacity"..argNumber] = config["geomask-fill-opacity"] or DEFAULT_SHAPE_FILL_OPACITY -- Let kartographer determine zoom and position, unless it is explicitly set in config if not config.zoom and not config.switcher then args.zoom = nil args["frame-coord"] = nil args["frame-lat"] = nil args["frame-long"] = nil local maskArea = util.getStatementValue( util.getBestStatement(maskItem, 'P2046') ) end incrementArgNumber() -- Hack to fix phab:T255932 if not args.zoom then args["type"..argNumber] = "line" args["id"..argNumber] = maskItem args["stroke-width"..argNumber] = 0 incrementArgNumber() end end -- Shape (or shape-inverse) if showShape then args["type"..argNumber] = shapeType if hasGeoshape and not hasOsmRelationId then args["from"..argNumber] = string.sub( util.getStatementValue( util.getBestStatement(wikidataId, 'P3896') ), 6) elseif config.id then args["id"..argNumber] = config.id end args["stroke-width"..argNumber] = config["shape-stroke-width"] or config["stroke-width"] or DEFAULT_SHAPE_STROKE_WIDTH args["stroke-color"..argNumber] = config["shape-stroke-color"] or config["shape-stroke-colour"] or config["stroke-color"] or config["stroke-colour"] or DEFAULT_SHAPE_STROKE_COLOR args["fill"..argNumber] = config["shape-fill"] or DEFAULT_SHAPE_FILL args["fill-opacity"..argNumber] = config["shape-fill-opacity"] or DEFAULT_SHAPE_FILL_OPACITY incrementArgNumber() end -- Line if showLine then args["type"..argNumber] = "line" if hasGeoshape and not hasOsmRelationId then args["from"..argNumber] = string.sub( util.getStatementValue( util.getBestStatement(wikidataId, 'P3896') ), 6) elseif config.id then args["id"..argNumber] = config.id end args["stroke-width"..argNumber] = config["line-stroke-width"] or config["stroke-width"] or DEFAULT_LINE_STROKE_WIDTH args["stroke-color"..argNumber] = config["line-stroke-color"] or config["line-stroke-colour"] or config["stroke-color"] or config["stroke-colour"] or DEFAULT_LINE_STROKE_COLOR incrementArgNumber() end -- Point marker if showMarker then args["type"..argNumber] = "point" if config.id then args["id"..argNumber] = config.id end if config.coord then args["coord"..argNumber] = config.coord end if config.marker then args["marker"..argNumber] = config.marker end args["marker-color"..argNumber] = config["marker-color"] or config["marker-colour"] or DEFAULT_MARKER_COLOR incrementArgNumber() end -- if Wikidata doesn't link to OSM and the map has no mask or point, -- then center the map on the coordinates either from the infobox or from wikidata if not maskItem and not showMarker and not wikidataProvidesGeo then if config.coord then args["frame-coord"] = args["frame-coord"] or config.coord else args["frame-lat"] = args["frame-lat"] or wdCoordinates.latitude args["frame-long"] = args["frame-long"] or wdCoordinates.longitude end tracking = tracking..util.trackAndWarn('Pages using infobox mapframe with forced centering') end -- protect against nil frame arguments args["frame-coord"] = args["frame-coord"] or "" args["frame-lat"] = args["frame-lat"] or "" args["frame-long"] = args["frame-long"] or "" local mapframe = args.switch and mf.multi(args) or mf._main(args) tracking = tracking..((showLine or showShape) and not wikidataProvidesGeo and util.trackAndWarn('Pages using infobox mapframe without shape links in Wikidata') or '') return true, mapframe.. tracking end -- Entry points p.main = function(frame) local parent = frame.getParent(frame) local parentArgs = parent.args local _, mapframe = p._main(parentArgs) return frame:preprocess(mapframe) end p.auto = function(frame) if not util.shouldAutoRun(frame) then return util.noop("auto should not autorun") end local args = util.argsFromAuto(frame) if args.custom then return frame:preprocess(util.parseCustomWikitext(args.custom)) end local _, mapframe = p._main(args) return frame:preprocess(mapframe) end p.autocaption = function(frame) if not util.shouldAutoRun(frame) then return util.noop("autocaption should not autorun") end local args = util.argsFromAuto(frame) local caption = p._caption(args) return caption end p.autoWithCaption = function(frame) if not util.shouldAutoRun(frame) then return util.noop("autoWithCaption should not autorun") end local args = util.argsFromAuto(frame) local wikitext local caption local ok if args.custom then ok = true wikitext = util.parseCustomWikitext(args.custom) else ok, wikitext = p._main(args) end if not ok then return wikitext end wikitext = frame:preprocess(wikitext) caption = p._caption(args) local data = mw.html.create():wikitext(wikitext) data:tag('div') :addClass('infobox-caption') :cssText(args.captionstyle) :wikitext(caption) return tostring(data) end return p 106wy7cnyb31y4vmayxbfey5ym8wtux टेम्पलेट:Infobox military installation 10 63194 796789 600450 2018-12-11T18:19:21Z en>Jonesey95 0 Change span class=xxx to div to fix [[Special:LintErrors|Linter]] div-span-flip error. 796789 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | image3 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | caption3 = {{{map_caption|{{{image_map_caption|}}}}}} | image4 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} |label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} |alt = {{{pushpin_map_alt|}}} |coordinates = {{{coordinates|}}} |mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} |marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} |float = center |caption = {{{pushpin_map_caption|}}} |border = infobox |position = {{{pushpin_label_position|}}} |width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} |relief = {{{pushpin_relief|{{{map_relief|}}}}}} |AlternativeMap = {{{pushpin_image|}}} }}}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | label1 = Coordinates | data1 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label2 = [[Grid reference]] | data2 = {{{gridref|}}} | label3 = Type | data3 = {{{type|}}} | label4 = Code | data4 = {{{code|}}} | label5 = Area | data5 = {{{site_area|}}} | label6 = Floor area | data6 = {{{floor_area|}}} | label7 = Height | data7 = {{{height|}}} | label8 = Length | data8 = {{{length|}}} | header9 ={{#if:{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label10 = Owner | data10 = {{ifempty|{{{ownership|}}}|{{{owner|}}}}} | label11 = Operator | data11 = {{{operator|}}} | label12 = Controlled&nbsp;by | data12 = {{ifempty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label13 = Open&nbsp;to<br />the&nbsp;public | data13 = {{{open_to_public|}}} | label14 = {{#if: {{{condition|}}}|Condition|Status}} | data14 = {{ifempty|{{{condition|}}}|{{{status|}}}}} | label15 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data15 = {{{site_other|}}} | label16 = Website | data16 = {{{website|}}} | header17 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label18 = Built | data18 = {{{built|}}} | label19 = Built&nbsp;for | data19 = {{{built_for|}}} | label20 = Built&nbsp;by | data20 = {{{builder|}}} | label21 = Architect | data21 = {{{architect|}}} | label22 = In&nbsp;use | data22 = {{ifempty|{{{used|}}}|{{{dates|}}}}} | label23 = Materials | data23 = {{{materials|}}} | label24 = Fate | data24 = {{{fate|}}} | label25 = Demolished | data25 = {{{demolished|}}} | label26 = Battles/wars | data26 = {{{battles|}}} | label27 = Events | data27 = {{{events|}}} | header28 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label29 = Current<br />commander | data29 = {{ifempty|{{{current_commander|}}}|{{{commander|}}}}} | label30 = Past<br />commanders | data30 = {{ifempty|{{{past_commanders|}}}|{{{commanders|}}}}} | label31 = Garrison | data31 = {{{garrison|}}} | label32 = Occupants | data32 = {{{occupants|}}} | header33 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label34 = [[Subcritical]] tests | data34 = {{{subcritical_tests|}}} | label35 = [[Nuclear fission|Nuclear]] tests | data35 = {{{nuclear_tests|}}} | label36 = [[Nuclear fusion|Thermonuclear]] tests | data36 = {{{thermonuclear_tests|}}} | label37 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data37 = {{{other_tests|}}} | label38 = [[Environmental remediation|Remediation]] | data38 = {{{remediation|}}} <!-- image3 testing area (START) --> | data39 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header40 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label41 = Identifiers | data41 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label42 = Elevation | data42 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data43 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data45 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label46 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data46 = {{{airfield_other|}}} | header47 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| ensign| ensign_size| ensign_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{Documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> o7gd72ug8d14n5fvzr6n79f358sirzn 796790 796789 2018-12-19T21:20:42Z en>Pigsonthewing 0 add "{{{designations|}}}", like in Infobox building 796790 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | image3 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | caption3 = {{{map_caption|{{{image_map_caption|}}}}}} | image4 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} |label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} |alt = {{{pushpin_map_alt|}}} |coordinates = {{{coordinates|}}} |mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} |marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} |float = center |caption = {{{pushpin_map_caption|}}} |border = infobox |position = {{{pushpin_label_position|}}} |width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} |relief = {{{pushpin_relief|{{{map_relief|}}}}}} |AlternativeMap = {{{pushpin_image|}}} }}}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | label1 = Coordinates | data1 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label2 = [[Grid reference]] | data2 = {{{gridref|}}} | label3 = Type | data3 = {{{type|}}} | label4 = Code | data4 = {{{code|}}} | label5 = Area | data5 = {{{site_area|}}} | label6 = Floor area | data6 = {{{floor_area|}}} | label7 = Height | data7 = {{{height|}}} | label8 = Length | data8 = {{{length|}}} | header9 ={{#if:{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label10 = Owner | data10 = {{ifempty|{{{ownership|}}}|{{{owner|}}}}} | label11 = Operator | data11 = {{{operator|}}} | label12 = Controlled&nbsp;by | data12 = {{ifempty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label13 = Open&nbsp;to<br />the&nbsp;public | data13 = {{{open_to_public|}}} | label14 = {{#if: {{{condition|}}}|Condition|Status}} | data14 = {{ifempty|{{{condition|}}}|{{{status|}}}}} | label15 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data15 = {{{site_other|}}} | label16 = Website | data16 = {{{website|}}} | header17 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label18 = Built | data18 = {{{built|}}} | label19 = Built&nbsp;for | data19 = {{{built_for|}}} | label20 = Built&nbsp;by | data20 = {{{builder|}}} | label21 = Architect | data21 = {{{architect|}}} | label22 = In&nbsp;use | data22 = {{ifempty|{{{used|}}}|{{{dates|}}}}} | label23 = Materials | data23 = {{{materials|}}} | label24 = Fate | data24 = {{{fate|}}} | label25 = Demolished | data25 = {{{demolished|}}} | label26 = Battles/wars | data26 = {{{battles|}}} | label27 = Events | data27 = {{{events|}}} | header28 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label29 = Current<br />commander | data29 = {{ifempty|{{{current_commander|}}}|{{{commander|}}}}} | label30 = Past<br />commanders | data30 = {{ifempty|{{{past_commanders|}}}|{{{commanders|}}}}} | label31 = Garrison | data31 = {{{garrison|}}} | label32 = Occupants | data32 = {{{occupants|}}} | label33 = Designations | data33 = {{{designations|}}} | header34 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label35 = [[Subcritical]] tests | data35 = {{{subcritical_tests|}}} | label36 = [[Nuclear fission|Nuclear]] tests | data36 = {{{nuclear_tests|}}} | label37 = [[Nuclear fusion|Thermonuclear]] tests | data37 = {{{thermonuclear_tests|}}} | label38 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data38 = {{{other_tests|}}} | label39 = [[Environmental remediation|Remediation]] | data39 = {{{remediation|}}} <!-- image3 testing area (START) --> | data40 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header41 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label42 = Identifiers | data42 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label43 = Elevation | data43 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data44 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data45 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label46 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data46 = {{{airfield_other|}}} | header47 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| ensign| ensign_size| ensign_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{Documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> kxgnnqxwkiegz4lv1tqzy6brxxcnlcl 796791 796790 2018-12-19T21:21:26Z en>Pigsonthewing 0 ce 796791 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | image3 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | caption3 = {{{map_caption|{{{image_map_caption|}}}}}} | image4 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} |label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} |alt = {{{pushpin_map_alt|}}} |coordinates = {{{coordinates|}}} |mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} |marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} |float = center |caption = {{{pushpin_map_caption|}}} |border = infobox |position = {{{pushpin_label_position|}}} |width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} |relief = {{{pushpin_relief|{{{map_relief|}}}}}} |AlternativeMap = {{{pushpin_image|}}} }}}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | label1 = Coordinates | data1 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label2 = [[Grid reference]] | data2 = {{{gridref|}}} | label3 = Type | data3 = {{{type|}}} | label4 = Code | data4 = {{{code|}}} | label5 = Area | data5 = {{{site_area|}}} | label6 = Floor area | data6 = {{{floor_area|}}} | label7 = Height | data7 = {{{height|}}} | label8 = Length | data8 = {{{length|}}} | header9 ={{#if:{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label10 = Owner | data10 = {{ifempty|{{{ownership|}}}|{{{owner|}}}}} | label11 = Operator | data11 = {{{operator|}}} | label12 = Controlled&nbsp;by | data12 = {{ifempty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label13 = Open&nbsp;to<br />the&nbsp;public | data13 = {{{open_to_public|}}} | label14 = {{#if: {{{condition|}}}|Condition|Status}} | data14 = {{ifempty|{{{condition|}}}|{{{status|}}}}} | label15 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data15 = {{{site_other|}}} | label16 = Website | data16 = {{{website|}}} | header17 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label18 = Built | data18 = {{{built|}}} | label19 = Built&nbsp;for | data19 = {{{built_for|}}} | label20 = Built&nbsp;by | data20 = {{{builder|}}} | label21 = Architect | data21 = {{{architect|}}} | label22 = In&nbsp;use | data22 = {{ifempty|{{{used|}}}|{{{dates|}}}}} | label23 = Materials | data23 = {{{materials|}}} | label24 = Fate | data24 = {{{fate|}}} | label25 = Demolished | data25 = {{{demolished|}}} | label26 = Battles/wars | data26 = {{{battles|}}} | label27 = Events | data27 = {{{events|}}} | header28 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label29 = Current<br />commander | data29 = {{ifempty|{{{current_commander|}}}|{{{commander|}}}}} | label30 = Past<br />commanders | data30 = {{ifempty|{{{past_commanders|}}}|{{{commanders|}}}}} | label31 = Garrison | data31 = {{{garrison|}}} | label32 = Occupants | data32 = {{{occupants|}}} | label33 = Designations | data33 = {{{designations|}}} | header34 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label35 = [[Subcritical]] tests | data35 = {{{subcritical_tests|}}} | label36 = [[Nuclear fission|Nuclear]] tests | data36 = {{{nuclear_tests|}}} | label37 = [[Nuclear fusion|Thermonuclear]] tests | data37 = {{{thermonuclear_tests|}}} | label38 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data38 = {{{other_tests|}}} | label39 = [[Environmental remediation|Remediation]] | data39 = {{{remediation|}}} <!-- image3 testing area (START) --> | data40 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header41 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label42 = Identifiers | data42 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label43 = Elevation | data43 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data44 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data45 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label46 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data46 = {{{airfield_other|}}} | header47 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{Documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> 9pmzr1wyk90304cxcrbdla4s04bwact 796792 796791 2019-10-10T21:31:16Z en>Frietjes 0 796792 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | image3 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | caption3 = {{{map_caption|{{{image_map_caption|}}}}}} | image4 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} |label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} |alt = {{{pushpin_map_alt|}}} |coordinates = {{{coordinates|}}} |mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} |marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} |float = center |caption = {{{pushpin_map_caption|}}} |border = infobox |position = {{{pushpin_label_position|}}} |width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} |relief = {{{pushpin_relief|{{{map_relief|}}}}}} |AlternativeMap = {{{pushpin_image|}}} }}}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | label1 = Coordinates | data1 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label2 = [[Grid reference]] | data2 = {{{gridref|}}} | label3 = Type | data3 = {{{type|}}} | label4 = Code | data4 = {{{code|}}} | label5 = Area | data5 = {{{site_area|}}} | label6 = Floor area | data6 = {{{floor_area|}}} | label7 = Height | data7 = {{{height|}}} | label8 = Length | data8 = {{{length|}}} | header9 ={{#if:{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label10 = Owner | data10 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label11 = Operator | data11 = {{{operator|}}} | label12 = Controlled&nbsp;by | data12 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label13 = Open&nbsp;to<br />the&nbsp;public | data13 = {{{open_to_public|}}} | label14 = {{#if: {{{condition|}}}|Condition|Status}} | data14 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label15 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data15 = {{{site_other|}}} | label16 = Website | data16 = {{{website|}}} | header17 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label18 = Built | data18 = {{{built|}}} | label19 = Built&nbsp;for | data19 = {{{built_for|}}} | label20 = Built&nbsp;by | data20 = {{{builder|}}} | label21 = Architect | data21 = {{{architect|}}} | label22 = In&nbsp;use | data22 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label23 = Materials | data23 = {{{materials|}}} | label24 = Fate | data24 = {{{fate|}}} | label25 = Demolished | data25 = {{{demolished|}}} | label26 = Battles/wars | data26 = {{{battles|}}} | label27 = Events | data27 = {{{events|}}} | header28 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label29 = Current<br />commander | data29 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label30 = Past<br />commanders | data30 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label31 = Garrison | data31 = {{{garrison|}}} | label32 = Occupants | data32 = {{{occupants|}}} | label33 = Designations | data33 = {{{designations|}}} | header34 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label35 = [[Subcritical]] tests | data35 = {{{subcritical_tests|}}} | label36 = [[Nuclear fission|Nuclear]] tests | data36 = {{{nuclear_tests|}}} | label37 = [[Nuclear fusion|Thermonuclear]] tests | data37 = {{{thermonuclear_tests|}}} | label38 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data38 = {{{other_tests|}}} | label39 = [[Environmental remediation|Remediation]] | data39 = {{{remediation|}}} <!-- image3 testing area (START) --> | data40 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header41 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label42 = Identifiers | data42 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label43 = Elevation | data43 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data44 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data45 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label46 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data46 = {{{airfield_other|}}} | header47 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{Documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> b8gmnqvarebpunp3ol2vs3yb6tsesye 796793 796792 2019-12-21T16:39:43Z en>Frietjes 0 per talk page 796793 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | image3 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | caption3 = {{{map_caption|{{{image_map_caption|}}}}}} | image4 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} |label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} |alt = {{{pushpin_map_alt|}}} |coordinates = {{{coordinates|}}} |mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} |marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} |float = center |caption = {{{pushpin_map_caption|}}} |border = infobox |position = {{{pushpin_label_position|}}} |width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} |relief = {{{pushpin_relief|{{{map_relief|}}}}}} |AlternativeMap = {{{pushpin_image|}}} }}}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | label1 = Coordinates | data1 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label2 = [[Grid reference]] | data2 = {{{gridref|}}} | label3 = Type | data3 = {{{type|}}} | label4 = Code | data4 = {{{code|}}} | label5 = Area | data5 = {{{site_area|}}} | label6 = Floor area | data6 = {{{floor_area|}}} | label7 = Height | data7 = {{{height|}}} | label8 = Length | data8 = {{{length|}}} | header9 ={{#if:{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label10 = Owner | data10 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label11 = Operator | data11 = {{{operator|}}} | label12 = Controlled&nbsp;by | data12 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label13 = Open&nbsp;to<br />the&nbsp;public | data13 = {{{open_to_public|}}} | label14 = {{#if: {{{condition|}}}|Condition|Status}} | data14 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label15 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data15 = {{{site_other|}}} | label16 = Website | data16 = {{{website|}}} | header17 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label18 = Built | data18 = {{{built|}}} | label19 = Built&nbsp;for | data19 = {{{built_for|}}} | label20 = Built&nbsp;by | data20 = {{{builder|}}} | label21 = Architect | data21 = {{{architect|}}} | label22 = In&nbsp;use | data22 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label23 = Materials | data23 = {{{materials|}}} | label24 = Fate | data24 = {{{fate|}}} | label25 = Demolished | data25 = {{{demolished|}}} | label26 = Battles/wars | data26 = {{{battles|}}} | label27 = Events | data27 = {{{events|}}} | header28 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label29 = Current<br />commander | data29 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label30 = Past<br />commanders | data30 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label31 = Garrison | data31 = {{{garrison|}}} | label32 = Occupants | data32 = {{{occupants|}}} | label33 = Designations | data33 = {{{designations|}}} | header34 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label35 = [[Subcritical]] tests | data35 = {{{subcritical_tests|}}} | label36 = [[Nuclear fission|Nuclear]] tests | data36 = {{{nuclear_tests|}}} | label37 = [[Nuclear fusion|Thermonuclear]] tests | data37 = {{{thermonuclear_tests|}}} | label38 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data38 = {{{other_tests|}}} | label39 = [[Environmental remediation|Remediation]] | data39 = {{{remediation|}}} <!-- image3 testing area (START) --> | data40 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header41 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label42 = Identifiers | data42 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label43 = Elevation | data43 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data44 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data45 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label46 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data46 = {{{airfield_other|}}} | header47 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> 11vykk2nq5fjpc9msi5ckwspytpw6sp 796794 796793 2025-03-21T18:17:10Z en>Joy 0 add mapframe support, on by default if no pushpin map ([[Wikipedia:Mapframe maps in infoboxes]]) 796794 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | image3 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | caption3 = {{{map_caption|{{{image_map_caption|}}}}}} | image4 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} |label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} |alt = {{{pushpin_map_alt|}}} |coordinates = {{{coordinates|}}} |mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} |marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} |float = center |caption = {{{pushpin_map_caption|}}} |border = infobox |position = {{{pushpin_label_position|}}} |width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} |relief = {{{pushpin_relief|{{{map_relief|}}}}}} |AlternativeMap = {{{pushpin_image|}}} }}}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | label1 = Coordinates | data1 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label2 = [[Grid reference]] | data2 = {{{gridref|}}} | label3 = Type | data3 = {{{type|}}} | label4 = Code | data4 = {{{code|}}} | label5 = Area | data5 = {{{site_area|}}} | label6 = Floor area | data6 = {{{floor_area|}}} | label7 = Height | data7 = {{{height|}}} | label8 = Length | data8 = {{{length|}}} | header9 ={{#if:{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label10 = Owner | data10 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label11 = Operator | data11 = {{{operator|}}} | label12 = Controlled&nbsp;by | data12 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label13 = Open&nbsp;to<br />the&nbsp;public | data13 = {{{open_to_public|}}} | label14 = {{#if: {{{condition|}}}|Condition|Status}} | data14 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label15 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data15 = {{{site_other|}}} | label16 = Website | data16 = {{{website|}}} | header17 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label18 = Built | data18 = {{{built|}}} | label19 = Built&nbsp;for | data19 = {{{built_for|}}} | label20 = Built&nbsp;by | data20 = {{{builder|}}} | label21 = Architect | data21 = {{{architect|}}} | label22 = In&nbsp;use | data22 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label23 = Materials | data23 = {{{materials|}}} | label24 = Fate | data24 = {{{fate|}}} | label25 = Demolished | data25 = {{{demolished|}}} | label26 = Battles/wars | data26 = {{{battles|}}} | label27 = Events | data27 = {{{events|}}} | header28 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label29 = Current<br />commander | data29 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label30 = Past<br />commanders | data30 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label31 = Garrison | data31 = {{{garrison|}}} | label32 = Occupants | data32 = {{{occupants|}}} | label33 = Designations | data33 = {{{designations|}}} | header34 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label35 = [[Subcritical]] tests | data35 = {{{subcritical_tests|}}} | label36 = [[Nuclear fission|Nuclear]] tests | data36 = {{{nuclear_tests|}}} | label37 = [[Nuclear fusion|Thermonuclear]] tests | data37 = {{{thermonuclear_tests|}}} | label38 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data38 = {{{other_tests|}}} | label39 = [[Environmental remediation|Remediation]] | data39 = {{{remediation|}}} <!-- image3 testing area (START) --> | data40 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header41 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label42 = Identifiers | data42 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label43 = Elevation | data43 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data44 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data45 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label46 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data46 = {{{airfield_other|}}} | header50 = {{#if:{{{mapframe|}}}|Location}} | data51 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}|no|yes}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 }} | data52 = {{#invoke:Infobox mapframe|autocaption}} | header55 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes | mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> 27ghhaoa7fbtvyiv8icm326urrvp88u 796795 796794 2025-03-21T19:44:51Z en>Joy 0 also avoid map and image_map parameters to deduplicate mapframes by default 796795 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | image3 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | caption3 = {{{map_caption|{{{image_map_caption|}}}}}} | image4 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} |label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} |alt = {{{pushpin_map_alt|}}} |coordinates = {{{coordinates|}}} |mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} |marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} |float = center |caption = {{{pushpin_map_caption|}}} |border = infobox |position = {{{pushpin_label_position|}}} |width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} |relief = {{{pushpin_relief|{{{map_relief|}}}}}} |AlternativeMap = {{{pushpin_image|}}} }}}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | label1 = Coordinates | data1 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label2 = [[Grid reference]] | data2 = {{{gridref|}}} | label3 = Type | data3 = {{{type|}}} | label4 = Code | data4 = {{{code|}}} | label5 = Area | data5 = {{{site_area|}}} | label6 = Floor area | data6 = {{{floor_area|}}} | label7 = Height | data7 = {{{height|}}} | label8 = Length | data8 = {{{length|}}} | header9 ={{#if:{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label10 = Owner | data10 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label11 = Operator | data11 = {{{operator|}}} | label12 = Controlled&nbsp;by | data12 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label13 = Open&nbsp;to<br />the&nbsp;public | data13 = {{{open_to_public|}}} | label14 = {{#if: {{{condition|}}}|Condition|Status}} | data14 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label15 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data15 = {{{site_other|}}} | label16 = Website | data16 = {{{website|}}} | header17 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label18 = Built | data18 = {{{built|}}} | label19 = Built&nbsp;for | data19 = {{{built_for|}}} | label20 = Built&nbsp;by | data20 = {{{builder|}}} | label21 = Architect | data21 = {{{architect|}}} | label22 = In&nbsp;use | data22 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label23 = Materials | data23 = {{{materials|}}} | label24 = Fate | data24 = {{{fate|}}} | label25 = Demolished | data25 = {{{demolished|}}} | label26 = Battles/wars | data26 = {{{battles|}}} | label27 = Events | data27 = {{{events|}}} | header28 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label29 = Current<br />commander | data29 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label30 = Past<br />commanders | data30 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label31 = Garrison | data31 = {{{garrison|}}} | label32 = Occupants | data32 = {{{occupants|}}} | label33 = Designations | data33 = {{{designations|}}} | header34 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label35 = [[Subcritical]] tests | data35 = {{{subcritical_tests|}}} | label36 = [[Nuclear fission|Nuclear]] tests | data36 = {{{nuclear_tests|}}} | label37 = [[Nuclear fusion|Thermonuclear]] tests | data37 = {{{thermonuclear_tests|}}} | label38 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data38 = {{{other_tests|}}} | label39 = [[Environmental remediation|Remediation]] | data39 = {{{remediation|}}} <!-- image3 testing area (START) --> | data40 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header41 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label42 = Identifiers | data42 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label43 = Elevation | data43 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data44 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data45 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label46 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data46 = {{{airfield_other|}}} | header50 = {{#if:{{{mapframe|}}}|Location}} | data51 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map|}}}{{{image_map|}}}|no|yes}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 }} | data52 = {{#invoke:Infobox mapframe|autocaption}} | header55 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes | mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> a33fj13kjnhk0q2jrdtu07gvs6vxc9c 796796 796795 2025-03-21T20:30:42Z en>Joy 0 move type, code and various site information parameters under the latter heading, and all the maps, coordinates, area, ... under the location heading 796796 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{{map_caption|{{{image_map_caption|}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map|}}}{{{image_map|}}}|no|yes}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 }} | data16 = {{#invoke:Infobox mapframe|autocaption}} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header60 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes | mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> q1xgjcdjwq3vjpgbffsgpnfyzxgiwx8 796797 796796 2025-03-21T21:05:34Z en>Joy 0 because data13 is effectively used as a label for data12, make it depend on its preconditions (map or map_image) so we don't happen to render a label without the caption; make pushpin_map_caption fall back on map_caption just in case 796797 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{{map_caption|{{{image_map_caption|}}}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|{{{map_caption|}}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map|}}}{{{image_map|}}}|no|yes}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 }} | data16 = {{#invoke:Infobox mapframe|autocaption}} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header60 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes | mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> pmd4vci38polnnhwd5vhl5n4wgzr5dr 796798 796797 2025-03-21T21:29:32Z en>Joy 0 implement the map_type alternative to pushpin_map consistently 796798 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{{map_caption|{{{image_map_caption|}}}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|{{{map_caption|}}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}|no|yes}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 }} | data16 = {{#invoke:Infobox mapframe|autocaption}} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header60 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes | mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> ap8kfe0ldk5p1uxa6zxpzbvo3q7dlla 796799 796798 2025-08-15T21:51:46Z en>Joy 0 set default mapframe type to landmark 796799 wikitext text/x-wiki {{infobox | child = {{#ifeq:{{{embed|}}}|yes|yes}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{{map_caption|{{{image_map_caption|}}}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|{{{map_caption|}}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}|no|yes}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 | mapframe-type = landmark }} | data16 = {{#invoke:Infobox mapframe|autocaption}} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header60 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes | mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> thukb0eygsrufmatgm42v843eqs6k03 796800 796799 2025-09-01T14:22:17Z en>Hike395 0 yesno test of embed, turn off mapframe on embedding 796800 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{{map_caption|{{{image_map_caption|}}}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|{{{map_caption|}}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 | mapframe-type = landmark }} | data16 = {{#invoke:Infobox mapframe | autocaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header60 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes | mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> 3rc71uiad7e29j4yp1n97btv3bd2ddh 796801 796800 2025-10-03T02:41:56Z en>Jonesey95 0 fix text color in dark mode; this generally works but may cause problems, in which case revert or try specifying a different CSS value 796801 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{{map_caption|{{{image_map_caption|}}}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|{{{map_caption|}}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 | mapframe-type = landmark }} | data16 = {{#invoke:Infobox mapframe | autocaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header60 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| |nrhp |embedded |module| footnotes | mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> 5iy3dq7qp3k40zit5edcr28sxmopoq0 796802 796801 2025-10-09T21:43:21Z en>Zackmann08 0 Updating unknown parameter tracking through [[User:Zackmann08/addcheckforunknownparameters.js|AddCheckForUnknownParameters]] using [[Module:check for unknown parameters]]. Note that mapframe args are now included automatically via mapframe_args=y 796802 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{{map_caption|{{{image_map_caption|}}}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|{{{map_caption|}}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 | mapframe-type = landmark }} | data16 = {{#invoke:Infobox mapframe | autocaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header60 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> snbde0m5a1h82woguzv97qoedlqerto 796803 796802 2025-11-03T03:38:09Z en>Zackmann08 0 module should be in a data so as not to get header stylings 796803 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{{map_caption|{{{image_map_caption|}}}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|{{{map_caption|}}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 | mapframe-type = landmark }} | data16 = {{#invoke:Infobox mapframe | autocaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> mjz7ju2145dq8d5gncph0hbejhzipxj 796804 796803 2025-11-08T05:06:48Z en>Zackmann08 0 default shape line to 2. better clarity 796804 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{{map_caption|{{{image_map_caption|}}}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|{{{map_caption|}}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-stroke-width = 2 | mapframe-frame-width = 250 | mapframe-type = landmark }} | data16 = {{#invoke:Infobox mapframe | autocaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> bew6x65jnkxj39sasyn0ftzvsyo1kt3 796805 796804 2025-11-08T05:17:21Z en>Zackmann08 0 default to pulling map shape from wikidata 796805 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{{map_caption|{{{image_map_caption|}}}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|{{{map_caption|}}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | auto | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-stroke-width = 2 | mapframe-frame-width = 250 | mapframe-type = landmark | mapframe-wikidata = yes }} | data16 = {{#invoke:Infobox mapframe | autocaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> b9utn5z9g1a170l4ju8sucomrhz0i18 796806 796805 2025-11-20T21:17:41Z en>Zackmann08 0 Converting [[Module:Infobox mapframe]] call to use newly improved function. See [[Template_talk:Infobox_mapframe#Weird_preview_%22bug%22?|this thread]] for details on the change. 796806 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{{image_alt|{{{alt|}}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{{image2_alt|{{{alt2|}}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{{map|{{{image_map|}}}}}}|size={{{map_size|{{{image_mapsize|}}}}}}|sizedefault=250px|alt={{{map_alt|{{{image_map_alt|}}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{{map_caption|{{{image_map_caption|}}}}}}}} | data14 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |{{Location map|{{{pushpin_map|{{{map_type|}}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{{pushpin_map_caption|{{{map_caption|}}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|{{{map_size|}}}}}}|{{{pushpin_mapsize|{{{map_size|}}}}}} | 250 }} | relief = {{{pushpin_relief|{{{map_relief|}}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | autoWithCaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-stroke-width = 2 | mapframe-frame-width = 250 | mapframe-type = landmark | mapframe-wikidata = yes }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{{coordinates_footnotes|{{{coord_footnotes|}}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|{{{commanders|}}}}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{{image3_alt|{{{alt3|}}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{{name|{{PAGENAME}}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> a3xzc356m3v3ntvv17k0g0mi4lio08s 796807 796806 2025-12-11T05:17:57Z en>Zackmann08 0 Improving nested param logic using [[User:Zackmann08/unnest.js|unnest]] 796807 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{if empty|{{{image_alt|}}}|{{{alt|}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{if empty|{{{image2_alt|}}}|{{{alt2|}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{if empty|{{{map|}}}|{{{image_map|}}}}}|size={{if empty|{{{map_size|}}}|{{{image_mapsize|}}}}}|sizedefault=250px|alt={{if empty|{{{map_alt|}}}|{{{image_map_alt|}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{if empty|{{{map_caption|}}}|{{{image_map_caption|}}}}}}} | data14 = {{#if:{{{pushpin_map|}}}{{{map_type|}}} |{{Location map|{{if empty|{{{pushpin_map|}}}|{{{map_type|}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{if empty|{{{pushpin_map_caption|}}}|{{{map_caption|}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|}}}{{{map_size|}}}|{{if empty|{{{pushpin_mapsize|}}}|{{{map_size|}}}}} | 250 }} | relief = {{if empty|{{{pushpin_relief|}}}|{{{map_relief|}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | autoWithCaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-stroke-width = 2 | mapframe-frame-width = 250 | mapframe-type = landmark | mapframe-wikidata = yes }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{if empty|{{{coordinates_footnotes|}}}|{{{coord_footnotes|}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|}}}{{{commanders|}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{if empty|{{{image3_alt|}}}|{{{alt3|}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{if empty|{{{nrhp|}}}|{{{embedded|}}}|{{{module|}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{if empty|{{{name|}}}|{{PAGENAME}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> 3wf2mq93jdvr61e40cir13rdg4smuax 796808 796807 2025-12-11T05:20:23Z en>Zackmann08 0 Adding clobbered parameter tracking through [[:Category:Pages using infobox military installation with conflicting parameters]] using [[User:Zackmann08/AddCheckForClobberedParameters.js|AddCheckForClobberedParameters]] and [[Module:check for clobbered parameters]] 796808 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{if empty|{{{image_alt|}}}|{{{alt|}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{if empty|{{{image2_alt|}}}|{{{alt2|}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{if empty|{{{map|}}}|{{{image_map|}}}}}|size={{if empty|{{{map_size|}}}|{{{image_mapsize|}}}}}|sizedefault=250px|alt={{if empty|{{{map_alt|}}}|{{{image_map_alt|}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{if empty|{{{map_caption|}}}|{{{image_map_caption|}}}}}}} | data14 = {{#if:{{{pushpin_map|}}}{{{map_type|}}} |{{Location map|{{if empty|{{{pushpin_map|}}}|{{{map_type|}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{if empty|{{{pushpin_map_caption|}}}|{{{map_caption|}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|}}}{{{map_size|}}}|{{if empty|{{{pushpin_mapsize|}}}|{{{map_size|}}}}} | 250 }} | relief = {{if empty|{{{pushpin_relief|}}}|{{{map_relief|}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | autoWithCaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-stroke-width = 2 | mapframe-frame-width = 250 | mapframe-type = landmark | mapframe-wikidata = yes }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{if empty|{{{coordinates_footnotes|}}}|{{{coord_footnotes|}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|}}}{{{commanders|}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{if empty|{{{image3_alt|}}}|{{{alt3|}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{if empty|{{{nrhp|}}}|{{{embedded|}}}|{{{module|}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{if empty|{{{name|}}}|{{PAGENAME}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}{{#invoke:Check for clobbered parameters|check | template = [[Template:Infobox military installation]] | cat = {{main other|Category:Pages using infobox military installation with conflicting parameters}} | image_alt; alt | image2_alt; alt2 | ownership; owner | controlledby; controlled by; controlled_by | condition; status | map; image_map | map_size; image_mapsize | map_alt; image_map_alt | map_caption; image_map_caption | pushpin_map; map_type | pushpin_map_caption; map_caption | pushpin_mapsize; map_size | pushpin_relief; map_relief | coordinates_footnotes; coord_footnotes | used; dates | current_commander; commander | past_commanders; commanders | image3_alt; alt3 | nrhp; embedded; module }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> 6od7bch01wvxlyi4mqmgyz43bmah9k6 796809 796808 2025-12-28T03:44:02Z en>Zackmann08 0 Module has been renamed 796809 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{if empty|{{{image_alt|}}}|{{{alt|}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{if empty|{{{image2_alt|}}}|{{{alt2|}}}}}}} | caption2 = {{{caption2|}}} | header1 ={{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = Open&nbsp;to<br />the&nbsp;public | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{#if:{{{site_other_label|}}} | {{{site_other_label}}} | Other site<br>facilities }} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{if empty|{{{map|}}}|{{{image_map|}}}}}|size={{if empty|{{{map_size|}}}|{{{image_mapsize|}}}}}|sizedefault=250px|alt={{if empty|{{{map_alt|}}}|{{{image_map_alt|}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{if empty|{{{map_caption|}}}|{{{image_map_caption|}}}}}}} | data14 = {{#if:{{{pushpin_map|}}}{{{map_type|}}} |{{Location map|{{if empty|{{{pushpin_map|}}}|{{{map_type|}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{{name|<includeonly>{{PAGENAMEBASE}}</includeonly>}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{#if: {{{pushpin_mark|}}} | {{{pushpin_mark}}} | Red_pog.svg }} | marksize = {{#if: {{{pushpin_marksize|}}} | {{{pushpin_marksize}}} | 10 }} | float = center | caption = {{if empty|{{{pushpin_map_caption|}}}|{{{map_caption|}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|}}}{{{map_size|}}}|{{if empty|{{{pushpin_mapsize|}}}|{{{map_size|}}}}} | 250 }} | relief = {{if empty|{{{pushpin_relief|}}}|{{{map_relief|}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | autoWithCaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-stroke-width = 2 | mapframe-frame-width = 250 | mapframe-type = landmark | mapframe-wikidata = yes }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{if empty|{{{coordinates_footnotes|}}}|{{{coord_footnotes|}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|}}}{{{commanders|}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = Current<br />commander | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = Past<br />commanders | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = [[Subcritical]] tests | data45 = {{{subcritical_tests|}}} | label46 = [[Nuclear fission|Nuclear]] tests | data46 = {{{nuclear_tests|}}} | label47 = [[Nuclear fusion|Thermonuclear]] tests | data47 = {{{thermonuclear_tests|}}} | label48 = {{#if:{{{other_tests_label|}}} | {{{other_tests_label}}} | Other tests }} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{if empty|{{{image3_alt|}}}|{{{alt3|}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{#if:{{{airfield_other_label|}}} | {{{airfield_other_label}}} | Other airfield<br>facilities }} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{if empty|{{{nrhp|}}}|{{{embedded|}}}|{{{module|}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{if empty|{{{name|}}}|{{PAGENAME}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}{{#invoke:Check for conflicting parameters|check | template = [[Template:Infobox military installation]] | cat = {{main other|Category:Pages using infobox military installation with conflicting parameters}} | image_alt; alt | image2_alt; alt2 | ownership; owner | controlledby; controlled by; controlled_by | condition; status | map; image_map | map_size; image_mapsize | map_alt; image_map_alt | map_caption; image_map_caption | pushpin_map; map_type | pushpin_map_caption; map_caption | pushpin_mapsize; map_size | pushpin_relief; map_relief | coordinates_footnotes; coord_footnotes | used; dates | current_commander; commander | past_commanders; commanders | image3_alt; alt3 | nrhp; embedded; module }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> i1r52ju5j27e7ucl6mviv6f4g4osn6p 796810 796809 2026-05-30T06:34:20Z en>Zackmann08 0 improved word wrapping with [[Template:Longitem]]; Cleaning up syntax using [[:en:User:Zackmann08/scripts/indent|indent.js]]; Improving nested param logic using [[User:Zackmann08/scripts/unnest.js|unnest]] 796810 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|{{PAGENAMEBASE}}}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{if empty|{{{image_alt|}}}|{{{alt|}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{if empty|{{{image2_alt|}}}|{{{alt2|}}}}}}} | caption2 = {{{caption2|}}} | header1 = {{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = {{longitem|Open&nbsp;to the&nbsp;public}} | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{longitem|{{if empty|{{{site_other_label|}}}|Other site<br>facilities }}}} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{if empty|{{{map|}}}|{{{image_map|}}}}}|size={{if empty|{{{map_size|}}}|{{{image_mapsize|}}}}}|sizedefault=250px|alt={{if empty|{{{map_alt|}}}|{{{image_map_alt|}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{if empty|{{{map_caption|}}}|{{{image_map_caption|}}}}}}} | data14 = {{#if:{{{pushpin_map|}}}{{{map_type|}}} |{{Location map|{{if empty|{{{pushpin_map|}}}|{{{map_type|}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{if empty|{{{pushpin_mark|}}}|Red_pog.svg }} | marksize = {{if empty|{{{pushpin_marksize|}}}|10 }} | float = center | caption = {{if empty|{{{pushpin_map_caption|}}}|{{{map_caption|}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|}}}{{{map_size|}}}|{{if empty|{{{pushpin_mapsize|}}}|{{{map_size|}}}}} | 250 }} | relief = {{if empty|{{{pushpin_relief|}}}|{{{map_relief|}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | autoWithCaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-stroke-width = 2 | mapframe-frame-width = 250 | mapframe-type = landmark | mapframe-wikidata = yes }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{if empty|{{{coordinates_footnotes|}}}|{{{coord_footnotes|}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|}}}{{{commanders|}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = {{longitem|Current commander}} | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = {{longitem|Past commanders}} | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = {{longitem|[[Subcritical]] tests}} | data45 = {{{subcritical_tests|}}} | label46 = {{longitem|[[Nuclear fission|Nuclear]] tests}} | data46 = {{{nuclear_tests|}}} | label47 = {{longitem|[[Nuclear fusion|Thermonuclear]] tests}} | data47 = {{{thermonuclear_tests|}}} | label48 = {{longitem|{{if empty|{{{other_tests_label|}}}|Other tests }}}} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{if empty|{{{image3_alt|}}}|{{{alt3|}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{longitem|{{if empty|{{{airfield_other_label|}}}|Other airfield<br>facilities }}}} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{if empty|{{{nrhp|}}}|{{{embedded|}}}|{{{module|}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{if empty|{{{name|}}}|{{PAGENAME}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}{{#invoke:Check for conflicting parameters|check | template = [[Template:Infobox military installation]] | cat = {{main other|Category:Pages using infobox military installation with conflicting parameters}} | image_alt; alt | image2_alt; alt2 | ownership; owner | controlledby; controlled by; controlled_by | condition; status | map; image_map | map_size; image_mapsize | map_alt; image_map_alt | map_caption; image_map_caption | pushpin_map; map_type | pushpin_map_caption; map_caption | pushpin_mapsize; map_size | pushpin_relief; map_relief | coordinates_footnotes; coord_footnotes | used; dates | current_commander; commander | past_commanders; commanders | image3_alt; alt3 | nrhp; embedded; module }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> tq1sadlbf1b3jzvezwwovuo47jrnxhv 796811 796810 2026-06-06T02:57:13Z SM7 3953 22 revisions imported from [[:en:Template:Infobox_military_installation]] 796810 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|{{PAGENAMEBASE}}}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{if empty|{{{image_alt|}}}|{{{alt|}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{if empty|{{{image2_alt|}}}|{{{alt2|}}}}}}} | caption2 = {{{caption2|}}} | header1 = {{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = {{longitem|Open&nbsp;to the&nbsp;public}} | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{longitem|{{if empty|{{{site_other_label|}}}|Other site<br>facilities }}}} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{if empty|{{{map|}}}|{{{image_map|}}}}}|size={{if empty|{{{map_size|}}}|{{{image_mapsize|}}}}}|sizedefault=250px|alt={{if empty|{{{map_alt|}}}|{{{image_map_alt|}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{if empty|{{{map_caption|}}}|{{{image_map_caption|}}}}}}} | data14 = {{#if:{{{pushpin_map|}}}{{{map_type|}}} |{{Location map|{{if empty|{{{pushpin_map|}}}|{{{map_type|}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{if empty|{{{pushpin_mark|}}}|Red_pog.svg }} | marksize = {{if empty|{{{pushpin_marksize|}}}|10 }} | float = center | caption = {{if empty|{{{pushpin_map_caption|}}}|{{{map_caption|}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|}}}{{{map_size|}}}|{{if empty|{{{pushpin_mapsize|}}}|{{{map_size|}}}}} | 250 }} | relief = {{if empty|{{{pushpin_relief|}}}|{{{map_relief|}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | autoWithCaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-stroke-width = 2 | mapframe-frame-width = 250 | mapframe-type = landmark | mapframe-wikidata = yes }} | label17 = Coordinates | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{if empty|{{{coordinates_footnotes|}}}|{{{coord_footnotes|}}}}} }} | label18 = [[Grid reference]] | data18 = {{{gridref|}}} | label19 = Area | data19 = {{{site_area|}}} | label20 = Floor area | data20 = {{{floor_area|}}} | label21 = Height | data21 = {{{height|}}} | label22 = Length | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | Site history }} | label28 = Built | data28 = {{{built|}}} | label29 = Built&nbsp;for | data29 = {{{built_for|}}} | label30 = Built&nbsp;by | data30 = {{{builder|}}} | label31 = Architect | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = Materials | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = Events | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|}}}{{{commanders|}}}{{{garrison|}}}{{{occupants|}}} | Garrison information }} | label39 = {{longitem|Current commander}} | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = {{longitem|Past commanders}} | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = Occupants | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = {{longitem|[[Subcritical]] tests}} | data45 = {{{subcritical_tests|}}} | label46 = {{longitem|[[Nuclear fission|Nuclear]] tests}} | data46 = {{{nuclear_tests|}}} | label47 = {{longitem|[[Nuclear fusion|Thermonuclear]] tests}} | data47 = {{{thermonuclear_tests|}}} | label48 = {{longitem|{{if empty|{{{other_tests_label|}}}|Other tests }}}} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{if empty|{{{image3_alt|}}}|{{{alt3|}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{longitem|{{if empty|{{{airfield_other_label|}}}|Other airfield<br>facilities }}}} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{if empty|{{{nrhp|}}}|{{{embedded|}}}|{{{module|}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{if empty|{{{name|}}}|{{PAGENAME}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}{{#invoke:Check for conflicting parameters|check | template = [[Template:Infobox military installation]] | cat = {{main other|Category:Pages using infobox military installation with conflicting parameters}} | image_alt; alt | image2_alt; alt2 | ownership; owner | controlledby; controlled by; controlled_by | condition; status | map; image_map | map_size; image_mapsize | map_alt; image_map_alt | map_caption; image_map_caption | pushpin_map; map_type | pushpin_map_caption; map_caption | pushpin_mapsize; map_size | pushpin_relief; map_relief | coordinates_footnotes; coord_footnotes | used; dates | current_commander; commander | past_commanders; commanders | image3_alt; alt3 | nrhp; embedded; module }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> tq1sadlbf1b3jzvezwwovuo47jrnxhv 796830 796811 2026-06-06T03:07:02Z SM7 3953 कुछ लोकलाइजेशन 796830 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|{{PAGENAMEBASE}}}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| Part of {{{partof}}}}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|Near {{{nearest_town}}} }} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{if empty|{{{image_alt|}}}|{{{alt|}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{if empty|{{{image2_alt|}}}|{{{alt2|}}}}}}} | caption2 = {{{caption2|}}} | header1 = {{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|Site information}} | label2 = Type | data2 = {{{type|}}} | label3 = Code | data3 = {{{code|}}} | label4 = Owner | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = Operator | data5 = {{{operator|}}} | label6 = Controlled&nbsp;by | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = {{longitem|Open&nbsp;to the&nbsp;public}} | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|Condition|Status}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{longitem|{{if empty|{{{site_other_label|}}}|Other site<br>facilities }}}} | data9 = {{{site_other|}}} | label10 = Website | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|Location}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{if empty|{{{map|}}}|{{{image_map|}}}}}|size={{if empty|{{{map_size|}}}|{{{image_mapsize|}}}}}|sizedefault=250px|alt={{if empty|{{{map_alt|}}}|{{{image_map_alt|}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{if empty|{{{map_caption|}}}|{{{image_map_caption|}}}}}}} | data14 = {{#if:{{{pushpin_map|}}}{{{map_type|}}} |{{Location map|{{if empty|{{{pushpin_map|}}}|{{{map_type|}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{if empty|{{{pushpin_mark|}}}|Red_pog.svg }} | marksize = {{if empty|{{{pushpin_marksize|}}}|10 }} | float = center | caption = {{if empty|{{{pushpin_map_caption|}}}|{{{map_caption|}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|}}}{{{map_size|}}}|{{if empty|{{{pushpin_mapsize|}}}|{{{map_size|}}}}} | 250 }} | relief = {{if empty|{{{pushpin_relief|}}}|{{{map_relief|}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | autoWithCaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-stroke-width = 2 | mapframe-frame-width = 250 | mapframe-type = landmark | mapframe-wikidata = yes }} | label17 = अक्षांस-देशांतर | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{if empty|{{{coordinates_footnotes|}}}|{{{coord_footnotes|}}}}} }} | label18 = [[ग्रिड रिफरेंस]] | data18 = {{{gridref|}}} | label19 = रकबा | data19 = {{{site_area|}}} | label20 = फ्लोर एरिया | data20 = {{{floor_area|}}} | label21 = हाईट | data21 = {{{height|}}} | label22 = लंबाई | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | साइट के इतिहास }} | label28 = निर्माण | data28 = {{{built|}}} | label29 = निर्माण&nbsp;मकसद | data29 = {{{built_for|}}} | label30 = निर्माणकर्ता | data30 = {{{builder|}}} | label31 = आर्किटेक्ट | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = निर्माण-सामग्री | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = घटना | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|}}}{{{commanders|}}}{{{garrison|}}}{{{occupants|}}} | गैरिसन जानकारी }} | label39 = {{longitem|Current commander}} | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = {{longitem|Past commanders}} | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = निवासी | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = {{longitem|[[Subcritical]] tests}} | data45 = {{{subcritical_tests|}}} | label46 = {{longitem|[[Nuclear fission|Nuclear]] tests}} | data46 = {{{nuclear_tests|}}} | label47 = {{longitem|[[Nuclear fusion|Thermonuclear]] tests}} | data47 = {{{thermonuclear_tests|}}} | label48 = {{longitem|{{if empty|{{{other_tests_label|}}}|Other tests }}}} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{if empty|{{{image3_alt|}}}|{{{alt3|}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{longitem|{{if empty|{{{airfield_other_label|}}}|Other airfield<br>facilities }}}} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{if empty|{{{nrhp|}}}|{{{embedded|}}}|{{{module|}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{if empty|{{{name|}}}|{{PAGENAME}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}{{#invoke:Check for conflicting parameters|check | template = [[Template:Infobox military installation]] | cat = {{main other|Category:Pages using infobox military installation with conflicting parameters}} | image_alt; alt | image2_alt; alt2 | ownership; owner | controlledby; controlled by; controlled_by | condition; status | map; image_map | map_size; image_mapsize | map_alt; image_map_alt | map_caption; image_map_caption | pushpin_map; map_type | pushpin_map_caption; map_caption | pushpin_mapsize; map_size | pushpin_relief; map_relief | coordinates_footnotes; coord_footnotes | used; dates | current_commander; commander | past_commanders; commanders | image3_alt; alt3 | nrhp; embedded; module }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> e6fer81p8txw8ezy3wdgaydqs7v64ju 796831 796830 2026-06-06T03:11:01Z SM7 3953 कुछ लोकलाइजेशन 796831 wikitext text/x-wiki {{infobox | child = {{yesno|{{{embed|}}}|def=}} | bodyclass = vcard | bodystyle = {{WPMILHIST Infobox style|main_box_raw|vcard}} | abovestyle = {{WPMILHIST Infobox style|header_raw}} | labelstyle = padding-right:1em | headerstyle = {{WPMILHIST Infobox style|header_raw}} | subheaderstyle1 = {{WPMILHIST Infobox style|header_raw}}; font-weight:bold; | {{#ifeq:{{{embed|}}}|yes|subheader1|above}} = {{#if:{{{name|}}}|{{{name}}}|{{#ifeq:{{{embed|}}}|yes|<nowiki />|{{PAGENAMEBASE}}}}}}<!-- -->{{#if:{{{ensign|}}}|<div style="padding-bottom:2px">{{#invoke:InfoboxImage|InfoboxImage|image={{{ensign|}}}|size={{{ensign_size|}}}|sizedefault=90px|alt={{{ensign_alt|}}}}} {{#invoke:InfoboxImage|InfoboxImage|image={{{ensign2|}}}|size={{{ensign2_size|}}}|sizedefault=90px|alt={{{ensign2_alt|}}}}}</div>}} | subheaderstyle2 = {{WPMILHIST Infobox style|header_raw}} | subheader2 = {{br separated entries |1 = {{#if:{{{native_name|}}}|<div style="display:inline;" class="nickname">''{{{native_name|}}}''</div>}} |2 = {{#if:{{{nativename|}}}|<div style="display:inline;" class="nickname">''{{{nativename|}}}''</div>}} |3 = {{#if:{{{nativename-a|}}}|<div style="display:inline;" class="nickname">{{{nativename-a}}}</div>}} |4 = {{#if:{{{nativename-r|}}}|<div style="display:inline;" class="nickname">{{{nativename-r}}}</div>}} }} | subheaderstyle3 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader3 = {{#if:{{{partof|}}}| {{{partof}}} के हिस्सा}} | subheaderstyle4 = {{WPMILHIST Infobox style|sub_header_raw}} | subheader4 = {{#if:{{{location|}}}{{{nearest_town|}}}{{{country|}}} |<span class="label">{{br separated entries |1={{{location|}}} |2={{#if:{{{nearest_town|}}}|{{{nearest_town}}} के लगे}} }} {{#if:{{{country|}}} | {{#if:{{{location|}}}{{{nearest_town|}}}|in&nbsp;}}{{{country}}}}}</span> }} | image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|}}}|sizedefault=250px|alt={{if empty|{{{image_alt|}}}|{{{alt|}}}}}}} | caption = {{{caption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image2|}}}|size={{{image2_size|}}}|sizedefault=75px|alt={{if empty|{{{image2_alt|}}}|{{{alt2|}}}}}}} | caption2 = {{{caption2|}}} | header1 = {{#if:{{{type|}}}{{{code|}}}{{{ownership|}}}{{{owner|}}}{{{operator|}}}{{{controlledby|}}}{{{controlled by|}}}{{{controlled_by|}}}{{{open_to_public|}}}{{{condition|}}}{{{status|}}}{{{site_other|}}}{{{website|}}}|साइट जानकारी}} | label2 = प्रकार | data2 = {{{type|}}} | label3 = कोड | data3 = {{{code|}}} | label4 = मालिक | data4 = {{if empty|{{{ownership|}}}|{{{owner|}}}}} | label5 = ऑपरेटर | data5 = {{{operator|}}} | label6 = कंट्रोल | data6 = {{if empty|{{{controlledby|}}}|{{{controlled by|}}}|{{{controlled_by|}}}}} | label7 = {{longitem|Open&nbsp;to the&nbsp;public}} | data7 = {{{open_to_public|}}} | label8 = {{#if: {{{condition|}}}|कंडीशन|इस्टेटस}} | data8 = {{if empty|{{{condition|}}}|{{{status|}}}}} | label9 = {{longitem|{{if empty|{{{site_other_label|}}}|Other site<br>facilities }}}} | data9 = {{{site_other|}}} | label10 = वेबसाइट | data10 = {{{website|}}} | header11 = {{#if:{{{map|}}}{{{image_map|}}}{{{pushpin_map|}}}{{{map_type|}}}{{{mapframe|}}}{{{coordinates|}}}|लोकेशन जानकारी}} | data12 = {{#invoke:InfoboxImage|InfoboxImage|image={{if empty|{{{map|}}}|{{{image_map|}}}}}|size={{if empty|{{{map_size|}}}|{{{image_mapsize|}}}}}|sizedefault=250px|alt={{if empty|{{{map_alt|}}}|{{{image_map_alt|}}}}}}} | data13 = {{#if:{{{map|}}}{{{image_map|}}}|{{if empty|{{{map_caption|}}}|{{{image_map_caption|}}}}}}} | data14 = {{#if:{{{pushpin_map|}}}{{{map_type|}}} |{{Location map|{{if empty|{{{pushpin_map|}}}|{{{map_type|}}}}} | label = {{#ifeq: {{lc: {{{pushpin_label_position|}}} }} | none | | {{#if:{{{pushpin_label|}}}|{{{pushpin_label}}}|{{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}}} }} | alt = {{{pushpin_map_alt|}}} | coordinates = {{{coordinates|}}} | mark = {{if empty|{{{pushpin_mark|}}}|Red_pog.svg }} | marksize = {{if empty|{{{pushpin_marksize|}}}|10 }} | float = center | caption = {{if empty|{{{pushpin_map_caption|}}}|{{{map_caption|}}}}} | border = infobox | position = {{{pushpin_label_position|}}} | width = {{#if:{{{pushpin_mapsize|}}}{{{map_size|}}}|{{if empty|{{{pushpin_mapsize|}}}|{{{map_size|}}}}} | 250 }} | relief = {{if empty|{{{pushpin_relief|}}}|{{{map_relief|}}}}} | AlternativeMap = {{{pushpin_image|}}} }}}} | data15 = {{#invoke:Infobox mapframe | autoWithCaption | onByDefault = {{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{map|}}}{{{image_map|}}}{{yesno|{{{embed|}}}|def=}}|no|yes}} | mapframe-marker = observation-tower | mapframe-stroke-width = 2 | mapframe-frame-width = 250 | mapframe-type = landmark | mapframe-wikidata = yes }} | label17 = अक्षांस-देशांतर | data17 = {{#if:{{{coordinates|}}}|{{{coordinates}}} {{if empty|{{{coordinates_footnotes|}}}|{{{coord_footnotes|}}}}} }} | label18 = [[ग्रिड रिफरेंस]] | data18 = {{{gridref|}}} | label19 = रकबा | data19 = {{{site_area|}}} | label20 = फ्लोर एरिया | data20 = {{{floor_area|}}} | label21 = हाईट | data21 = {{{height|}}} | label22 = लंबाई | data22 = {{{length|}}} | header27 = {{#if:{{{built|}}}{{{built_for|}}}{{{builder|}}}{{{architect|}}}{{{used|}}}{{{dates|}}}{{{materials|}}}{{{fate|}}}{{{demolished|}}}{{{battles|}}}{{{events|}}} | साइट के इतिहास }} | label28 = निर्माण | data28 = {{{built|}}} | label29 = निर्माण&nbsp;मकसद | data29 = {{{built_for|}}} | label30 = निर्माणकर्ता | data30 = {{{builder|}}} | label31 = आर्किटेक्ट | data31 = {{{architect|}}} | label32 = In&nbsp;use | data32 = {{if empty|{{{used|}}}|{{{dates|}}}}} | label33 = निर्माण-सामग्री | data33 = {{{materials|}}} | label34 = Fate | data34 = {{{fate|}}} | label35 = Demolished | data35 = {{{demolished|}}} | label36 = Battles/wars | data36 = {{{battles|}}} | label37 = घटना | data37 = {{{events|}}} | header38 = {{#if:{{{commander|}}}{{{current_commander|}}}{{{past_commanders|}}}{{{commanders|}}}{{{garrison|}}}{{{occupants|}}} | गैरिसन जानकारी }} | label39 = {{longitem|Current commander}} | data39 = {{if empty|{{{current_commander|}}}|{{{commander|}}}}} | label40 = {{longitem|Past commanders}} | data40 = {{if empty|{{{past_commanders|}}}|{{{commanders|}}}}} | label41 = Garrison | data41 = {{{garrison|}}} | label42 = निवासी | data42 = {{{occupants|}}} | label43 = Designations | data43 = {{{designations|}}} | header44 = {{#if:{{{subcritical_tests|}}}{{{nuclear_tests|}}}{{{thermonuclear_tests|}}}{{{other_tests|}}}{{{remediation|}}} | Test information }} | label45 = {{longitem|[[Subcritical]] tests}} | data45 = {{{subcritical_tests|}}} | label46 = {{longitem|[[Nuclear fission|Nuclear]] tests}} | data46 = {{{nuclear_tests|}}} | label47 = {{longitem|[[Nuclear fusion|Thermonuclear]] tests}} | data47 = {{{thermonuclear_tests|}}} | label48 = {{longitem|{{if empty|{{{other_tests_label|}}}|Other tests }}}} | data48 = {{{other_tests|}}} | label49 = [[Environmental remediation|Remediation]] | data49 = {{{remediation|}}} <!-- image3 testing area (START) --> | data50 = {{#if:{{{image3|}}}| {{#invoke:InfoboxImage|InfoboxImage|image={{{image3|}}}|size={{{image3_size|}}}|sizedefault=250px|alt={{if empty|{{{image3_alt|}}}|{{{alt3|}}}}}}}{{#if:{{{caption3|}}}|<div>{{{caption3|}}}</div>}}}} <!-- image3 testing area (END) --> | header51 = {{#if:{{{r1-number|}}}{{{r1-length|}}}{{{r1-surface|}}}{{{h1-number|}}}{{{h1-length|}}}{{{h1-surface|}}}{{{airfield_other|}}}{{{elevation|}}}{{{IATA|}}}{{{ICAO|}}}{{{FAA|}}}{{{TC|}}}{{{LID|}}}{{{GPS|}}}{{{WMO|}}} |Airfield information}} <!-- this next bit is to display ICAO, IATA etc codes if the airfield has (any of) these --> | label52 = Identifiers | data52 = {{comma separated entries |1= {{#if:{{{IATA|}}} | [[International Air Transport Association airport code|IATA]]: {{{IATA|}}}}} |2= {{#if:{{{ICAO|}}} | [[International Civil Aviation Organization airport code|ICAO]]: {{{ICAO}}}}} |3= {{#if:{{{FAA|}}} |[[Location identifier#FAA identifier|FAA LID]]: {{{FAA}}}}} |4= {{#if:{{{TC|}}} | [[Location identifier#Transport Canada identifier|TC LID]]: {{{TC}}}}} |5= {{#if:{{{LID|}}}| [[Location identifier|LID]]: {{{LID}}}}} |6= {{#if:{{{GPS|}}}| [[Global Positioning System|GPS]]: {{{GPS}}}}} |7= {{#if:{{{WMO|}}}| [[Location identifier#WMO station identifiers|WMO]]: {{{WMO}}}}} }} | label53 = Elevation | data53 = {{#if:{{{elevation|}}} |{{{elevation}}} [[Above mean sea level|AMSL]] }} | data54 = {{#if: {{{r1-number|}}} {{{r1-length|}}} {{{r1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Runways</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0;padding:1px 2px;">[[Runway#Orientation and dimensions|Direction]]</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px;padding:1px 2px;">Length and surface</th> </tr><tr> <td style="text-align: center;">{{{r1-number|}}}</td> <td style="text-align: left;">{{{r1-length}}}&nbsp;{{{r1-surface}}}</td> </tr>{{#if:{{{r2-number|}}} {{{r2-length|}}} {{{r2-surface|}}}| <tr> <td style="text-align: center;">{{{r2-number|}}}</td> <td style="text-align: left;">{{{r2-length}}}&nbsp;{{{r2-surface}}}</td> </tr>}}{{#if:{{{r3-number|}}} {{{r3-length|}}} {{{r3-surface|}}}| <tr> <td style="text-align: center;">{{{r3-number|}}}</td> <td style="text-align: left;">{{{r3-length}}}&nbsp;{{{r3-surface}}}</td> </tr>}}{{#if:{{{r4-number|}}} {{{r4-length|}}} {{{r4-surface|}}}| <tr> <td style="text-align: center;">{{{r4-number|}}}</td> <td style="text-align: left;">{{{r4-length}}}&nbsp;{{{r4-surface}}}</td> </tr>}}{{#if:{{{r5-number|}}} {{{r5-length|}}} {{{r5-surface|}}}| <tr> <td style="text-align: center;">{{{r5-number|}}}</td> <td style="text-align: left;">{{{r5-length}}}&nbsp;{{{r5-surface}}}</td> </tr>}}{{#if:{{{r6-number|}}} {{{r6-length|}}} {{{r6-surface|}}}| <tr> <td style="text-align: center;">{{{r6-number|}}}</td> <td style="text-align: left;">{{{r6-length}}}&nbsp;{{{r6-surface}}}</td> </tr>}}{{#if:{{{r7-number|}}} {{{r7-length|}}} {{{r7-surface|}}}| <tr> <td style="text-align: center;">{{{r7-number|}}}</td> <td style="text-align: left;">{{{r7-length}}}&nbsp;{{{r7-surface}}}</td> </tr>}}{{#if:{{{r8-number|}}} {{{r8-length|}}} {{{r8-surface|}}}| <tr> <td style="text-align: center;">{{{r8-number|}}}</td> <td style="text-align: left;">{{{r8-length}}}&nbsp;{{{r8-surface}}}</td> </tr>}}{{#if:{{{r9-number|}}} {{{r9-length|}}} {{{r9-surface|}}}| <tr> <td style="text-align: center;">{{{r9-number|}}}</td> <td style="text-align: left;">{{{r9-length}}}&nbsp;{{{r9-surface}}}</td> </tr>}}</table>}} | data55 = {{#if: {{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <table style="width:100%; margin:-2px -1px -1px -1px; border-spacing:0;"> <tr style="background-color: #ddd; color:inherit;"> <th colspan=2 style="font-weight:normal; border:solid 1px #fafafa; border-width:0 0 1px 0;">Helipads</th> </tr><tr style="background-color: #ddd; color:inherit; text-align: left;"> <th scope=col style="font-weight:normal; width: 25%; border:solid 1px #fafafa; border-width:1px 1px 0 0; padding:1px 2px;">Number</th> <th scope=col style="font-weight:normal; width: 75%; border:solid 1px #fafafa; border-width:1px 0 0 1px; padding:1px 2px;">Length and surface</th> </tr> {{#if:{{{h1-number|}}} {{{h1-length|}}} {{{h1-surface|}}}| <tr> <td style="text-align: center;">{{{h1-number|}}}</td> <td style="text-align: left;">{{{h1-length}}}&nbsp;{{{h1-surface}}}</td> </tr>}} {{#if:{{{h2-number|}}} {{{h2-length|}}} {{{h2-surface|}}}| <tr> <td style="text-align: center;">{{{h2-number|}}}</td> <td style="text-align: left;">{{{h2-length}}}&nbsp;{{{h2-surface}}}</td> </tr>}} {{#if:{{{h3-number|}}} {{{h3-length|}}} {{{h3-surface|}}}| <tr> <td style="text-align: center;">{{{h3-number|}}}</td> <td style="text-align: left;">{{{h3-length}}}&nbsp;{{{h3-surface}}}</td> </tr>}} {{#if:{{{h4-number|}}} {{{h4-length|}}} {{{h4-surface|}}}| <tr> <td style="text-align: center;">{{{h4-number|}}}</td> <td style="text-align: left;">{{{h4-length}}}&nbsp;{{{h4-surface}}}</td> </tr>}} {{#if:{{{h5-number|}}} {{{h5-length|}}} {{{h5-surface|}}}| <tr> <td style="text-align: center;">{{{h5-number|}}}</td> <td style="text-align: left;">{{{h5-length}}}&nbsp;{{{h5-surface}}}</td> </tr>}} {{#if:{{{h6-number|}}} {{{h6-length|}}} {{{h6-surface|}}}| <tr> <td style="text-align: center;">{{{h6-number|}}}</td> <td style="text-align: left;">{{{h6-length}}}&nbsp;{{{h6-surface}}}</td> </tr>}}</table>}} | label56 = {{longitem|{{if empty|{{{airfield_other_label|}}}|Other airfield<br>facilities }}}} | data56 = {{{airfield_other|}}} | header57 = _BLANK_ | data58 = {{if empty|{{{nrhp|}}}|{{{embedded|}}}|{{{module|}}}}} | belowstyle = text-align: left; background-color: #eee; color:inherit; | below = {{{footnotes|}}} }}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox military installation with unknown parameters|_VALUE_{{PAGENAME}}]]}}|ignoreblank=y|mapframe_args=y|preview=Page using [[Template:Infobox military installation]] with unknown parameter "_VALUE_" | embed | name| designations| ensign| ensign_size| ensign_alt| ensign2| ensign2_size| ensign2_alt| native_name| nativename| nativename-a| nativename-r|partof| location| nearest_town| country| image| image_size| image_alt| alt| caption| image2| image2_size| image2_alt| alt2| caption2| map| image_map |map_size| image_mapsize| map_alt| image_map_alt| map_caption| image_map_caption| pushpin_map| map_type| pushpin_label_position| pushpin_label| pushpin_map_alt| pushpin_mark| pushpin_marksize| pushpin_mapsize| pushpin_relief| map_relief| pushpin_image| pushpin_map_caption| coordinates| coordinates_footnotes| gridref| type| code| site_area| height| length| ownership| owner| operator| controlledby| controlled by| controlled_by| open_to_public| condition| status| site_other| website| site_other_label| built| built_for| builder| architect| used| dates |materials| fate| demolished| battles| events| current_commander| past_commanders| garrison| occupants| subcritical_tests| nuclear_tests| thermonuclear_tests| other_tests| remediation| other_tests_label| image3| image3_size| image3_alt| alt3| caption3| r1-number| r1-length| r1-surface| h1-number| h1-length| h1-surface| airfield_other| elevation| IATA| ICAO| FAA| TC| LID| GPS| WMO| r2-number| r2-length| r2-surface| r3-number| r3-length| r3-surface| r4-number| r4-length| r4-surface| r5-number| r5-length| r5-surface| r6-number| r6-length| r6-surface| r7-number| r7-length| r7-surface| r8-number| r8-length| r8-surface| r9-number| r9-length| r9-surface| h2-number| h2-length| h2-surface| h3-number| h3-length| h3-surface| h4-number| h4-length| h4-surface| h5-number| h5-length| h5-surface| h6-number| h6-length| h6-surface| airfield_other_label| nrhp |embedded |module| footnotes }}{{#if:{{#if:{{both|{{{ownership|}}}|{{{owner|}}}}}|1}}{{#if:{{both|{{{condition|}}}|{{{status|}}}}}|1}}{{#if:{{both|{{{used|}}}|{{{dates|}}}}}|1}}|[[Category:Pages using infobox military installation with unknown parameters|Δ]] }}{{#ifeq:{{#invoke:string|replace|{{if empty|{{{name|}}}|{{PAGENAME}}}}|.* .*|CHECK|plain=false}}|CHECK|[[Category:Pages using infobox military installation with unknown parameters|Ε]] }}{{#invoke:Check for conflicting parameters|check | template = [[Template:Infobox military installation]] | cat = {{main other|Category:Pages using infobox military installation with conflicting parameters}} | image_alt; alt | image2_alt; alt2 | ownership; owner | controlledby; controlled by; controlled_by | condition; status | map; image_map | map_size; image_mapsize | map_alt; image_map_alt | map_caption; image_map_caption | pushpin_map; map_type | pushpin_map_caption; map_caption | pushpin_mapsize; map_size | pushpin_relief; map_relief | coordinates_footnotes; coord_footnotes | used; dates | current_commander; commander | past_commanders; commanders | image3_alt; alt3 | nrhp; embedded; module }}<noinclude> {{documentation}} <!-- Please add categories to the /doc subpage, not here. --> </noinclude> t2evof0pwcyqm5l0ps4enpr0hsh0oeh टेम्पलेट:Infobox military installation/doc 10 63195 796812 603090 2026-05-30T06:43:08Z en>Zackmann08 0 cleaning up 796812 wikitext text/x-wiki {{Documentation subpage}} {{highuse}} {{Lua|Module:Infobox|Module:InfoboxImage|Module:String|Module:Check for unknown parameters}} ==Usage== {{Infobox military installation | name = Loring Air Force Base | native_name = Limestone Air Force Base | partof = | nearest_town = [[Limestone, Maine|Limestone]] and [[Caswell, Maine]] | country = United States | image = Loring Air Force Base.jpg | alt = Aerial image of Loring Air Force Base, in black and white | caption = [[United States Geological Survey|USGS]] 1970 Aerial Photo | image2 = ACC Shield.svg | alt2 = Shield with a sword with wings coming out of it | caption2 = Logo of Air Combat Command | type = Air Force Base | coordinates = {{coord|46|56|59|N|67|53|20|W|type:airport_region:US-ME|display=inline}} | image_map = | image_mapsize = | image_map_alt = | image_map_caption = | pushpin_map = USA Maine#USA | pushpin_mapsize = 250 | pushpin_map_alt = | pushpin_map_caption = Shown within Maine | pushpin_relief = | pushpin_image = | pushpin_label = Loring AFB | pushpin_label_position = left | pushpin_mark = | pushpin_marksize = | mapframe = <!-- see below for more mapframe parameters --> | ownership = [[United States Air Force]] | operator = [[42d Air Base Wing|42nd Bomb Wing]] | controlledby = | site_other_label = Stations | site_other = [[Caribou Air Force Station]] (East Loring), [[Caswell Air Force Station]] | open_to_public = Yes | site_area = {{convert|9000|acre|ha sqmi|lk=on}} | code = <!--facility/installation code, applies to US --> | built = {{Start date|1947}}–1953 | used = 1950–{{End date|1994}} | builder = [[United States Army Corps of Engineers]] | materials = | height = | fate = Mainly intact, partial demolition | condition = | battles = | events = [[Cold War]] | current_commander = Robert J. Pavelko | past_commanders = <!-- past notable commander(s) --> | garrison = [[42d Air Base Wing|42nd Bomb Wing]] | occupants = [[69th Bomb Squadron|69th Bombardment Squadron]], [[70th Flying Training Squadron|70th Bombardment Squadron]], [[75th Bombardment Squadron]], [[42d Air Refueling Squadron]], [[407th Air Refueling Squadron]], [[2192nd Communications Squadron]], [[101st Intelligence Squadron|101st Fighter Squadron]] | designations = | website = <!-- begin test site information --> | subcritical_tests = | nuclear_tests = | thermonuclear_tests = | other_tests_label = <!-- changed from "Other tests" to wording of your choice --> | other_tests = | remediation = | image3 = | alt3 = | caption3 = <!-- end test site information --> <!-- begin airfield information --> | IATA = KLIZ | ICAO = LIZ | FAA = | TC = | LID = | GPS = | WMO = | elevation = {{Convert|746|ft|0}} | r1-number = 1R/19L | r1-length = {{Convert|12100|ft|0}} | r1-surface = Asphalt/Concrete | r2-number = 1L/19R | r2-length = {{Convert|12800|ft|0}} | r2-surface = Asphalt | airfield_other_label = <!-- for renaming "Other facilities" in infobox --> | airfield_other = <!-- for other sorts of airfield facilities --> <!-- end airfield information --> | footnotes = <!-- catchall in case it's needed to preserve something in infobox that doesn't work in new code --> }} A military installation infobox may be used to summarize information about a military structure or facility, such as a fortification or military base. The infobox should be added using the {{tl|Infobox military installation}} template, as shown below: <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox military installation | name = | ensign = | ensign_size = | native_name = | partof = <!-- for elements within a larger physical site --> | location = | nearest_town = <!-- formerly used in military test site infobox --> | country = | image = | alt = | caption = | image2 = <!--secondary image, major command emblems for airfields --> | alt2 = | caption2 = | coordinates = <!-- {{Coord}} --> | gridref = | type = | image_map = | image_mapsize = | image_map_alt = | image_map_caption = | pushpin_map = | pushpin_mapsize = | pushpin_map_alt = | pushpin_map_caption = | pushpin_relief = | pushpin_image = | pushpin_label = | pushpin_label_position = | pushpin_mark = | pushpin_marksize = | mapframe = <!-- see below for more mapframe parameters --> | code = <!--facility/installation code --> | site_area = <!-- area of site m2, km2 square mile etc. --> | floor_area = | height = <!-- height of tallest part, not above sea level --> | length = <!-- for border fences or other DMZs --> | ownership = <!-- government department such as the MoD or the United States DoD --> | operator = <!-- where different from ownership such as the RAF or the USAF --> | controlledby = <!-- such as RAF Bomber Command or the Eighth Air Force --> | open_to_public = <!-- for out of use sites/sites with museums etc. --> | condition = | site_other_label = <!-- for renaming "Other facilities" in infobox --> | site_other = <!-- for other sorts of facilities – radar types etc. --> | website = | built = <!-- {{Start date|YYYY}} --> | built_for = | builder = | architect = | used = <!--{{End date|1946}} --> | materials = | fate = <!--changed from demolished parameter--> | demolished = | battles = | events = | current_commander = <!-- current commander --> | past_commanders = <!-- past notable commander(s) --> | garrison = <!-- such as the 25th Bombardment Group --> | occupants = <!-- squadrons only --> | designations = | nrhp = | footnotes = <!-- catchall in case it's needed to preserve something in infobox that doesn't work in new code --> }} </syntaxhighlight> The following supplemental blocks may be copied into the template above as needed, just prior to the "footnotes" parameter. '''Test sites''' <syntaxhighlight lang="wikitext" style="overflow:auto"> <!-- begin test site information --> | subcritical_tests = | nuclear_tests = | thermonuclear_tests = | other_tests_label = <!-- changed from "Other tests" to wording of your choice --> | other_tests = | remediation = | image3 = | alt3 = | caption3 = <!-- end test site information --> </syntaxhighlight> '''Airfields''' <syntaxhighlight lang="wikitext" style="overflow:auto"> <!-- begin airfield information --> | IATA = | ICAO = | FAA = | TC = | LID = | GPS = | WMO = | elevation = <!-- {{Convert| |m|0}} --> | r1-number = | r1-length = <!-- {{Convert| |m|0}} --> | r1-surface = | h1-number = | h1-length = <!-- {{Convert| |m|0}} --> | h1-surface = | airfield_other_label = <!-- for renaming "Other facilities" in infobox --> | airfield_other = <!-- for other sorts of airfield facilities --> <!-- end airfield information --> </syntaxhighlight> ==Parameters== '''Note''': When using parameters, avoid the ambiguous abbreviation "N/A", and instead use "unknown" or "none". If a parameter is not applicable, leave it blank and it will not be displayed. All subjective or qualitative judgements and numerical quantities or statistics must be cited to a reliable source (see [[WP:MILMOS#CITE]]). * '''name''' – the name of the installation or structure, must be identical to article name. * '''ensign''' – ''optional'' – a small [[Ensign (flag)|ensign]] image used by the installation's operator. * '''ensign_size''' – ''optional'' – size for ensign image. * '''native_name''' – ''optional'' – the name of the installation in the language(s) of the country which built it, or in which it is located. * '''partof''' – ''optional'' – the larger physical complex the given installation is part of, if any. For proper grammar, it may be necessary to insert "the" before the name used here. * '''location''' – the geographical location of the installation. Not to be used alongside "nearest_town". * '''nearest_town''' - the nearest town to the installation. Not to be used alongside "location". * '''image''' – ''optional'' – an image of the installation. The image should be given in the form Example.jpg; other values can be inserted in the following parameters. * '''image_size''' – ''optional'' – width of the image in pixels (px), ''e.g.'', "150"; defaults to "220". * '''alt''' – ''optional'' – alt text for the image; see ''[[Wikipedia:Alternative text for images]]''. * '''caption''' – ''optional'' – the text to be placed below the image. * '''image2''' – ''optional'' – a second image of the installation. The image should be given in the form Example.jpg; other values can be inserted in the following parameters. * '''image2_size''' – ''optional'' – width of the second image in pixels (px), ''e.g.'', "150"; defaults to "220". * '''alt2''' – ''optional'' – alt text for the second image; see ''[[Wikipedia:Alternative text for images]]''. * '''caption2''' – ''optional'' – the text to be placed below the second image. * '''map_type''' – ''optional'' – the base map to be used for the location map, ''e.g.'', "Scotland"; see {{tl|Location map}} for more details. * '''map_relief''' – ''optional'' – set to any non-blank value to use a relief map (if available). * '''map_size''' – ''optional'' – width of the location map in pixels (px), ''e.g.'', "150"; defaults to "220". * '''map_alt''' – ''optional'' – alt text for location map; see ''[[Wikipedia:Alternative text for images]]''. * '''map_caption''' – ''optional'' – caption displayed below the location map; defaults to "Shown within {{{map_type}}}", ''e.g.'', "Shown within Scotland". * '''coordinates''' – ''optional'' – latitude and longitude for placing the marker on the location map. Use {{tl|Coord}}; see the Coord template documentation for details. * '''gridref''' – ''optional'' – map grid reference. * '''type''' – ''optional'' – the general type of installation ("Air base", "Castle", "Fortress", "Bunker", "Military base", "Wall", "Defensive line", etc.). * '''code''' – ''optional'' – the location or facility code, such as the ILC or ILK code. * '''site_area''' – ''optional'' – where relevant (e.g. for compounds), the land area of the installation. * '''floor_area''' – ''optional'' – where relevant (e.g. for buildings), the interior floor area of the installation. * '''height''' – ''optional'' – where relevant (e.g. for towers), the height of the installation. * '''length''' – ''optional'' – where relevant (e.g. for fences and DMZs), the length of the installation. * '''ownership''' – ''optional'' – the owner of the installation. * '''operator''' – ''optional'' – where different from ownership. * '''controlledby''' – ''optional'' – the organisation controlling the installation. Multiple powers may be indicated together with the corresponding dates. * '''open_to_public''' – ''optional'' – whether the installation is currently open to the general public, if relevant; indicated by "yes" or "no". * '''condition''' – ''optional'' – the current condition of the installation. * '''built''' – ''optional'' – the date when the installation was built, usually given in years. Use {{tl|start date}} if 1583 or later. * '''builder''' – ''optional'' – the person or group responsible for building the installation. * '''used''' – ''optional'' – the period during which the installation was in active military use, usually given in years. * '''materials''' – ''optional'' – the materials used to construct the installation. * '''demolished''' – ''optional'' – the date when the installation was demolished, if applicable. * '''battles''' – ''optional'' – any notable battles (usually sieges) that took place in or are closely associated with the installation; as above, the choice of which battles qualify as notable is left to the article editors. * '''events''' – ''optional'' – any notable non-battle events that took place in or are closely associated with the installation; as above, the choice of which events qualify as notable is left to the article editors. * '''current_commander''' – ''optional'' – for installations currently in military use, the current commanding officer. * '''past_commanders''' – ''optional'' – any notable individuals that commanded the forces using this installation; the choice of which commanders qualify as notable is left to the editors of a particular article. * '''garrison''' – ''optional'' – the military forces garrisoning the installation. Specific units may be indicated if known; general numbers should be given otherwise. * '''occupants''' – ''optional'' – any notable occupants of the installation other than its commanders; as above, the choice of which occupants qualify as notable is left to the article editors. * '''designations''' ''optional'' – legal heritage protection status * '''module''' – ''optional'' – to embed other templates beneath this one. * '''embed''' – ''optional'' – to embed this template into another above it. === Mapframe maps === {{Infobox mapframe/doc/parameters | onByDefault = yes, unless any of the other map parameters are present: {{para|pushpin_map}}, {{para|map_type}}, {{para|map}}, {{para|image_map}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 }} {{#ifeq:{{{noheader|}}}|yes|| ==Microformat== {{UF-hcard-geo}} == Tracking categories == * {{Category link with count|Pages using infobox military installation with unknown parameters}} * {{Category link with count|Pages using infobox military installation with conflicting parameters}} == TemplateData == {{TemplateData header}} {{collapse top|title=TemplateData}} <templatedata> { "description": "An infobox for a military structure or facility, such as a fortification or military base", "format": "{{_\n| _____________ = _\n}}\n", "params": { "name": { "label": "Name", "description": "The name of the installation or structure", "type": "string", "suggested": true }, "noheader": {}, "map_type": { "label": "Map type", "description": "the base map to be used for the location map, e.g., \"Scotland\"; see {{Location map}} for more details." }, "ensign": { "label": "Ensign", "description": "a small ensign image used by the installation's operator." }, "ensign_size": { "label": "Ensign size", "description": "size for ensign image." }, "native_name": { "label": "Native Name", "description": "The name of the installation in the language(s) of the country which built it, or in which it is located.", "type": "string" }, "partof": { "label": "Part of", "description": "The larger complex the given installation is part of, if any. For proper grammar, it may be necessary to insert \"the\" before the name used here." }, "location": { "label": "Location", "description": "The geographical location of the installation." }, "image": { "label": "Image", "description": "an image of the installation. The image should be given in the form Example.jpg; other values can be inserted in the following parameters.", "type": "wiki-file-name" }, "image_size": { "label": "Image size", "description": "width of the image in pixels (px), e.g., \"150\"; defaults to \"220\"." }, "alt": { "label": "Alt", "description": "alt text for the image; see Wikipedia:Alternative text for images." }, "caption": { "label": "Caption", "description": "the text to be placed below the image." }, "image2": { "label": "Image2", "description": "a second image of the installation. The image should be given in the form Example.jpg; other values can be inserted in the following parameters.", "type": "wiki-file-name" }, "image2_size": { "label": "Image2 size", "description": "width of the second image in pixels (px), e.g., \"150\"; defaults to \"220\"." }, "alt2": { "label": "Alt2", "description": "alt text for the second image; see Wikipedia:Alternative text for images." }, "caption2": { "label": "Caption2", "description": "the text to be placed below the second image." }, "map_relief": { "label": "Map relief", "description": "set to any non-blank value to use a relief map (if available)." }, "map_size": { "label": "Map size", "description": "width of the location map in pixels (px)", "example": "150", "type": "number", "default": "220" }, "map_alt": { "label": "Map alt", "description": "alt text for location map; see Wikipedia:Alternative text for images." }, "map_caption": { "label": "Map caption", "description": "caption displayed below the location map; defaults to \"Shown within {{{map_type}}}\", e.g., \"Shown within Scotland\"." }, "coordinates": { "label": "Coordinates", "description": "Latitude and longitude for placing the marker on the location map. Use {{Coord}}; see the Coord template documentation for details.", "example": "{{Coord|10|45|53|N|53|23|24|W|type:landmark|display=inline,title}}", "type": "string", "suggested": true }, "gridref": { "label": "Gridref", "description": "map grid reference." }, "type": { "label": "Type", "description": "The general type of installation", "example": "\"Castle\", \"Fortress\", \"Bunker\", \"Military base\", \"Wall\", \"Defensive line\", etc.", "type": "string", "suggestedvalues": [ "Castle", "Fortress", "Bunker", "Military base", "Wall", "Defensive line" ], "suggested": true }, "code": { "label": "Code", "description": "The location or facility code, such as the ILC or ILK code.", "type": "string" }, "site_area": { "label": "Site area", "description": "where relevant (e.g. for compounds), the land area of the installation." }, "floor_area": { "label": "Floor area", "description": "where relevant (e.g. for buildings), the interior floor area of the installation." }, "height": { "label": "Height", "description": "where relevant (e.g. for towers), the height of the installation." }, "length": { "label": "Length", "description": "where relevant (e.g. for fences and DMZs), the length of the installation." }, "ownership": { "label": "Ownership", "description": "The current owner of the installation, if relevant." }, "operator": { "label": "Operator", "description": "where different from ownership." }, "controlledby": { "label": "Controlled by", "description": "The country or other power controlling the installation. Multiple powers may be indicated together with the corresponding dates." }, "open_to_public": { "label": "Open to public", "description": "Whether the installation is currently open to the general public, if relevant; indicated by \"yes\" or \"no\".", "type": "string", "suggestedvalues": [ "yes", "no" ] }, "condition": { "label": "Condition", "description": "the current condition of the installation." }, "built": { "label": "Built", "description": "the date when the installation was built, usually given in years. Use {{start date}} if 1583 or later." }, "builder": { "label": "Builder", "description": "The person or group responsible for building the installation." }, "used": { "label": "Used", "description": "the period during which the installation was in active military use, usually given in years." }, "materials": { "label": "Materials", "description": "The materials used to construct the installation." }, "demolished": { "label": "Demolished", "description": "the date when the installation was demolished, if applicable." }, "battles": { "label": "Battles", "description": "any notable battles (usually sieges) that took place in or are closely associated with the installation; as above, the choice of which battles qualify as notable is left to the article editors." }, "events": { "label": "Events", "description": "any notable non-battle events that took place in or are closely associated with the installation; as above, the choice of which events qualify as notable is left to the article editors." }, "current_commander": { "label": "Current commander", "description": "for installations currently in military use, the current commanding officer." }, "past_commanders": { "label": "Past commanders", "description": "any notable individuals that commanded the forces using this installation; the choice of which commanders qualify as notable is left to the editors of a particular article." }, "garrison": { "label": "Garrison", "description": "The military forces garrisoning the installation. Specific units may be indicated if known; general numbers should be given otherwise." }, "occupants": { "label": "Occupants", "description": "any notable occupants of the installation other than its commanders; as above, the choice of which occupants qualify as notable is left to the article editors." }, "designations": { "label": "Designations", "description": "legal heritage protection status" }, "mapframe": { "label": "Show mapframe map", "description": "Specify yes or no to show or hide the map, overriding the default", "example": "yes", "type": "string", "default": "no", "suggested": true }, "mapframe-caption": { "label": "Mapframe caption", "description": "Caption for the map. If mapframe-geomask is set, then the default is \"Location in <<geomask's label>>\"", "type": "string" }, "mapframe-custom": { "label": "Custom mapframe", "description": "Use a custom map instead of the automatic mapframe. Specify either a {{maplink}} template, or another template that generates a mapframe map, or an image name. If used, other mapframe parameters will be ignored.", "type": "wiki-template-name" }, "mapframe-id": { "aliases": [ "id", "qid" ], "label": "Mapframe Wikidata item", "description": "Id (Q-number) of Wikidata item to use.", "type": "string", "default": "(item for current page)" }, "mapframe-coordinates": { "aliases": [ "mapframe-coord", "coordinates", "coord" ], "label": "Mapframe coordinates ", "description": "Coordinates to use, instead of any on Wikidata. Use the {{Coord}} template.", "example": "{{Coord|12.34|N|56.78|E}}", "type": "wiki-template-name", "default": "(coordinates from Wikidata)" }, "mapframe-wikidata": { "label": "Mapframe shapes from Wikidata", "description": "et to yes to show shape/line features from the wikidata item, if any, when coordinates are specified by parameter", "example": "yes", "type": "string" }, "mapframe-shape": { "label": "Mapframe shape feature", "description": "Override display of mapframe shape feature. Turn off by setting to \"none\". Use an inverse shape (geomask) instead of a regular shape by setting to \"inverse\"", "type": "string" }, "mapframe-point": { "label": "Mapframe point feature", "description": "Override display of mapframe point feature. Turn off display of point feature by setting to \"none\". Force point marker to be displayed by setting to \"on\"", "type": "string" }, "mapframe-geomask": { "label": "Mapframe geomask", "description": "Wikidata item to use as a geomask (everything outside the boundary is shaded darker). Can either be a specific Wikidata item (Q-number), or a property that specifies the item to use (e.g. P17 for country, or P131 for located in the administrative territorial entity)", "example": "Q100", "type": "wiki-page-name" }, "mapframe-switcher": { "label": "Mapframe switcher", "description": "Set to \"auto\" or \"geomasks\" or \"zooms\" to enable Template:Switcher-style switching between multiple mapframes. IF SET TO auto – switch geomasks found in location (P276) and located in the administrative territorial entity (P131) statements on the page's Wikidata item, searching recursively. E.g. an item's city, that city's state, and that state's country. IF SET TO geomasks – switch between the geomasks specified as a comma-separated list of Wikidata items (Q-numbers) in the mapframe-geomask parameter. IF SET TO zooms – switch between \"zoomed in\"/\"zoomed midway\"/\"zoomed out\", where \"zoomed in\" is the default zoom (with a minimum of 3), \"zoomed out\" is 1, and \"zoomed midway\" is the average.", "type": "string" }, "mapframe-frame-width": { "aliases": [ "mapframe-width" ], "label": "Mapframe width", "description": "Frame width in pixels", "type": "number", "default": "270" }, "mapframe-frame-height": { "aliases": [ "mapframe-height" ], "label": "Mapframe height", "description": "Frame height in pixels", "type": "number", "default": "200" }, "mapframe-shape-fill": { "label": "Mapframe shape fill", "description": "Color used to fill shape features", "type": "string", "default": "#606060" }, "mapframe-shape-fill-opacity": { "label": "Mapframe shape fill opacity", "description": "Opacity level of shape fill, a number between 0 and 1", "type": "number", "default": "0.5" }, "mapframe-stroke-color": { "aliases": [ "mapframe-stroke-colour" ], "label": "Mapframe stroke color", "description": "Color of line features, and outlines of shape features", "type": "string", "default": "#ff0000" }, "mapframe-stroke-width": { "label": "Mapframe stroke width", "description": "Width of line features, and outlines of shape features", "type": "number", "default": "5" }, "mapframe-marker": { "label": "Mapframe marker", "description": "Marker symbol to use for coordinates; see [[mw:Help:Extension:Kartographer/Icons]] for options", "example": "museum", "type": "string" }, "mapframe-marker-color": { "aliases": [ "mapframe-marker-colour" ], "label": "Mapframe marker color", "description": "Background color for the marker", "type": "string", "default": "#5E74F3" }, "mapframe-geomask-stroke-color": { "aliases": [ "mapframe-geomask-stroke-colour" ], "label": "Mapframe geomask stroke color", "description": "Color of outline of geomask shape", "type": "string", "default": "#555555" }, "mapframe-geomask-stroke-width": { "label": "Mapframe geomask stroke width", "description": "Width of outline of geomask shape", "type": "number", "default": "2" }, "mapframe-geomask-fill": { "label": "Mapframe geomask fill", "description": "Color used to fill outside geomask features", "type": "string", "default": "#606060" }, "mapframe-geomask-fill-opacity": { "label": "Mapframe geomask fill opacity", "description": "Opacity level of fill outside geomask features, a number between 0 and 1", "type": "number", "default": "0.5" }, "mapframe-zoom": { "label": "Mapframe zoom", "description": "Set the zoom level, from \"1\" to \"18\", to used if the zoom level cannot be determined automatically from object length or area", "example": "12", "type": "number", "default": "10" }, "mapframe-length_km": { "label": "Mapframe length (km)", "description": "Object length in kilometres, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area", "type": "number" }, "mapframe-length_mi": { "label": "Mapframe length (mi)", "description": "Object length in miles, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area", "type": "number" }, "mapframe-area_km2": { "label": "Mapframe area (km^2)", "description": "Object arean square kilometres, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area", "type": "number" }, "mapframe-area_mi2": { "label": "Mapframe area (mi^2)", "description": "Object area in square miles, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area", "type": "number" }, "mapframe-frame-coordinates": { "aliases": [ "mapframe-frame-coord" ], "label": "Mapframe frame coordinates", "description": "Alternate latitude and longitude coordinates for initial placement of map, using {{coord}}", "example": "{{Coord|12.35|N|56.71|E}}", "type": "wiki-template-name" }, "mapframe-line": {}, "module": { "label": "Module", "description": "to embed other templates beneath this one." }, "embed": { "label": "Embed", "description": "to embed this template into another above it." } }, "paramOrder": [ "name", "ensign", "ensign_size", "native_name", "partof", "location", "coordinates", "image", "image_size", "alt", "caption", "image2", "image2_size", "alt2", "caption2", "map_relief", "map_size", "map_alt", "map_caption", "gridref", "type", "code", "site_area", "floor_area", "height", "length", "ownership", "operator", "controlledby", "open_to_public", "condition", "built", "builder", "used", "materials", "demolished", "battles", "events", "current_commander", "past_commanders", "garrison", "occupants", "designations", "map_type", "mapframe", "mapframe-caption", "mapframe-custom", "mapframe-id", "mapframe-coordinates", "mapframe-wikidata", "mapframe-point", "mapframe-shape", "mapframe-frame-width", "mapframe-frame-height", "mapframe-shape-fill", "mapframe-shape-fill-opacity", "mapframe-stroke-color", "mapframe-stroke-width", "mapframe-marker", "mapframe-marker-color", "mapframe-geomask", "mapframe-geomask-stroke-color", "mapframe-geomask-stroke-width", "mapframe-geomask-fill", "mapframe-geomask-fill-opacity", "mapframe-zoom", "mapframe-length_km", "mapframe-length_mi", "mapframe-area_km2", "mapframe-area_mi2", "mapframe-frame-coordinates", "mapframe-switcher", "mapframe-line", "embed", "module", "noheader" ] } </templatedata> {{collapse bottom}} == See also == *{{tl|Infobox military unit}} {{Buildings and structures infobox templates}} }}<noinclude> [[Category:WikiProject Military history template instructions|Military installation infobox]] </noinclude><includeonly>{{Sandbox other|| {{#ifeq:{{{noheader|}}}|yes|| [[Category:Military infobox templates|Installation]] [[Category:Buildings and structures infobox templates|Military installation]] [[Category:Infobox templates with module parameter|Military installation]] [[Category:Embeddable templates]] [[Category:Templates that add a tracking category|{{PAGENAME}}]] [[Category:Templates with coordinates fields]] }} }}</includeonly> b4xa0jea2c6g6ljj52np98obq4ubru7 796813 796812 2026-06-06T02:57:34Z SM7 3953 1 revision imported from [[:en:Template:Infobox_military_installation/doc]] 796812 wikitext text/x-wiki {{Documentation subpage}} {{highuse}} {{Lua|Module:Infobox|Module:InfoboxImage|Module:String|Module:Check for unknown parameters}} ==Usage== {{Infobox military installation | name = Loring Air Force Base | native_name = Limestone Air Force Base | partof = | nearest_town = [[Limestone, Maine|Limestone]] and [[Caswell, Maine]] | country = United States | image = Loring Air Force Base.jpg | alt = Aerial image of Loring Air Force Base, in black and white | caption = [[United States Geological Survey|USGS]] 1970 Aerial Photo | image2 = ACC Shield.svg | alt2 = Shield with a sword with wings coming out of it | caption2 = Logo of Air Combat Command | type = Air Force Base | coordinates = {{coord|46|56|59|N|67|53|20|W|type:airport_region:US-ME|display=inline}} | image_map = | image_mapsize = | image_map_alt = | image_map_caption = | pushpin_map = USA Maine#USA | pushpin_mapsize = 250 | pushpin_map_alt = | pushpin_map_caption = Shown within Maine | pushpin_relief = | pushpin_image = | pushpin_label = Loring AFB | pushpin_label_position = left | pushpin_mark = | pushpin_marksize = | mapframe = <!-- see below for more mapframe parameters --> | ownership = [[United States Air Force]] | operator = [[42d Air Base Wing|42nd Bomb Wing]] | controlledby = | site_other_label = Stations | site_other = [[Caribou Air Force Station]] (East Loring), [[Caswell Air Force Station]] | open_to_public = Yes | site_area = {{convert|9000|acre|ha sqmi|lk=on}} | code = <!--facility/installation code, applies to US --> | built = {{Start date|1947}}–1953 | used = 1950–{{End date|1994}} | builder = [[United States Army Corps of Engineers]] | materials = | height = | fate = Mainly intact, partial demolition | condition = | battles = | events = [[Cold War]] | current_commander = Robert J. Pavelko | past_commanders = <!-- past notable commander(s) --> | garrison = [[42d Air Base Wing|42nd Bomb Wing]] | occupants = [[69th Bomb Squadron|69th Bombardment Squadron]], [[70th Flying Training Squadron|70th Bombardment Squadron]], [[75th Bombardment Squadron]], [[42d Air Refueling Squadron]], [[407th Air Refueling Squadron]], [[2192nd Communications Squadron]], [[101st Intelligence Squadron|101st Fighter Squadron]] | designations = | website = <!-- begin test site information --> | subcritical_tests = | nuclear_tests = | thermonuclear_tests = | other_tests_label = <!-- changed from "Other tests" to wording of your choice --> | other_tests = | remediation = | image3 = | alt3 = | caption3 = <!-- end test site information --> <!-- begin airfield information --> | IATA = KLIZ | ICAO = LIZ | FAA = | TC = | LID = | GPS = | WMO = | elevation = {{Convert|746|ft|0}} | r1-number = 1R/19L | r1-length = {{Convert|12100|ft|0}} | r1-surface = Asphalt/Concrete | r2-number = 1L/19R | r2-length = {{Convert|12800|ft|0}} | r2-surface = Asphalt | airfield_other_label = <!-- for renaming "Other facilities" in infobox --> | airfield_other = <!-- for other sorts of airfield facilities --> <!-- end airfield information --> | footnotes = <!-- catchall in case it's needed to preserve something in infobox that doesn't work in new code --> }} A military installation infobox may be used to summarize information about a military structure or facility, such as a fortification or military base. The infobox should be added using the {{tl|Infobox military installation}} template, as shown below: <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox military installation | name = | ensign = | ensign_size = | native_name = | partof = <!-- for elements within a larger physical site --> | location = | nearest_town = <!-- formerly used in military test site infobox --> | country = | image = | alt = | caption = | image2 = <!--secondary image, major command emblems for airfields --> | alt2 = | caption2 = | coordinates = <!-- {{Coord}} --> | gridref = | type = | image_map = | image_mapsize = | image_map_alt = | image_map_caption = | pushpin_map = | pushpin_mapsize = | pushpin_map_alt = | pushpin_map_caption = | pushpin_relief = | pushpin_image = | pushpin_label = | pushpin_label_position = | pushpin_mark = | pushpin_marksize = | mapframe = <!-- see below for more mapframe parameters --> | code = <!--facility/installation code --> | site_area = <!-- area of site m2, km2 square mile etc. --> | floor_area = | height = <!-- height of tallest part, not above sea level --> | length = <!-- for border fences or other DMZs --> | ownership = <!-- government department such as the MoD or the United States DoD --> | operator = <!-- where different from ownership such as the RAF or the USAF --> | controlledby = <!-- such as RAF Bomber Command or the Eighth Air Force --> | open_to_public = <!-- for out of use sites/sites with museums etc. --> | condition = | site_other_label = <!-- for renaming "Other facilities" in infobox --> | site_other = <!-- for other sorts of facilities – radar types etc. --> | website = | built = <!-- {{Start date|YYYY}} --> | built_for = | builder = | architect = | used = <!--{{End date|1946}} --> | materials = | fate = <!--changed from demolished parameter--> | demolished = | battles = | events = | current_commander = <!-- current commander --> | past_commanders = <!-- past notable commander(s) --> | garrison = <!-- such as the 25th Bombardment Group --> | occupants = <!-- squadrons only --> | designations = | nrhp = | footnotes = <!-- catchall in case it's needed to preserve something in infobox that doesn't work in new code --> }} </syntaxhighlight> The following supplemental blocks may be copied into the template above as needed, just prior to the "footnotes" parameter. '''Test sites''' <syntaxhighlight lang="wikitext" style="overflow:auto"> <!-- begin test site information --> | subcritical_tests = | nuclear_tests = | thermonuclear_tests = | other_tests_label = <!-- changed from "Other tests" to wording of your choice --> | other_tests = | remediation = | image3 = | alt3 = | caption3 = <!-- end test site information --> </syntaxhighlight> '''Airfields''' <syntaxhighlight lang="wikitext" style="overflow:auto"> <!-- begin airfield information --> | IATA = | ICAO = | FAA = | TC = | LID = | GPS = | WMO = | elevation = <!-- {{Convert| |m|0}} --> | r1-number = | r1-length = <!-- {{Convert| |m|0}} --> | r1-surface = | h1-number = | h1-length = <!-- {{Convert| |m|0}} --> | h1-surface = | airfield_other_label = <!-- for renaming "Other facilities" in infobox --> | airfield_other = <!-- for other sorts of airfield facilities --> <!-- end airfield information --> </syntaxhighlight> ==Parameters== '''Note''': When using parameters, avoid the ambiguous abbreviation "N/A", and instead use "unknown" or "none". If a parameter is not applicable, leave it blank and it will not be displayed. All subjective or qualitative judgements and numerical quantities or statistics must be cited to a reliable source (see [[WP:MILMOS#CITE]]). * '''name''' – the name of the installation or structure, must be identical to article name. * '''ensign''' – ''optional'' – a small [[Ensign (flag)|ensign]] image used by the installation's operator. * '''ensign_size''' – ''optional'' – size for ensign image. * '''native_name''' – ''optional'' – the name of the installation in the language(s) of the country which built it, or in which it is located. * '''partof''' – ''optional'' – the larger physical complex the given installation is part of, if any. For proper grammar, it may be necessary to insert "the" before the name used here. * '''location''' – the geographical location of the installation. Not to be used alongside "nearest_town". * '''nearest_town''' - the nearest town to the installation. Not to be used alongside "location". * '''image''' – ''optional'' – an image of the installation. The image should be given in the form Example.jpg; other values can be inserted in the following parameters. * '''image_size''' – ''optional'' – width of the image in pixels (px), ''e.g.'', "150"; defaults to "220". * '''alt''' – ''optional'' – alt text for the image; see ''[[Wikipedia:Alternative text for images]]''. * '''caption''' – ''optional'' – the text to be placed below the image. * '''image2''' – ''optional'' – a second image of the installation. The image should be given in the form Example.jpg; other values can be inserted in the following parameters. * '''image2_size''' – ''optional'' – width of the second image in pixels (px), ''e.g.'', "150"; defaults to "220". * '''alt2''' – ''optional'' – alt text for the second image; see ''[[Wikipedia:Alternative text for images]]''. * '''caption2''' – ''optional'' – the text to be placed below the second image. * '''map_type''' – ''optional'' – the base map to be used for the location map, ''e.g.'', "Scotland"; see {{tl|Location map}} for more details. * '''map_relief''' – ''optional'' – set to any non-blank value to use a relief map (if available). * '''map_size''' – ''optional'' – width of the location map in pixels (px), ''e.g.'', "150"; defaults to "220". * '''map_alt''' – ''optional'' – alt text for location map; see ''[[Wikipedia:Alternative text for images]]''. * '''map_caption''' – ''optional'' – caption displayed below the location map; defaults to "Shown within {{{map_type}}}", ''e.g.'', "Shown within Scotland". * '''coordinates''' – ''optional'' – latitude and longitude for placing the marker on the location map. Use {{tl|Coord}}; see the Coord template documentation for details. * '''gridref''' – ''optional'' – map grid reference. * '''type''' – ''optional'' – the general type of installation ("Air base", "Castle", "Fortress", "Bunker", "Military base", "Wall", "Defensive line", etc.). * '''code''' – ''optional'' – the location or facility code, such as the ILC or ILK code. * '''site_area''' – ''optional'' – where relevant (e.g. for compounds), the land area of the installation. * '''floor_area''' – ''optional'' – where relevant (e.g. for buildings), the interior floor area of the installation. * '''height''' – ''optional'' – where relevant (e.g. for towers), the height of the installation. * '''length''' – ''optional'' – where relevant (e.g. for fences and DMZs), the length of the installation. * '''ownership''' – ''optional'' – the owner of the installation. * '''operator''' – ''optional'' – where different from ownership. * '''controlledby''' – ''optional'' – the organisation controlling the installation. Multiple powers may be indicated together with the corresponding dates. * '''open_to_public''' – ''optional'' – whether the installation is currently open to the general public, if relevant; indicated by "yes" or "no". * '''condition''' – ''optional'' – the current condition of the installation. * '''built''' – ''optional'' – the date when the installation was built, usually given in years. Use {{tl|start date}} if 1583 or later. * '''builder''' – ''optional'' – the person or group responsible for building the installation. * '''used''' – ''optional'' – the period during which the installation was in active military use, usually given in years. * '''materials''' – ''optional'' – the materials used to construct the installation. * '''demolished''' – ''optional'' – the date when the installation was demolished, if applicable. * '''battles''' – ''optional'' – any notable battles (usually sieges) that took place in or are closely associated with the installation; as above, the choice of which battles qualify as notable is left to the article editors. * '''events''' – ''optional'' – any notable non-battle events that took place in or are closely associated with the installation; as above, the choice of which events qualify as notable is left to the article editors. * '''current_commander''' – ''optional'' – for installations currently in military use, the current commanding officer. * '''past_commanders''' – ''optional'' – any notable individuals that commanded the forces using this installation; the choice of which commanders qualify as notable is left to the editors of a particular article. * '''garrison''' – ''optional'' – the military forces garrisoning the installation. Specific units may be indicated if known; general numbers should be given otherwise. * '''occupants''' – ''optional'' – any notable occupants of the installation other than its commanders; as above, the choice of which occupants qualify as notable is left to the article editors. * '''designations''' ''optional'' – legal heritage protection status * '''module''' – ''optional'' – to embed other templates beneath this one. * '''embed''' – ''optional'' – to embed this template into another above it. === Mapframe maps === {{Infobox mapframe/doc/parameters | onByDefault = yes, unless any of the other map parameters are present: {{para|pushpin_map}}, {{para|map_type}}, {{para|map}}, {{para|image_map}} | mapframe-marker = observation-tower | mapframe-frame-width = 250 }} {{#ifeq:{{{noheader|}}}|yes|| ==Microformat== {{UF-hcard-geo}} == Tracking categories == * {{Category link with count|Pages using infobox military installation with unknown parameters}} * {{Category link with count|Pages using infobox military installation with conflicting parameters}} == TemplateData == {{TemplateData header}} {{collapse top|title=TemplateData}} <templatedata> { "description": "An infobox for a military structure or facility, such as a fortification or military base", "format": "{{_\n| _____________ = _\n}}\n", "params": { "name": { "label": "Name", "description": "The name of the installation or structure", "type": "string", "suggested": true }, "noheader": {}, "map_type": { "label": "Map type", "description": "the base map to be used for the location map, e.g., \"Scotland\"; see {{Location map}} for more details." }, "ensign": { "label": "Ensign", "description": "a small ensign image used by the installation's operator." }, "ensign_size": { "label": "Ensign size", "description": "size for ensign image." }, "native_name": { "label": "Native Name", "description": "The name of the installation in the language(s) of the country which built it, or in which it is located.", "type": "string" }, "partof": { "label": "Part of", "description": "The larger complex the given installation is part of, if any. For proper grammar, it may be necessary to insert \"the\" before the name used here." }, "location": { "label": "Location", "description": "The geographical location of the installation." }, "image": { "label": "Image", "description": "an image of the installation. The image should be given in the form Example.jpg; other values can be inserted in the following parameters.", "type": "wiki-file-name" }, "image_size": { "label": "Image size", "description": "width of the image in pixels (px), e.g., \"150\"; defaults to \"220\"." }, "alt": { "label": "Alt", "description": "alt text for the image; see Wikipedia:Alternative text for images." }, "caption": { "label": "Caption", "description": "the text to be placed below the image." }, "image2": { "label": "Image2", "description": "a second image of the installation. The image should be given in the form Example.jpg; other values can be inserted in the following parameters.", "type": "wiki-file-name" }, "image2_size": { "label": "Image2 size", "description": "width of the second image in pixels (px), e.g., \"150\"; defaults to \"220\"." }, "alt2": { "label": "Alt2", "description": "alt text for the second image; see Wikipedia:Alternative text for images." }, "caption2": { "label": "Caption2", "description": "the text to be placed below the second image." }, "map_relief": { "label": "Map relief", "description": "set to any non-blank value to use a relief map (if available)." }, "map_size": { "label": "Map size", "description": "width of the location map in pixels (px)", "example": "150", "type": "number", "default": "220" }, "map_alt": { "label": "Map alt", "description": "alt text for location map; see Wikipedia:Alternative text for images." }, "map_caption": { "label": "Map caption", "description": "caption displayed below the location map; defaults to \"Shown within {{{map_type}}}\", e.g., \"Shown within Scotland\"." }, "coordinates": { "label": "Coordinates", "description": "Latitude and longitude for placing the marker on the location map. Use {{Coord}}; see the Coord template documentation for details.", "example": "{{Coord|10|45|53|N|53|23|24|W|type:landmark|display=inline,title}}", "type": "string", "suggested": true }, "gridref": { "label": "Gridref", "description": "map grid reference." }, "type": { "label": "Type", "description": "The general type of installation", "example": "\"Castle\", \"Fortress\", \"Bunker\", \"Military base\", \"Wall\", \"Defensive line\", etc.", "type": "string", "suggestedvalues": [ "Castle", "Fortress", "Bunker", "Military base", "Wall", "Defensive line" ], "suggested": true }, "code": { "label": "Code", "description": "The location or facility code, such as the ILC or ILK code.", "type": "string" }, "site_area": { "label": "Site area", "description": "where relevant (e.g. for compounds), the land area of the installation." }, "floor_area": { "label": "Floor area", "description": "where relevant (e.g. for buildings), the interior floor area of the installation." }, "height": { "label": "Height", "description": "where relevant (e.g. for towers), the height of the installation." }, "length": { "label": "Length", "description": "where relevant (e.g. for fences and DMZs), the length of the installation." }, "ownership": { "label": "Ownership", "description": "The current owner of the installation, if relevant." }, "operator": { "label": "Operator", "description": "where different from ownership." }, "controlledby": { "label": "Controlled by", "description": "The country or other power controlling the installation. Multiple powers may be indicated together with the corresponding dates." }, "open_to_public": { "label": "Open to public", "description": "Whether the installation is currently open to the general public, if relevant; indicated by \"yes\" or \"no\".", "type": "string", "suggestedvalues": [ "yes", "no" ] }, "condition": { "label": "Condition", "description": "the current condition of the installation." }, "built": { "label": "Built", "description": "the date when the installation was built, usually given in years. Use {{start date}} if 1583 or later." }, "builder": { "label": "Builder", "description": "The person or group responsible for building the installation." }, "used": { "label": "Used", "description": "the period during which the installation was in active military use, usually given in years." }, "materials": { "label": "Materials", "description": "The materials used to construct the installation." }, "demolished": { "label": "Demolished", "description": "the date when the installation was demolished, if applicable." }, "battles": { "label": "Battles", "description": "any notable battles (usually sieges) that took place in or are closely associated with the installation; as above, the choice of which battles qualify as notable is left to the article editors." }, "events": { "label": "Events", "description": "any notable non-battle events that took place in or are closely associated with the installation; as above, the choice of which events qualify as notable is left to the article editors." }, "current_commander": { "label": "Current commander", "description": "for installations currently in military use, the current commanding officer." }, "past_commanders": { "label": "Past commanders", "description": "any notable individuals that commanded the forces using this installation; the choice of which commanders qualify as notable is left to the editors of a particular article." }, "garrison": { "label": "Garrison", "description": "The military forces garrisoning the installation. Specific units may be indicated if known; general numbers should be given otherwise." }, "occupants": { "label": "Occupants", "description": "any notable occupants of the installation other than its commanders; as above, the choice of which occupants qualify as notable is left to the article editors." }, "designations": { "label": "Designations", "description": "legal heritage protection status" }, "mapframe": { "label": "Show mapframe map", "description": "Specify yes or no to show or hide the map, overriding the default", "example": "yes", "type": "string", "default": "no", "suggested": true }, "mapframe-caption": { "label": "Mapframe caption", "description": "Caption for the map. If mapframe-geomask is set, then the default is \"Location in <<geomask's label>>\"", "type": "string" }, "mapframe-custom": { "label": "Custom mapframe", "description": "Use a custom map instead of the automatic mapframe. Specify either a {{maplink}} template, or another template that generates a mapframe map, or an image name. If used, other mapframe parameters will be ignored.", "type": "wiki-template-name" }, "mapframe-id": { "aliases": [ "id", "qid" ], "label": "Mapframe Wikidata item", "description": "Id (Q-number) of Wikidata item to use.", "type": "string", "default": "(item for current page)" }, "mapframe-coordinates": { "aliases": [ "mapframe-coord", "coordinates", "coord" ], "label": "Mapframe coordinates ", "description": "Coordinates to use, instead of any on Wikidata. Use the {{Coord}} template.", "example": "{{Coord|12.34|N|56.78|E}}", "type": "wiki-template-name", "default": "(coordinates from Wikidata)" }, "mapframe-wikidata": { "label": "Mapframe shapes from Wikidata", "description": "et to yes to show shape/line features from the wikidata item, if any, when coordinates are specified by parameter", "example": "yes", "type": "string" }, "mapframe-shape": { "label": "Mapframe shape feature", "description": "Override display of mapframe shape feature. Turn off by setting to \"none\". Use an inverse shape (geomask) instead of a regular shape by setting to \"inverse\"", "type": "string" }, "mapframe-point": { "label": "Mapframe point feature", "description": "Override display of mapframe point feature. Turn off display of point feature by setting to \"none\". Force point marker to be displayed by setting to \"on\"", "type": "string" }, "mapframe-geomask": { "label": "Mapframe geomask", "description": "Wikidata item to use as a geomask (everything outside the boundary is shaded darker). Can either be a specific Wikidata item (Q-number), or a property that specifies the item to use (e.g. P17 for country, or P131 for located in the administrative territorial entity)", "example": "Q100", "type": "wiki-page-name" }, "mapframe-switcher": { "label": "Mapframe switcher", "description": "Set to \"auto\" or \"geomasks\" or \"zooms\" to enable Template:Switcher-style switching between multiple mapframes. IF SET TO auto – switch geomasks found in location (P276) and located in the administrative territorial entity (P131) statements on the page's Wikidata item, searching recursively. E.g. an item's city, that city's state, and that state's country. IF SET TO geomasks – switch between the geomasks specified as a comma-separated list of Wikidata items (Q-numbers) in the mapframe-geomask parameter. IF SET TO zooms – switch between \"zoomed in\"/\"zoomed midway\"/\"zoomed out\", where \"zoomed in\" is the default zoom (with a minimum of 3), \"zoomed out\" is 1, and \"zoomed midway\" is the average.", "type": "string" }, "mapframe-frame-width": { "aliases": [ "mapframe-width" ], "label": "Mapframe width", "description": "Frame width in pixels", "type": "number", "default": "270" }, "mapframe-frame-height": { "aliases": [ "mapframe-height" ], "label": "Mapframe height", "description": "Frame height in pixels", "type": "number", "default": "200" }, "mapframe-shape-fill": { "label": "Mapframe shape fill", "description": "Color used to fill shape features", "type": "string", "default": "#606060" }, "mapframe-shape-fill-opacity": { "label": "Mapframe shape fill opacity", "description": "Opacity level of shape fill, a number between 0 and 1", "type": "number", "default": "0.5" }, "mapframe-stroke-color": { "aliases": [ "mapframe-stroke-colour" ], "label": "Mapframe stroke color", "description": "Color of line features, and outlines of shape features", "type": "string", "default": "#ff0000" }, "mapframe-stroke-width": { "label": "Mapframe stroke width", "description": "Width of line features, and outlines of shape features", "type": "number", "default": "5" }, "mapframe-marker": { "label": "Mapframe marker", "description": "Marker symbol to use for coordinates; see [[mw:Help:Extension:Kartographer/Icons]] for options", "example": "museum", "type": "string" }, "mapframe-marker-color": { "aliases": [ "mapframe-marker-colour" ], "label": "Mapframe marker color", "description": "Background color for the marker", "type": "string", "default": "#5E74F3" }, "mapframe-geomask-stroke-color": { "aliases": [ "mapframe-geomask-stroke-colour" ], "label": "Mapframe geomask stroke color", "description": "Color of outline of geomask shape", "type": "string", "default": "#555555" }, "mapframe-geomask-stroke-width": { "label": "Mapframe geomask stroke width", "description": "Width of outline of geomask shape", "type": "number", "default": "2" }, "mapframe-geomask-fill": { "label": "Mapframe geomask fill", "description": "Color used to fill outside geomask features", "type": "string", "default": "#606060" }, "mapframe-geomask-fill-opacity": { "label": "Mapframe geomask fill opacity", "description": "Opacity level of fill outside geomask features, a number between 0 and 1", "type": "number", "default": "0.5" }, "mapframe-zoom": { "label": "Mapframe zoom", "description": "Set the zoom level, from \"1\" to \"18\", to used if the zoom level cannot be determined automatically from object length or area", "example": "12", "type": "number", "default": "10" }, "mapframe-length_km": { "label": "Mapframe length (km)", "description": "Object length in kilometres, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area", "type": "number" }, "mapframe-length_mi": { "label": "Mapframe length (mi)", "description": "Object length in miles, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area", "type": "number" }, "mapframe-area_km2": { "label": "Mapframe area (km^2)", "description": "Object arean square kilometres, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area", "type": "number" }, "mapframe-area_mi2": { "label": "Mapframe area (mi^2)", "description": "Object area in square miles, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area", "type": "number" }, "mapframe-frame-coordinates": { "aliases": [ "mapframe-frame-coord" ], "label": "Mapframe frame coordinates", "description": "Alternate latitude and longitude coordinates for initial placement of map, using {{coord}}", "example": "{{Coord|12.35|N|56.71|E}}", "type": "wiki-template-name" }, "mapframe-line": {}, "module": { "label": "Module", "description": "to embed other templates beneath this one." }, "embed": { "label": "Embed", "description": "to embed this template into another above it." } }, "paramOrder": [ "name", "ensign", "ensign_size", "native_name", "partof", "location", "coordinates", "image", "image_size", "alt", "caption", "image2", "image2_size", "alt2", "caption2", "map_relief", "map_size", "map_alt", "map_caption", "gridref", "type", "code", "site_area", "floor_area", "height", "length", "ownership", "operator", "controlledby", "open_to_public", "condition", "built", "builder", "used", "materials", "demolished", "battles", "events", "current_commander", "past_commanders", "garrison", "occupants", "designations", "map_type", "mapframe", "mapframe-caption", "mapframe-custom", "mapframe-id", "mapframe-coordinates", "mapframe-wikidata", "mapframe-point", "mapframe-shape", "mapframe-frame-width", "mapframe-frame-height", "mapframe-shape-fill", "mapframe-shape-fill-opacity", "mapframe-stroke-color", "mapframe-stroke-width", "mapframe-marker", "mapframe-marker-color", "mapframe-geomask", "mapframe-geomask-stroke-color", "mapframe-geomask-stroke-width", "mapframe-geomask-fill", "mapframe-geomask-fill-opacity", "mapframe-zoom", "mapframe-length_km", "mapframe-length_mi", "mapframe-area_km2", "mapframe-area_mi2", "mapframe-frame-coordinates", "mapframe-switcher", "mapframe-line", "embed", "module", "noheader" ] } </templatedata> {{collapse bottom}} == See also == *{{tl|Infobox military unit}} {{Buildings and structures infobox templates}} }}<noinclude> [[Category:WikiProject Military history template instructions|Military installation infobox]] </noinclude><includeonly>{{Sandbox other|| {{#ifeq:{{{noheader|}}}|yes|| [[Category:Military infobox templates|Installation]] [[Category:Buildings and structures infobox templates|Military installation]] [[Category:Infobox templates with module parameter|Military installation]] [[Category:Embeddable templates]] [[Category:Templates that add a tracking category|{{PAGENAME}}]] [[Category:Templates with coordinates fields]] }} }}</includeonly> b4xa0jea2c6g6ljj52np98obq4ubru7 Module:Lang/documentor tool 828 63507 796667 605884 2019-01-24T21:24:24Z en>MusikAnimal 0 Protected "[[Module:Lang/documentor tool]]": [[Wikipedia:High-risk templates|High-risk module]] ([Edit=Require autoconfirmed or confirmed access] (indefinite)) 605883 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end return p; 3beveozwregpkqpjohorhu1fh037hkv 796668 796667 2019-08-11T02:20:30Z en>Vozhuo 0 missing 796668 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end return p; 7ao1mqae8giy4su530j45se41yffdi0 796669 796668 2019-11-24T19:05:33Z en>Trappist the monk 0 796669 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- this function implements most of {{Non-English-language source category}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}} - where {{{1|}}} is language code ]] function p.non_en_src_cat (frame) local lang_name = require ('Module:Lang')._name_from_tag (frame.args[1]); -- get language name from language code in cat name via Module:lang local out = {}; -- bits of the output go here table.insert (out, 'This is a tracking category for articles that use '); -- static text table.insert (out, frame:preprocess ('{{tlx|in lang|' .. frame.args[1] .. '}}')); -- necessary? or do it all at return? table.insert (out, ' to identify '); -- more static text if lang_name:find ('languages') then -- is a language collective? table.insert (out, '[[' .. lang_name .. ']]' .. '-collective'); -- say so else table.insert (out, '[[' .. lang_name .. ' language|' .. lang_name .. ']]-language'); end table.insert (out, ' sources.'); -- last bit of static text local cat_art = mw.title.new ('Category:Articles containing ' .. lang_name .. '-language text').exists; local cat_with = mw.title.new ('Category:Articles with ' .. lang_name .. '-language external links').exists; -- TODO: delete this because the cat will go away when {{xx icon}} templates replaced local cat_cs1 = mw.title.new ('Category:CS1 ' .. lang_name .. '-language sources (' .. frame .. ')').exists; if cat_art or cat_with or cat_cs1 then table.insert (out, '\n\n==See also=='); -- start see also section if cat_art then table.insert (out, '\n*[[:Category:Articles containing ' .. lang_name .. '-language text]]'); end if cat_with then table.insert (out, '\n*[[:Category:Articles with ' .. lang_name .. '-language external links]]'); -- TODO: delete this because the cat will go away end if cat_cs1 then table.insert (out, '\n*[[:Category:CS1 ' .. lang_name .. '-language sources (' .. frame .. ')]]'); end end return table.concat (out); end return p; 8xrvluh0m7tc77avfl5nnn5kcgsbi14 796670 796669 2019-11-24T19:11:02Z en>Trappist the monk 0 796670 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- this function implements most of {{Non-English-language source category}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}} - where {{{1|}}} is language code ]] function p.non_en_src_cat (frame) local lang_name = require ('Module:Lang')._name_from_tag (frame.args[1]); -- get language name from language code in cat name via Module:lang local out = {}; -- bits of the output go here table.insert (out, 'This is a tracking category for articles that use '); -- static text table.insert (out, frame:preprocess ('{{tlx|in lang|' .. frame.args[1] .. '}}')); -- necessary? or do it all at return? table.insert (out, ' to identify '); -- more static text if lang_name:find ('languages') then -- is a language collective? table.insert (out, '[[' .. lang_name .. ']]' .. '-collective'); -- say so else table.insert (out, '[[' .. lang_name .. ' language|' .. lang_name .. ']]-language'); end table.insert (out, ' sources.'); -- last bit of static text --[=[ local cat_art = mw.title.new ('Category:Articles containing ' .. lang_name .. '-language text').exists; local cat_with = mw.title.new ('Category:Articles with ' .. lang_name .. '-language external links').exists; -- TODO: delete this because the cat will go away when {{xx icon}} templates replaced local cat_cs1 = mw.title.new ('Category:CS1 ' .. lang_name .. '-language sources (' .. frame .. ')').exists; if cat_art or cat_with or cat_cs1 then table.insert (out, '\n\n==See also=='); -- start see also section if cat_art then table.insert (out, '\n*[[:Category:Articles containing ' .. lang_name .. '-language text]]'); end if cat_with then table.insert (out, '\n*[[:Category:Articles with ' .. lang_name .. '-language external links]]'); -- TODO: delete this because the cat will go away end if cat_cs1 then table.insert (out, '\n*[[:Category:CS1 ' .. lang_name .. '-language sources (' .. frame .. ')]]'); end end]=] return table.concat (out); end return p; q1m4nbvi2wsh99epu6bpkn2jir4ifxk 796671 796670 2019-11-24T19:13:13Z en>Trappist the monk 0 796671 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- this function implements most of {{Non-English-language source category}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}} - where {{{1|}}} is language code ]] function p.non_en_src_cat (frame) local lang_name = require ('Module:Lang')._name_from_tag (frame.args); -- get language name from language code in cat name via Module:lang local out = {}; -- bits of the output go here table.insert (out, 'This is a tracking category for articles that use '); -- static text table.insert (out, frame:preprocess ('{{tlx|in lang|' .. frame.args[1] .. '}}')); -- necessary? or do it all at return? table.insert (out, ' to identify '); -- more static text if lang_name:find ('languages') then -- is a language collective? table.insert (out, '[[' .. lang_name .. ']]' .. '-collective'); -- say so else table.insert (out, '[[' .. lang_name .. ' language|' .. lang_name .. ']]-language'); end table.insert (out, ' sources.'); -- last bit of static text --[=[ local cat_art = mw.title.new ('Category:Articles containing ' .. lang_name .. '-language text').exists; local cat_with = mw.title.new ('Category:Articles with ' .. lang_name .. '-language external links').exists; -- TODO: delete this because the cat will go away when {{xx icon}} templates replaced local cat_cs1 = mw.title.new ('Category:CS1 ' .. lang_name .. '-language sources (' .. frame .. ')').exists; if cat_art or cat_with or cat_cs1 then table.insert (out, '\n\n==See also=='); -- start see also section if cat_art then table.insert (out, '\n*[[:Category:Articles containing ' .. lang_name .. '-language text]]'); end if cat_with then table.insert (out, '\n*[[:Category:Articles with ' .. lang_name .. '-language external links]]'); -- TODO: delete this because the cat will go away end if cat_cs1 then table.insert (out, '\n*[[:Category:CS1 ' .. lang_name .. '-language sources (' .. frame .. ')]]'); end end]=] return table.concat (out); end return p; 4ndswkznek4e9nmhe41pok1dhvns1r5 796672 796671 2019-11-24T19:13:43Z en>Trappist the monk 0 796672 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- this function implements most of {{Non-English-language source category}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}} - where {{{1|}}} is language code ]] function p.non_en_src_cat (frame) local lang_name = require ('Module:Lang')._name_from_tag (frame.args); -- get language name from language code in cat name via Module:lang local out = {}; -- bits of the output go here table.insert (out, 'This is a tracking category for articles that use '); -- static text table.insert (out, frame:preprocess ('{{tlx|in lang|' .. frame.args[1] .. '}}')); -- necessary? or do it all at return? table.insert (out, ' to identify '); -- more static text if lang_name:find ('languages') then -- is a language collective? table.insert (out, '[[' .. lang_name .. ']]' .. '-collective'); -- say so else table.insert (out, '[[' .. lang_name .. ' language|' .. lang_name .. ']]-language'); end table.insert (out, ' sources.'); -- last bit of static text local cat_art = mw.title.new ('Category:Articles containing ' .. lang_name .. '-language text').exists; local cat_with = mw.title.new ('Category:Articles with ' .. lang_name .. '-language external links').exists; -- TODO: delete this because the cat will go away when {{xx icon}} templates replaced local cat_cs1 = mw.title.new ('Category:CS1 ' .. lang_name .. '-language sources (' .. frame .. ')').exists; if cat_art or cat_with or cat_cs1 then table.insert (out, '\n\n==See also=='); -- start see also section if cat_art then table.insert (out, '\n*[[:Category:Articles containing ' .. lang_name .. '-language text]]'); end if cat_with then table.insert (out, '\n*[[:Category:Articles with ' .. lang_name .. '-language external links]]'); -- TODO: delete this because the cat will go away end if cat_cs1 then table.insert (out, '\n*[[:Category:CS1 ' .. lang_name .. '-language sources (' .. frame .. ')]]'); end end return table.concat (out); end return p; 9hs1unitp99dfd2xdb0qfqzb28242di 796673 796672 2019-11-24T19:14:25Z en>Trappist the monk 0 796673 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- this function implements most of {{Non-English-language source category}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}} - where {{{1|}}} is language code ]] function p.non_en_src_cat (frame) local lang_name = require ('Module:Lang')._name_from_tag (frame.args); -- get language name from language code in cat name via Module:lang local out = {}; -- bits of the output go here table.insert (out, 'This is a tracking category for articles that use '); -- static text table.insert (out, frame:preprocess ('{{tlx|in lang|' .. frame.args[1] .. '}}')); -- necessary? or do it all at return? table.insert (out, ' to identify '); -- more static text if lang_name:find ('languages') then -- is a language collective? table.insert (out, '[[' .. lang_name .. ']]' .. '-collective'); -- say so else table.insert (out, '[[' .. lang_name .. ' language|' .. lang_name .. ']]-language'); end table.insert (out, ' sources.'); -- last bit of static text local cat_art = mw.title.new ('Category:Articles containing ' .. lang_name .. '-language text').exists; local cat_with = mw.title.new ('Category:Articles with ' .. lang_name .. '-language external links').exists; -- TODO: delete this because the cat will go away when {{xx icon}} templates replaced local cat_cs1 = mw.title.new ('Category:CS1 ' .. lang_name .. '-language sources (' .. frame.args[1] .. ')').exists; if cat_art or cat_with or cat_cs1 then table.insert (out, '\n\n==See also=='); -- start see also section if cat_art then table.insert (out, '\n*[[:Category:Articles containing ' .. lang_name .. '-language text]]'); end if cat_with then table.insert (out, '\n*[[:Category:Articles with ' .. lang_name .. '-language external links]]'); -- TODO: delete this because the cat will go away end if cat_cs1 then table.insert (out, '\n*[[:Category:CS1 ' .. lang_name .. '-language sources (' .. frame .. ')]]'); end end return table.concat (out); end return p; gd3b63ngdghrefm56mux729vf0edzqv 796674 796673 2019-11-24T19:16:23Z en>Trappist the monk 0 796674 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- this function implements most of {{Non-English-language source category}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}} - where {{{1|}}} is language code ]] function p.non_en_src_cat (frame) local lang_name = require ('Module:Lang')._name_from_tag (frame.args); -- get language name from language code in cat name via Module:lang local out = {}; -- bits of the output go here table.insert (out, 'This is a tracking category for articles that use '); -- static text table.insert (out, frame:preprocess ('{{tlx|in lang|' .. frame.args[1] .. '}}')); -- preprocess table.insert (out, ' to identify '); -- more static text if lang_name:find ('languages') then -- is a language collective? table.insert (out, '[[' .. lang_name .. ']]' .. '-collective'); -- say so else table.insert (out, '[[' .. lang_name .. ' language|' .. lang_name .. ']]-language'); end table.insert (out, ' sources.'); -- last bit of static text local cat_art = mw.title.new ('Category:Articles containing ' .. lang_name .. '-language text').exists; local cat_with = mw.title.new ('Category:Articles with ' .. lang_name .. '-language external links').exists; -- TODO: delete this because the cat will go away when {{xx icon}} templates replaced local cat_cs1 = mw.title.new ('Category:CS1 ' .. lang_name .. '-language sources (' .. frame.args[1] .. ')').exists; if cat_art or cat_with or cat_cs1 then table.insert (out, '\n\n==See also=='); -- start see also section if cat_art then table.insert (out, '\n*[[:Category:Articles containing ' .. lang_name .. '-language text]]'); end if cat_with then table.insert (out, '\n*[[:Category:Articles with ' .. lang_name .. '-language external links]]'); -- TODO: delete this because the cat will go away end if cat_cs1 then table.insert (out, '\n*[[:Category:CS1 ' .. lang_name .. '-language sources (' .. frame.args[1] .. ')]]'); end end return table.concat (out); end return p; 87r51lpca96pdykc6y1i0zi9b4v3y1m 796675 796674 2019-11-24T19:22:32Z en>Trappist the monk 0 796675 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- this function implements most of {{Non-English-language source category}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}} - where {{{1|}}} is language code ]] function p.non_en_src_cat (frame) local lang_code = frame.args[1]; local lang_name = require ('Module:Lang')._name_from_tag ({lang_code}); -- get language name from language code in cat name via Module:lang local out = {}; -- bits of the output go here table.insert (out, 'This is a tracking category for articles that use '); -- static text table.insert (out, frame:preprocess ('{{tlx|in lang|' .. lang_code .. '}}')); -- preprocess table.insert (out, ' to identify '); -- more static text if lang_name:find ('languages') then -- is a language collective? table.insert (out, '[[' .. lang_name .. ']]' .. '-collective'); -- say so else table.insert (out, '[[' .. lang_name .. ' language|' .. lang_name .. ']]-language'); end table.insert (out, ' sources.'); -- last bit of static text local cat_art = mw.title.new ('Category:Articles containing ' .. lang_name .. '-language text').exists; local cat_with = mw.title.new ('Category:Articles with ' .. lang_name .. '-language external links').exists; -- TODO: delete this because the cat will go away when {{xx icon}} templates replaced local cat_cs1 = mw.title.new ('Category:CS1 ' .. lang_name .. '-language sources (' .. lang_code .. ')').exists; if cat_art or cat_with or cat_cs1 then table.insert (out, '\n\n==See also=='); -- start see also section if cat_art then table.insert (out, '\n*[[:Category:Articles containing ' .. lang_name .. '-language text]]'); end if cat_with then table.insert (out, '\n*[[:Category:Articles with ' .. lang_name .. '-language external links]]'); -- TODO: delete this because the cat will go away end if cat_cs1 then table.insert (out, '\n*[[:Category:CS1 ' .. lang_name .. '-language sources (' .. lang_code .. ')]]'); end end table.insert ('[[Category:Articles_with_non-English-language_sources|' .. lang_code .. ']]') -- and categorize this category; language code sortkey return table.concat (out); -- string it all together and done end return p; 9tq9xmqwzya6x4hh3jeojdh94y05lk2 796676 796675 2019-11-24T19:23:05Z en>Trappist the monk 0 796676 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- this function implements most of {{Non-English-language source category}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}} - where {{{1|}}} is language code ]] function p.non_en_src_cat (frame) local lang_code = frame.args[1]; local lang_name = require ('Module:Lang')._name_from_tag ({lang_code}); -- get language name from language code in cat name via Module:lang local out = {}; -- bits of the output go here table.insert (out, 'This is a tracking category for articles that use '); -- static text table.insert (out, frame:preprocess ('{{tlx|in lang|' .. lang_code .. '}}')); -- preprocess table.insert (out, ' to identify '); -- more static text if lang_name:find ('languages') then -- is a language collective? table.insert (out, '[[' .. lang_name .. ']]' .. '-collective'); -- say so else table.insert (out, '[[' .. lang_name .. ' language|' .. lang_name .. ']]-language'); end table.insert (out, ' sources.'); -- last bit of static text local cat_art = mw.title.new ('Category:Articles containing ' .. lang_name .. '-language text').exists; local cat_with = mw.title.new ('Category:Articles with ' .. lang_name .. '-language external links').exists; -- TODO: delete this because the cat will go away when {{xx icon}} templates replaced local cat_cs1 = mw.title.new ('Category:CS1 ' .. lang_name .. '-language sources (' .. lang_code .. ')').exists; if cat_art or cat_with or cat_cs1 then table.insert (out, '\n\n==See also=='); -- start see also section if cat_art then table.insert (out, '\n*[[:Category:Articles containing ' .. lang_name .. '-language text]]'); end if cat_with then table.insert (out, '\n*[[:Category:Articles with ' .. lang_name .. '-language external links]]'); -- TODO: delete this because the cat will go away end if cat_cs1 then table.insert (out, '\n*[[:Category:CS1 ' .. lang_name .. '-language sources (' .. lang_code .. ')]]'); end end table.insert (out, '[[Category:Articles_with_non-English-language_sources|' .. lang_code .. ']]') -- and categorize this category; language code sortkey return table.concat (out); -- string it all together and done end return p; t6cdv1cp0ziiz3urffc651qooe1ql78 796677 796676 2019-11-24T19:28:11Z en>Trappist the monk 0 796677 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- this function implements most of {{Non-English-language source category}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}} - where {{{1|}}} is language code ]] function p.non_en_src_cat (frame) local lang_code = frame.args[1]match ('%(([%a%-]+)%)'); -- frame.args[1] is category page name; extract language code from that local lang_name = require ('Module:Lang')._name_from_tag ({lang_code}); -- get language name from language code in cat name via Module:lang local out = {}; -- bits of the output go here table.insert (out, 'This is a tracking category for articles that use '); -- static text table.insert (out, frame:preprocess ('{{tlx|in lang|' .. lang_code .. '}}')); -- preprocess table.insert (out, ' to identify '); -- more static text if lang_name:find ('languages') then -- is a language collective? table.insert (out, '[[' .. lang_name .. ']]' .. '-collective'); -- say so else table.insert (out, '[[' .. lang_name .. ' language|' .. lang_name .. ']]-language'); end table.insert (out, ' sources.'); -- last bit of static text local cat_art = mw.title.new ('Category:Articles containing ' .. lang_name .. '-language text').exists; local cat_with = mw.title.new ('Category:Articles with ' .. lang_name .. '-language external links').exists; -- TODO: delete this because the cat will go away when {{xx icon}} templates replaced local cat_cs1 = mw.title.new ('Category:CS1 ' .. lang_name .. '-language sources (' .. lang_code .. ')').exists; if cat_art or cat_with or cat_cs1 then table.insert (out, '\n\n==See also=='); -- start see also section if cat_art then table.insert (out, '\n*[[:Category:Articles containing ' .. lang_name .. '-language text]]'); end if cat_with then table.insert (out, '\n*[[:Category:Articles with ' .. lang_name .. '-language external links]]'); -- TODO: delete this because the cat will go away end if cat_cs1 then table.insert (out, '\n*[[:Category:CS1 ' .. lang_name .. '-language sources (' .. lang_code .. ')]]'); end end table.insert (out, '[[Category:Articles_with_non-English-language_sources|' .. lang_code .. ']]') -- and categorize this category; language code sortkey return table.concat (out); -- string it all together and done end return p; 2vi92iu98gep0gm86huayh0pttt9eno 796678 796677 2019-11-24T19:28:47Z en>Trappist the monk 0 796678 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- this function implements most of {{Non-English-language source category}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}} - where {{{1|}}} is language code ]] function p.non_en_src_cat (frame) local lang_code = frame.args[1]:match ('%(([%a%-]+)%)'); -- frame.args[1] is category page name; extract language code from that local lang_name = require ('Module:Lang')._name_from_tag ({lang_code}); -- get language name from language code in cat name via Module:lang local out = {}; -- bits of the output go here table.insert (out, 'This is a tracking category for articles that use '); -- static text table.insert (out, frame:preprocess ('{{tlx|in lang|' .. lang_code .. '}}')); -- preprocess table.insert (out, ' to identify '); -- more static text if lang_name:find ('languages') then -- is a language collective? table.insert (out, '[[' .. lang_name .. ']]' .. '-collective'); -- say so else table.insert (out, '[[' .. lang_name .. ' language|' .. lang_name .. ']]-language'); end table.insert (out, ' sources.'); -- last bit of static text local cat_art = mw.title.new ('Category:Articles containing ' .. lang_name .. '-language text').exists; local cat_with = mw.title.new ('Category:Articles with ' .. lang_name .. '-language external links').exists; -- TODO: delete this because the cat will go away when {{xx icon}} templates replaced local cat_cs1 = mw.title.new ('Category:CS1 ' .. lang_name .. '-language sources (' .. lang_code .. ')').exists; if cat_art or cat_with or cat_cs1 then table.insert (out, '\n\n==See also=='); -- start see also section if cat_art then table.insert (out, '\n*[[:Category:Articles containing ' .. lang_name .. '-language text]]'); end if cat_with then table.insert (out, '\n*[[:Category:Articles with ' .. lang_name .. '-language external links]]'); -- TODO: delete this because the cat will go away end if cat_cs1 then table.insert (out, '\n*[[:Category:CS1 ' .. lang_name .. '-language sources (' .. lang_code .. ')]]'); end end table.insert (out, '[[Category:Articles_with_non-English-language_sources|' .. lang_code .. ']]') -- and categorize this category; language code sortkey return table.concat (out); -- string it all together and done end return p; s6sgoahvgk115iwo8cej2kafie7kfrj 796679 796678 2020-09-19T16:56:16Z en>Gonnym 0 sync from sandbox 796679 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages" } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "%s is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]]." } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} table.insert(top_section, frame:expandTemplate{title = 'Hidden category'}) if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- {{#invoke:Lang/documentor tool|non_en_src_cat|}} This function implements {{Non-English-language source category}}. ]] local language_source_category_text = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["LANGUAGE_COLLECTIVE"] = "[[%s]]-collective", ["LANGUAGE_NON_COLLECTIVE"] = '[[%s language|%s]]-language' } local function non_en_src_cat(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link -- Is a language collective? if language_name:find('languages') then language_link = string.format(language_source_category_text["LANGUAGE_COLLECTIVE"], language_name) else language_link = string.format(language_source_category_text["LANGUAGE_NON_COLLECTIVE"], language_name, language_name) end local text = string.format(language_source_category_text["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, "[[Category:Articles with non-English-language sources]]") return table.concat(layout, "\n\n") .. bottom end --[[--------------------------< A R T I C L E S _ C O N T A I N I N G . . . >---------------------------------- {{#invoke:Lang/documentor tool|articles_containing_category_text|}} This function implements {{Category articles containing non-English-language text}}. ]] local articles_containing_category_text = { ["LINE1"] = "This category contains articles with [[%s language|%s-language]]%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here" } local function articles_containing_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if string.find(page_title_modified, "languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find ('Articles with text from ') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(articles_containing_category_text["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(articles_containing_category_text["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text table.insert(layout, string.format(articles_containing_category_text["LINE1"], language_name, language_name, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(articles_containing_category_text["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(articles_containing_category_text["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(articles_containing_category_text["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, "[[Category:Articles containing non-English-language text]]") return table.concat(layout, "\n\n") .. bottom end --[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------ ]] return { articles_containing_language_text_category = articles_containing_language_text_category, lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_en_src_cat = non_en_src_cat, } 942qcmv23ao2uusyovjy2aob3tlsa06 796680 796679 2020-09-19T17:35:01Z en>Gonnym 0 bugfix 796680 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages" } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "%s is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]]." } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} table.insert(top_section, frame:expandTemplate{title = 'Hidden category'}) if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- {{#invoke:Lang/documentor tool|non_en_src_cat|}} This function implements {{Non-English-language source category}}. ]] local language_source_category_text = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["LANGUAGE_COLLECTIVE"] = "[[%s]]-collective", ["LANGUAGE_NON_COLLECTIVE"] = '[[%s language|%s]]-language' } local function non_en_src_cat(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link -- Is a language collective? if language_name:find('languages') then language_link = string.format(language_source_category_text["LANGUAGE_COLLECTIVE"], language_name) else language_link = string.format(language_source_category_text["LANGUAGE_NON_COLLECTIVE"], language_name, language_name) end local text = string.format(language_source_category_text["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, "[[Category:Articles with non-English-language sources]]") return table.concat(layout, "\n\n") .. bottom end --[[--------------------------< A R T I C L E S _ C O N T A I N I N G . . . >---------------------------------- {{#invoke:Lang/documentor tool|articles_containing_category_text|}} This function implements {{Category articles containing non-English-language text}}. ]] local articles_containing_category_text = { ["LINE1"] = "This category contains articles with [[%s language|%s-language]]%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here" } local function articles_containing_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" local suffix if string.find(page_title_modified, "languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find ('Articles with text from ') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) suffix = " languages" else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local full_language_tag_name = language_name if suffix then full_language_tag_name = language_name .. suffix end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({full_language_tag_name}) local layout = {} local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(articles_containing_category_text["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(articles_containing_category_text["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text table.insert(layout, string.format(articles_containing_category_text["LINE1"], language_name, language_name, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(articles_containing_category_text["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(articles_containing_category_text["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(articles_containing_category_text["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, "[[Category:Articles containing non-English-language text]]") return table.concat(layout, "\n\n") .. bottom end --[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------ ]] return { articles_containing_language_text_category = articles_containing_language_text_category, lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_en_src_cat = non_en_src_cat, } prc425egpa6hk8pqsle1pn5p4grtt0j 796681 796680 2020-09-20T08:15:36Z en>Gonnym 0 796681 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages" } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "%s is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]]." } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} table.insert(top_section, frame:expandTemplate{title = 'Hidden category'}) if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- {{#invoke:Lang/documentor tool|non_en_src_cat|}} This function implements {{Non-English-language source category}}. ]] local language_source_category_text = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["LANGUAGE_COLLECTIVE"] = "[[%s]]-collective", ["LANGUAGE_NON_COLLECTIVE"] = '[[%s language|%s]]-language' } local function non_en_src_cat(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link -- Is a language collective? if language_name:find('languages') then language_link = string.format(language_source_category_text["LANGUAGE_COLLECTIVE"], language_name) else language_link = string.format(language_source_category_text["LANGUAGE_NON_COLLECTIVE"], language_name, language_name) end local text = string.format(language_source_category_text["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, "[[Category:Articles with non-English-language sources]]") return table.concat(layout, "\n\n") .. bottom end --[[--------------------------< A R T I C L E S _ C O N T A I N I N G . . . >---------------------------------- {{#invoke:Lang/documentor tool|articles_containing_category_text|}} This function implements {{Category articles containing non-English-language text}}. ]] local articles_containing_category_text = { ["LINE1"] = "This category contains articles with [[%s language|%s-language]]%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here" } local function articles_containing_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" local suffix if string.find(page_title_modified, "languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find ('Articles with text from ') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) suffix = " languages" else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local full_language_tag_name = language_name if suffix then full_language_tag_name = language_name .. suffix end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({full_language_tag_name}) local layout = {} local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(articles_containing_category_text["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(articles_containing_category_text["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text table.insert(layout, string.format(articles_containing_category_text["LINE1"], language_name, language_name, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(articles_containing_category_text["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(articles_containing_category_text["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(articles_containing_category_text["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, "[[Category:Articles containing non-English-language text]]") return table.concat(layout, "\n\n") .. bottom end --[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------ ]] return { articles_containing_language_text_category = articles_containing_language_text_category, lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_en_src_cat = non_en_src_cat, } pks9rhdeiur4mdhiqzhur7esizvmah7 796682 796681 2020-09-21T07:19:13Z en>Gonnym 0 linked name in error 796682 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages" } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]]." } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} table.insert(top_section, frame:expandTemplate{title = 'Hidden category'}) if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[--------------------------< N O N _ E N _ S R C _ C A T >-------------------------------------------------- {{#invoke:Lang/documentor tool|non_en_src_cat|}} This function implements {{Non-English-language source category}}. ]] local language_source_category_text = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["LANGUAGE_COLLECTIVE"] = "[[%s]]-collective", ["LANGUAGE_NON_COLLECTIVE"] = '[[%s language|%s]]-language' } local function non_en_src_cat(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link -- Is a language collective? if language_name:find('languages') then language_link = string.format(language_source_category_text["LANGUAGE_COLLECTIVE"], language_name) else language_link = string.format(language_source_category_text["LANGUAGE_NON_COLLECTIVE"], language_name, language_name) end local text = string.format(language_source_category_text["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, "[[Category:Articles with non-English-language sources]]") return table.concat(layout, "\n\n") .. bottom end --[[--------------------------< A R T I C L E S _ C O N T A I N I N G . . . >---------------------------------- {{#invoke:Lang/documentor tool|articles_containing_category_text|}} This function implements {{Category articles containing non-English-language text}}. ]] local articles_containing_category_text = { ["LINE1"] = "This category contains articles with [[%s language|%s-language]]%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here" } local function articles_containing_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" local suffix if string.find(page_title_modified, "languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find ('Articles with text from ') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) suffix = " languages" else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local full_language_tag_name = language_name if suffix then full_language_tag_name = language_name .. suffix end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({full_language_tag_name}) local layout = {} local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(articles_containing_category_text["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(articles_containing_category_text["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text table.insert(layout, string.format(articles_containing_category_text["LINE1"], language_name, language_name, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(articles_containing_category_text["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(articles_containing_category_text["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(articles_containing_category_text["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, "[[Category:Articles containing non-English-language text]]") return table.concat(layout, "\n\n") .. bottom end --[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------ ]] return { articles_containing_language_text_category = articles_containing_language_text_category, lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_en_src_cat = non_en_src_cat, } qt9qz3z8fejso7umucog9c1mi4c8iar 796683 796682 2020-09-22T10:33:47Z en>Gonnym 0 Various updates and improvements; Added /testcases code; Added initial support for non_english_language_cs1_sources_category 796683 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} table.insert(top_section, frame:expandTemplate{title = 'Hidden category'}) if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with [[%s language|%s-language]]%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" local suffix if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local full_language_tag_name = language_name if suffix then full_language_tag_name = language_name .. suffix end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({full_language_tag_name}) local layout = {} local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_name, language_name, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["LANGUAGE_COLLECTIVE"] = "[[%s]]-collective", ["LANGUAGE_NON_COLLECTIVE"] = '[[%s language|%s]]-language', ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link -- Is a language collective? if language_name:find('languages') then language_link = string.format(non_english_language_sources_text_strings["LANGUAGE_COLLECTIVE"], language_name) else language_link = string.format(non_english_language_sources_text_strings["LANGUAGE_NON_COLLECTIVE"], language_name, language_name) end local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< S H A R E D _ T E S T C A S E S _ C O D E >------------------------- Functions: - get_unordered_list(language_list, list_modification, range) - get_unordered_language_list_general(language_list, list_modification, range) - get_unordered_language_list_variations(language_list) ]] local function get_unordered_language_list_general(language_list, list_modification, range) local unordered_table = {} for language_code in pairs(language_list) do if list_modification == "range" then if language_code:find(range) then table.insert(unordered_table, language_code) end elseif list_modification == "length" then if string.len(language_code) == 2 then table.insert(unordered_table, language_code) end else table.insert(unordered_table, language_code) end end return unordered_table end -- If placed inside get_unordered_language_list_general() the testcasts error: "Lua error: not enough memory". local function get_unordered_language_list_variations(language_list) local unordered_table = {} for language_code, values in pairs(language_list) do for _, language_prefix in pairs(values.prefixes) do table.insert(unordered_table, language_prefix .. "-" .. language_code) end end return unordered_table end local function get_unordered_list(language_list, list_modification, range) if list_modification == "variants" then return get_unordered_language_list_variations(language_list) else return get_unordered_language_list_general(language_list, list_modification, range) end end local function get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) for _, language_name in pairs(language_list[language_code]) do table.insert(unordered_table, language_name) reverse_table[language_name] = language_code end end local function get_unordered_language_list_general_with_reverse_list(language_list, list_modification, range) local unordered_table = {} local reverse_table = {} for language_code in pairs(language_list) do if list_modification == "range" then if language_code:find(range) then get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end elseif list_modification == "length" then if string.len(language_code) == 2 then get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end else get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end return unordered_table, reverse_table end local function get_unordered_language_list_variations_with_reverse_list(language_list) local unordered_table = {} local reverse_table = {} for language_code, values in pairs(language_list) do for _, language_name in pairs(values.descriptions) do table.insert(unordered_table, language_name) if #values.prefixes > 0 then for _, language_prefix in pairs(values.prefixes) do reverse_table[language_name] = language_prefix .. "-" .. language_code end else reverse_table[language_name] = language_code end end end return unordered_table, reverse_table end local function get_unordered_and_reverse_lists(language_list, list_modification, range) if list_modification == "variants" then return get_unordered_language_list_variations_with_reverse_list(language_list) else return get_unordered_language_list_general_with_reverse_list(language_list, list_modification, range) end end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. ]] local function testcases_category_from_tag(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '{{#invoke:Lang|category_from_tag|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} local override_table = require("Module:Lang/data").override table.sort(unordered_table) for _, key in ipairs(unordered_table) do local override_lang_table = override_table[key] if override_lang_table then table.insert(ordered_table, {key, override_lang_table[1]}) elseif args.list_modification == "variants" then local language_prefix, language_code = key:match("([^,]+)-([^,]+)") table.insert(ordered_table, {key, args.language_list[language_code].descriptions[1]}) else table.insert(ordered_table, {key, args.language_list[key][1]}) end end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, articles_containing_language_text_category = non_english_language_text_category, non_en_src_cat = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, testcases_iso_code_to_name = testcases_iso_code_to_name, } eg8oa2t00qz52n7tc2t4eevxwmo2vrd 796684 796683 2020-09-22T10:35:29Z en>Gonnym 0 changing entry function name 796684 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} table.insert(top_section, frame:expandTemplate{title = 'Hidden category'}) if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with [[%s language|%s-language]]%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" local suffix if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local full_language_tag_name = language_name if suffix then full_language_tag_name = language_name .. suffix end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({full_language_tag_name}) local layout = {} local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_name, language_name, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["LANGUAGE_COLLECTIVE"] = "[[%s]]-collective", ["LANGUAGE_NON_COLLECTIVE"] = '[[%s language|%s]]-language', ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link -- Is a language collective? if language_name:find('languages') then language_link = string.format(non_english_language_sources_text_strings["LANGUAGE_COLLECTIVE"], language_name) else language_link = string.format(non_english_language_sources_text_strings["LANGUAGE_NON_COLLECTIVE"], language_name, language_name) end local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< S H A R E D _ T E S T C A S E S _ C O D E >------------------------- Functions: - get_unordered_list(language_list, list_modification, range) - get_unordered_language_list_general(language_list, list_modification, range) - get_unordered_language_list_variations(language_list) ]] local function get_unordered_language_list_general(language_list, list_modification, range) local unordered_table = {} for language_code in pairs(language_list) do if list_modification == "range" then if language_code:find(range) then table.insert(unordered_table, language_code) end elseif list_modification == "length" then if string.len(language_code) == 2 then table.insert(unordered_table, language_code) end else table.insert(unordered_table, language_code) end end return unordered_table end -- If placed inside get_unordered_language_list_general() the testcasts error: "Lua error: not enough memory". local function get_unordered_language_list_variations(language_list) local unordered_table = {} for language_code, values in pairs(language_list) do for _, language_prefix in pairs(values.prefixes) do table.insert(unordered_table, language_prefix .. "-" .. language_code) end end return unordered_table end local function get_unordered_list(language_list, list_modification, range) if list_modification == "variants" then return get_unordered_language_list_variations(language_list) else return get_unordered_language_list_general(language_list, list_modification, range) end end local function get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) for _, language_name in pairs(language_list[language_code]) do table.insert(unordered_table, language_name) reverse_table[language_name] = language_code end end local function get_unordered_language_list_general_with_reverse_list(language_list, list_modification, range) local unordered_table = {} local reverse_table = {} for language_code in pairs(language_list) do if list_modification == "range" then if language_code:find(range) then get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end elseif list_modification == "length" then if string.len(language_code) == 2 then get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end else get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end return unordered_table, reverse_table end local function get_unordered_language_list_variations_with_reverse_list(language_list) local unordered_table = {} local reverse_table = {} for language_code, values in pairs(language_list) do for _, language_name in pairs(values.descriptions) do table.insert(unordered_table, language_name) if #values.prefixes > 0 then for _, language_prefix in pairs(values.prefixes) do reverse_table[language_name] = language_prefix .. "-" .. language_code end else reverse_table[language_name] = language_code end end end return unordered_table, reverse_table end local function get_unordered_and_reverse_lists(language_list, list_modification, range) if list_modification == "variants" then return get_unordered_language_list_variations_with_reverse_list(language_list) else return get_unordered_language_list_general_with_reverse_list(language_list, list_modification, range) end end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. ]] local function testcases_category_from_tag(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '{{#invoke:Lang|category_from_tag|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} local override_table = require("Module:Lang/data").override table.sort(unordered_table) for _, key in ipairs(unordered_table) do local override_lang_table = override_table[key] if override_lang_table then table.insert(ordered_table, {key, override_lang_table[1]}) elseif args.list_modification == "variants" then local language_prefix, language_code = key:match("([^,]+)-([^,]+)") table.insert(ordered_table, {key, args.language_list[language_code].descriptions[1]}) else table.insert(ordered_table, {key, args.language_list[key][1]}) end end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, testcases_iso_code_to_name = testcases_iso_code_to_name, } 6avfh97x6uawllteslknfju35tndayw 796685 796684 2020-09-24T10:44:38Z en>Gonnym 0 796685 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} table.insert(top_section, frame:expandTemplate{title = 'Hidden category'}) if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with [[%s language|%s-language]]%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" local suffix if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local full_language_tag_name = language_name if suffix then full_language_tag_name = language_name .. suffix end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({full_language_tag_name}) local layout = {} local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_name, language_name, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["LANGUAGE_COLLECTIVE"] = "[[%s]]-collective", ["LANGUAGE_NON_COLLECTIVE"] = '[[%s language|%s]]-language', ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link -- Is a language collective? if language_name:find('languages') then language_link = string.format(non_english_language_sources_text_strings["LANGUAGE_COLLECTIVE"], language_name) else language_link = string.format(non_english_language_sources_text_strings["LANGUAGE_NON_COLLECTIVE"], language_name, language_name) end local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< S H A R E D _ T E S T C A S E S _ C O D E >------------------------- Functions: - get_unordered_list(language_list, list_modification, range) - get_unordered_language_list_general(language_list, list_modification, range) - get_unordered_language_list_variations(language_list) ]] local function get_unordered_language_list_general(language_list, list_modification, range) local unordered_table = {} for language_code in pairs(language_list) do if list_modification == "range" then if language_code:find(range) then table.insert(unordered_table, language_code) end elseif list_modification == "length" then if string.len(language_code) == 2 then table.insert(unordered_table, language_code) end else table.insert(unordered_table, language_code) end end return unordered_table end -- If placed inside get_unordered_language_list_general() the testcasts error: "Lua error: not enough memory". local function get_unordered_language_list_variations(language_list) local unordered_table = {} for language_code, values in pairs(language_list) do for _, language_prefix in pairs(values.prefixes) do table.insert(unordered_table, language_prefix .. "-" .. language_code) end end return unordered_table end local function get_unordered_list(language_list, list_modification, range) if list_modification == "variants" then return get_unordered_language_list_variations(language_list) else return get_unordered_language_list_general(language_list, list_modification, range) end end local function get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) for _, language_name in pairs(language_list[language_code]) do table.insert(unordered_table, language_name) reverse_table[language_name] = language_code end end local function get_unordered_language_list_general_with_reverse_list(language_list, list_modification, range) local unordered_table = {} local reverse_table = {} for language_code in pairs(language_list) do if list_modification == "range" then if language_code:find(range) then get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end elseif list_modification == "length" then if string.len(language_code) == 2 then get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end else get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end return unordered_table, reverse_table end local function get_unordered_language_list_variations_with_reverse_list(language_list) local unordered_table = {} local reverse_table = {} for language_code, values in pairs(language_list) do for _, language_name in pairs(values.descriptions) do table.insert(unordered_table, language_name) if #values.prefixes > 0 then for _, language_prefix in pairs(values.prefixes) do reverse_table[language_name] = language_prefix .. "-" .. language_code end else reverse_table[language_name] = language_code end end end return unordered_table, reverse_table end local function get_unordered_and_reverse_lists(language_list, list_modification, range) if list_modification == "variants" then return get_unordered_language_list_variations_with_reverse_list(language_list) else return get_unordered_language_list_general_with_reverse_list(language_list, list_modification, range) end end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. ]] local function testcases_category_from_tag(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '{{#invoke:Lang|category_from_tag|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} local override_table = require("Module:Lang/data").override table.sort(unordered_table) for _, key in ipairs(unordered_table) do local override_lang_table = override_table[key] if override_lang_table then table.insert(ordered_table, {key, override_lang_table[1]}) elseif args.list_modification == "variants" then local language_prefix, language_code = key:match("([^,]+)-([^,]+)") table.insert(ordered_table, {key, args.language_list[language_code].descriptions[1]}) else table.insert(ordered_table, {key, args.language_list[key][1]}) end end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, testcases_iso_code_to_name = testcases_iso_code_to_name, } kg6978j2avz72l57zgvixe0pj5w83nu 796686 796685 2020-09-26T00:04:57Z en>Gonnym 0 update language link in template documentation; removed unneeded tests 796686 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} table.insert(top_section, frame:expandTemplate{title = 'Hidden category'}) if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" local suffix local collective_language if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) suffix = " languages" collective_language = true elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local full_language_tag_name = language_name if suffix then full_language_tag_name = language_name .. suffix end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({full_language_tag_name}) local layout = {} local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link if collective_language then language_link = lang_module.name_from_tag({language_code, link = "yes"}) else language_link = lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local lang_module = require('Module:Lang') local language_link -- Is a language collective? if language_name:find('languages') then language_link = lang_module.name_from_tag({language_code, link = "yes"}) else language_link = lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< S H A R E D _ T E S T C A S E S _ C O D E >------------------------- Functions: - get_unordered_list(language_list, list_modification, range) - get_unordered_language_list_general(language_list, list_modification, range) - get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) ]] local function get_unordered_list(language_list, list_modification, range) local unordered_table = {} if list_modification == "range" then for language_code in pairs(language_list) do if language_code:find(range) then table.insert(unordered_table, language_code) end end elseif list_modification == "length" then for language_code in pairs(language_list) do if language_code:len() == 2 then table.insert(unordered_table, language_code) end end else for language_code in pairs(language_list) do table.insert(unordered_table, language_code) end end return unordered_table end local function get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) for _, language_name in pairs(language_list[language_code]) do table.insert(unordered_table, language_name) reverse_table[language_name] = language_code end end local function get_unordered_and_reverse_lists(language_list, list_modification, range) local unordered_table = {} local reverse_table = {} local override_table = require("Module:Lang/data/sandbox").override -- TODO: switch to live if list_modification == "range" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if language_code:find(range) then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end elseif list_modification == "length" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if 2 == language_code:len() then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end else for language_code in pairs(language_list) do get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end return unordered_table, reverse_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} ]] local function comp_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end local function testcases_category_from_tag(self, args) local cat_from_tag = require("Module:Lang")._category_from_tag -- use Module:Lang to create the 'expected results' local test_patterns = {} -- collect test patterns here local filter_function if args.code_mask then filter_function = function(language_code, code_mask) return language_code:find(code_mask) end -- if code within limits (three-character codes) else filter_function = function(language_code, code_mask) return language_code:len() == 2 end -- no limits for two-character codes end for language_code in pairs(args.language_list) do -- list of names not needed here local pattern = {} -- here we assemble the test pattern for <code> - if filter_function(language_code, args.code_mask) then table.insert(pattern, language_code) -- add it to the pattern table.insert(pattern, cat_from_tag({language_code})) -- call Module:Lang and add the 'expected results' for code to pattern table.insert(test_patterns, pattern) -- accumulate in list of patterns end end table.sort(test_patterns, comp_by_keys) -- make the list pretty self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', test_patterns, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_list = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(args.language_list) do if args.code_mask then if language_code:find(args.code_mask) then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end else if language_code:len() == 2 then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end end end local unordered_table = get_unordered_list(undabbed_language_list, args.list_modification, args.range) local ordered_table = {} local override_table = require("Module:Lang/data").override table.sort(unordered_table) for _, key in ipairs(unordered_table) do local override_lang_table = override_table[key] if override_lang_table then table.insert(ordered_table, {key, override_lang_table[1]}) else table.insert(ordered_table, {key, undabbed_language_list[key]}) end end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, testcases_iso_code_to_name = testcases_iso_code_to_name, } jp36y2txkro27vl5l6782bayblrogk1 796687 796686 2020-09-26T16:20:36Z en>Gonnym 0 added testcases_iso_name_to_code 796687 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code, is_collective_language) local lang_module = require('Module:Lang') -- Is a language collective? if is_collective_language or language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} table.insert(top_section, frame:expandTemplate{title = 'Hidden category'}) if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" local suffix local is_collective_language if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) suffix = " languages" is_collective_language = true elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local full_language_tag_name = language_name if suffix then full_language_tag_name = language_name .. suffix end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({full_language_tag_name}) local layout = {} local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code, is_collective_language) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code, nil) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< S H A R E D _ T E S T C A S E S _ C O D E >------------------------- Functions: - get_unordered_list(language_list, list_modification, range) - get_unordered_language_list_general(language_list, list_modification, range) - get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) ]] local function get_unordered_list(language_list, list_modification, range) local unordered_table = {} if list_modification == "range" then for language_code in pairs(language_list) do if language_code:find(range) then table.insert(unordered_table, language_code) end end elseif list_modification == "length" then for language_code in pairs(language_list) do if language_code:len() == 2 then table.insert(unordered_table, language_code) end end else for language_code in pairs(language_list) do table.insert(unordered_table, language_code) end end return unordered_table end local function get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) for _, language_name in pairs(language_list[language_code]) do table.insert(unordered_table, language_name) reverse_table[language_name] = language_code end end local function get_unordered_and_reverse_lists(language_list, list_modification, range) local unordered_table = {} local reverse_table = {} local override_table = require("Module:Lang/data/sandbox").override -- TODO: switch to live if list_modification == "range" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if language_code:find(range) then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end elseif list_modification == "length" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if 2 == language_code:len() then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end else for language_code in pairs(language_list) do get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end return unordered_table, reverse_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} ]] local function comp_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end local function testcases_category_from_tag(self, args) local cat_from_tag = require("Module:Lang")._category_from_tag -- use Module:Lang to create the 'expected results' local test_patterns = {} -- collect test patterns here local filter_function if args.code_mask then filter_function = function(language_code, code_mask) return language_code:find(code_mask) end -- if code within limits (three-character codes) else filter_function = function(language_code, code_mask) return language_code:len() == 2 end -- no limits for two-character codes end for language_code in pairs(args.language_list) do -- list of names not needed here local pattern = {} -- here we assemble the test pattern for <code> - if filter_function(language_code, args.code_mask) then table.insert(pattern, language_code) -- add it to the pattern table.insert(pattern, cat_from_tag({language_code})) -- call Module:Lang and add the 'expected results' for code to pattern table.insert(test_patterns, pattern) -- accumulate in list of patterns end end table.sort(test_patterns, comp_by_keys) -- make the list pretty self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', test_patterns, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_list = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(args.language_list) do if args.code_mask then if language_code:find(args.code_mask) then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end else if language_code:len() == 2 then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end end end local unordered_table = get_unordered_list(undabbed_language_list, args.list_modification, args.range) local ordered_table = {} local override_table = require("Module:Lang/data").override table.sort(unordered_table) for _, key in ipairs(unordered_table) do local override_lang_table = override_table[key] if override_lang_table then table.insert(ordered_table, {key, override_lang_table[1]}) else table.insert(ordered_table, {key, undabbed_language_list[key]}) end end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. ]] -- TODO: "Lua error: not enough memory." local function testcases_iso_name_to_code(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '{{#invoke:ISO 639 name|iso_639_name_to_code|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } h2w8kt4272mwssxz0m4x9tqx8na7pvq 796688 796687 2020-09-29T15:24:23Z en>Gonnym 0 hidden category should always be on, even when the category is incorrect 796688 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code, is_collective_language) local lang_module = require('Module:Lang') -- Is a language collective? if is_collective_language or language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" local suffix local is_collective_language if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) suffix = " languages" is_collective_language = true elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local full_language_tag_name = language_name if suffix then full_language_tag_name = language_name .. suffix end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({full_language_tag_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code, is_collective_language) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code, nil) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< S H A R E D _ T E S T C A S E S _ C O D E >------------------------- Functions: - get_unordered_list(language_list, list_modification, range) - get_unordered_language_list_general(language_list, list_modification, range) - get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) ]] local function get_unordered_list(language_list, list_modification, range) local unordered_table = {} if list_modification == "range" then for language_code in pairs(language_list) do if language_code:find(range) then table.insert(unordered_table, language_code) end end elseif list_modification == "length" then for language_code in pairs(language_list) do if language_code:len() == 2 then table.insert(unordered_table, language_code) end end else for language_code in pairs(language_list) do table.insert(unordered_table, language_code) end end return unordered_table end local function get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) for _, language_name in pairs(language_list[language_code]) do table.insert(unordered_table, language_name) reverse_table[language_name] = language_code end end local function get_unordered_and_reverse_lists(language_list, list_modification, range) local unordered_table = {} local reverse_table = {} local override_table = require("Module:Lang/data/sandbox").override -- TODO: switch to live if list_modification == "range" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if language_code:find(range) then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end elseif list_modification == "length" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if 2 == language_code:len() then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end else for language_code in pairs(language_list) do get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end return unordered_table, reverse_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} ]] local function comp_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end local function testcases_category_from_tag(self, args) local cat_from_tag = require("Module:Lang")._category_from_tag -- use Module:Lang to create the 'expected results' local test_patterns = {} -- collect test patterns here local filter_function if args.code_mask then filter_function = function(language_code, code_mask) return language_code:find(code_mask) end -- if code within limits (three-character codes) else filter_function = function(language_code, code_mask) return language_code:len() == 2 end -- no limits for two-character codes end for language_code in pairs(args.language_list) do -- list of names not needed here local pattern = {} -- here we assemble the test pattern for <code> - if filter_function(language_code, args.code_mask) then table.insert(pattern, language_code) -- add it to the pattern table.insert(pattern, cat_from_tag({language_code})) -- call Module:Lang and add the 'expected results' for code to pattern table.insert(test_patterns, pattern) -- accumulate in list of patterns end end table.sort(test_patterns, comp_by_keys) -- make the list pretty self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', test_patterns, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_list = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(args.language_list) do if args.code_mask then if language_code:find(args.code_mask) then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end else if language_code:len() == 2 then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end end end local unordered_table = get_unordered_list(undabbed_language_list, args.list_modification, args.range) local ordered_table = {} local override_table = require("Module:Lang/data").override table.sort(unordered_table) for _, key in ipairs(unordered_table) do local override_lang_table = override_table[key] if override_lang_table then table.insert(ordered_table, {key, override_lang_table[1]}) else table.insert(ordered_table, {key, undabbed_language_list[key]}) end end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. ]] -- TODO: "Lua error: not enough memory." local function testcases_iso_name_to_code(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '{{#invoke:ISO 639 name|iso_639_name_to_code|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } dwzyo651jt657mdeagvjzm4iqmfde50 796689 796688 2020-09-30T12:43:09Z en>Trappist the monk 0 undab override in testcases_name_from_tag(); 796689 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["SOURCES"] = "Articles with %s-language sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s languages collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s languages", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code, is_collective_language) local lang_module = require('Module:Lang') -- Is a language collective? if is_collective_language or language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. -- TODO: Currently getting the redirect cateogry Category:Articles with text from Berber languages. Need to prevent soft redirects. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, value in pairs(language_categories) do local category = mw.title.new(string.format(value, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" local suffix local is_collective_language if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) suffix = " languages" is_collective_language = true elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) suffix = " languages" elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local full_language_tag_name = language_name if suffix then full_language_tag_name = language_name .. suffix end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({full_language_tag_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code, is_collective_language) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code, nil) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< S H A R E D _ T E S T C A S E S _ C O D E >------------------------- Functions: - get_unordered_list(language_list, list_modification, range) - get_unordered_language_list_general(language_list, list_modification, range) - get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) ]] local function get_unordered_list(language_list, list_modification, range) local unordered_table = {} if list_modification == "range" then for language_code in pairs(language_list) do if language_code:find(range) then table.insert(unordered_table, language_code) end end elseif list_modification == "length" then for language_code in pairs(language_list) do if language_code:len() == 2 then table.insert(unordered_table, language_code) end end else for language_code in pairs(language_list) do table.insert(unordered_table, language_code) end end return unordered_table end local function get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) for _, language_name in pairs(language_list[language_code]) do table.insert(unordered_table, language_name) reverse_table[language_name] = language_code end end local function get_unordered_and_reverse_lists(language_list, list_modification, range) local unordered_table = {} local reverse_table = {} local override_table = require("Module:Lang/data/sandbox").override -- TODO: switch to live if list_modification == "range" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if language_code:find(range) then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end elseif list_modification == "length" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if 2 == language_code:len() then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end else for language_code in pairs(language_list) do get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end return unordered_table, reverse_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} ]] local function comp_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end local function testcases_category_from_tag(self, args) local cat_from_tag = require("Module:Lang")._category_from_tag -- use Module:Lang to create the 'expected results' local test_patterns = {} -- collect test patterns here local filter_function if args.code_mask then filter_function = function(language_code, code_mask) return language_code:find(code_mask) end -- if code within limits (three-character codes) else filter_function = function(language_code, code_mask) return language_code:len() == 2 end -- no limits for two-character codes end for language_code in pairs(args.language_list) do -- list of names not needed here local pattern = {} -- here we assemble the test pattern for <code> - if filter_function(language_code, args.code_mask) then table.insert(pattern, language_code) -- add it to the pattern table.insert(pattern, cat_from_tag({language_code})) -- call Module:Lang and add the 'expected results' for code to pattern table.insert(test_patterns, pattern) -- accumulate in list of patterns end end table.sort(test_patterns, comp_by_keys) -- make the list pretty self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', test_patterns, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_list = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(args.language_list) do if args.code_mask then if language_code:find(args.code_mask) then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end else if language_code:len() == 2 then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end end end local unordered_table = get_unordered_list(undabbed_language_list, args.list_modification, args.range) local ordered_table = {} local override_table = require("Module:Lang/data").override table.sort(unordered_table) for _, key in ipairs(unordered_table) do local override_lang_table = override_table[key] if override_lang_table then table.insert(ordered_table, {key, override_lang_table[1]:gsub(' %b()$', '')}) else table.insert(ordered_table, {key, undabbed_language_list[key]}) end end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. ]] -- TODO: "Lua error: not enough memory." local function testcases_iso_name_to_code(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '{{#invoke:ISO 639 name|iso_639_name_to_code|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } lehgzxauj4jylrw67qbbv8wfp2j0wch 796690 796689 2020-10-01T11:53:36Z en>Gonnym 0 bugfix in title search for collective languages 796690 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< S H A R E D _ T E S T C A S E S _ C O D E >------------------------- Functions: - get_unordered_list(language_list, list_modification, range) - get_unordered_language_list_general(language_list, list_modification, range) - get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) ]] local function get_unordered_list(language_list, list_modification, range) local unordered_table = {} if list_modification == "range" then for language_code in pairs(language_list) do if language_code:find(range) then table.insert(unordered_table, language_code) end end elseif list_modification == "length" then for language_code in pairs(language_list) do if language_code:len() == 2 then table.insert(unordered_table, language_code) end end else for language_code in pairs(language_list) do table.insert(unordered_table, language_code) end end return unordered_table end local function get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) for _, language_name in pairs(language_list[language_code]) do table.insert(unordered_table, language_name) reverse_table[language_name] = language_code end end local function get_unordered_and_reverse_lists(language_list, list_modification, range) local unordered_table = {} local reverse_table = {} local override_table = require("Module:Lang/data").override if list_modification == "range" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if language_code:find(range) then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end elseif list_modification == "length" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if 2 == language_code:len() then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end else for language_code in pairs(language_list) do get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end return unordered_table, reverse_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} ]] local function comp_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end local function testcases_category_from_tag(self, args) local cat_from_tag = require("Module:Lang")._category_from_tag -- use Module:Lang to create the 'expected results' local test_patterns = {} -- collect test patterns here local filter_function if args.code_mask then filter_function = function(language_code, code_mask) return language_code:find(code_mask) end -- if code within limits (three-character codes) else filter_function = function(language_code, code_mask) return language_code:len() == 2 end -- no limits for two-character codes end for language_code in pairs(args.language_list) do -- list of names not needed here local pattern = {} -- here we assemble the test pattern for <code> - if filter_function(language_code, args.code_mask) then table.insert(pattern, language_code) -- add it to the pattern table.insert(pattern, cat_from_tag({language_code})) -- call Module:Lang and add the 'expected results' for code to pattern table.insert(test_patterns, pattern) -- accumulate in list of patterns end end table.sort(test_patterns, comp_by_keys) -- make the list pretty self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', test_patterns, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_list = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(args.language_list) do if args.code_mask then if language_code:find(args.code_mask) then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end else if language_code:len() == 2 then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end end end local unordered_table = get_unordered_list(undabbed_language_list, args.list_modification, args.range) local ordered_table = {} local override_table = require("Module:Lang/data").override table.sort(unordered_table) for _, key in ipairs(unordered_table) do local override_lang_table = override_table[key] if override_lang_table then table.insert(ordered_table, {key, override_lang_table[1]:gsub(' %b()$', '')}) else table.insert(ordered_table, {key, undabbed_language_list[key]}) end end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. ]] -- TODO: "Lua error: not enough memory." local function testcases_iso_name_to_code(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '{{#invoke:ISO 639 name|iso_639_name_to_code|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } tq19wz0x8vkrty32ui5e4w1msxjande 796691 796690 2020-10-02T11:35:07Z en>Gonnym 0 796691 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< S H A R E D _ T E S T C A S E S _ C O D E >------------------------- Functions: - get_unordered_list(language_list, list_modification, range) - get_unordered_language_list_general(language_list, list_modification, range) - get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) ]] local function get_unordered_list(language_list, list_modification, range) local unordered_table = {} if list_modification == "range" then for language_code in pairs(language_list) do if language_code:find(range) then table.insert(unordered_table, language_code) end end elseif list_modification == "length" then for language_code in pairs(language_list) do if language_code:len() == 2 then table.insert(unordered_table, language_code) end end else for language_code in pairs(language_list) do table.insert(unordered_table, language_code) end end return unordered_table end local function get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) for _, language_name in pairs(language_list[language_code]) do table.insert(unordered_table, language_name) reverse_table[language_name] = language_code end end local function get_unordered_and_reverse_lists(language_list, list_modification, range) local unordered_table = {} local reverse_table = {} local override_table = require("Module:Lang/data").override if list_modification == "range" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if language_code:find(range) then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end elseif list_modification == "length" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if language_code:len() == 2 then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end else for language_code in pairs(language_list) do get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end return unordered_table, reverse_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} ]] local function comp_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end local function testcases_category_from_tag(self, args) local cat_from_tag = require("Module:Lang")._category_from_tag -- use Module:Lang to create the 'expected results' local test_patterns = {} -- collect test patterns here local filter_function if args.code_mask then filter_function = function(language_code, code_mask) return language_code:find(code_mask) end -- if code within limits (three-character codes) else filter_function = function(language_code, code_mask) return language_code:len() == 2 end -- no limits for two-character codes end for language_code in pairs(args.language_list) do -- list of names not needed here local pattern = {} -- here we assemble the test pattern for <code> - if filter_function(language_code, args.code_mask) then table.insert(pattern, language_code) -- add it to the pattern table.insert(pattern, cat_from_tag({language_code})) -- call Module:Lang and add the 'expected results' for code to pattern table.insert(test_patterns, pattern) -- accumulate in list of patterns end end table.sort(test_patterns, comp_by_keys) -- make the list pretty self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', test_patterns, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_list = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(args.language_list) do if args.code_mask then if language_code:find(args.code_mask) then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end elseif args.list_modification == "range" then if language_code:len() == 2 then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end else undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') end end local unordered_table = get_unordered_list(undabbed_language_list, args.list_modification, args.range) local ordered_table = {} local override_table = require("Module:Lang/data").override table.sort(unordered_table) for _, key in ipairs(unordered_table) do local override_lang_table = override_table[key] if override_lang_table then table.insert(ordered_table, {key, override_lang_table[1]:gsub(' %b()$', '')}) else table.insert(ordered_table, {key, undabbed_language_list[key]}) end end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. ]] -- TODO: "Lua error: not enough memory." local function testcases_iso_name_to_code(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '{{#invoke:ISO 639 name|iso_639_name_to_code|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } glva6r4cfsaebr2qmo9jh9aiamz9re0 796692 796691 2020-10-02T11:36:49Z en>Gonnym 0 796692 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< S H A R E D _ T E S T C A S E S _ C O D E >------------------------- Functions: - get_unordered_list(language_list, list_modification, range) - get_unordered_language_list_general(language_list, list_modification, range) - get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) ]] local function get_unordered_list(language_list, list_modification, range) local unordered_table = {} if list_modification == "range" then for language_code in pairs(language_list) do if language_code:find(range) then table.insert(unordered_table, language_code) end end elseif list_modification == "length" then for language_code in pairs(language_list) do if language_code:len() == 2 then table.insert(unordered_table, language_code) end end else for language_code in pairs(language_list) do table.insert(unordered_table, language_code) end end return unordered_table end local function get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) for _, language_name in pairs(language_list[language_code]) do table.insert(unordered_table, language_name) reverse_table[language_name] = language_code end end local function get_unordered_and_reverse_lists(language_list, list_modification, range) local unordered_table = {} local reverse_table = {} local override_table = require("Module:Lang/data").override if list_modification == "range" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if language_code:find(range) then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end elseif list_modification == "length" then -- for language_code in pairs(language_list) do for language_code, names in pairs(language_list) do if language_code:len() == 2 then if override_table[language_code] then local name = override_table[language_code][1] table.insert(unordered_table, name) -- only the first name when there are multiples reverse_table[name] = language_code else table.insert(unordered_table, names[1]) -- only the first name when there are multiples reverse_table[names[1]] = language_code end -- get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end else for language_code in pairs(language_list) do get_data_from_language_code(language_list, language_code, unordered_table, reverse_table) end end return unordered_table, reverse_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} ]] local function comp_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end local function testcases_category_from_tag(self, args) local cat_from_tag = require("Module:Lang")._category_from_tag -- use Module:Lang to create the 'expected results' local test_patterns = {} -- collect test patterns here local filter_function if args.code_mask then filter_function = function(language_code, code_mask) return language_code:find(code_mask) end -- if code within limits (three-character codes) else filter_function = function(language_code, code_mask) return language_code:len() == 2 end -- no limits for two-character codes end for language_code in pairs(args.language_list) do -- list of names not needed here local pattern = {} -- here we assemble the test pattern for <code> - if filter_function(language_code, args.code_mask) then table.insert(pattern, language_code) -- add it to the pattern table.insert(pattern, cat_from_tag({language_code})) -- call Module:Lang and add the 'expected results' for code to pattern table.insert(test_patterns, pattern) -- accumulate in list of patterns end end table.sort(test_patterns, comp_by_keys) -- make the list pretty self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', test_patterns, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_list = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(args.language_list) do if args.code_mask then if language_code:find(args.code_mask) then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end elseif args.list_modification == "length" then if language_code:len() == 2 then undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end else undabbed_language_list[language_code] = language_names[1]:gsub(' %b()$', '') end end local unordered_table = get_unordered_list(undabbed_language_list, args.list_modification, args.range) local ordered_table = {} local override_table = require("Module:Lang/data").override table.sort(unordered_table) for _, key in ipairs(unordered_table) do local override_lang_table = override_table[key] if override_lang_table then table.insert(ordered_table, {key, override_lang_table[1]:gsub(' %b()$', '')}) else table.insert(ordered_table, {key, undabbed_language_list[key]}) end end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local unordered_table = get_unordered_list(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. ]] -- TODO: "Lua error: not enough memory." local function testcases_iso_name_to_code(self, args) local unordered_table, reverse_table = get_unordered_and_reverse_lists(args.language_list, args.list_modification, args.range) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key}) end self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '{{#invoke:ISO 639 name|iso_639_name_to_code|', '}}', ordered_table, {nowiki=false, templatestyles=true} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 9sdealazxjm13y7swwnwfyaathxwed3 796693 796692 2020-10-05T15:28:01Z en>Gonnym 0 update /testcases code. Some still running out of memory 796693 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here mw.log(args.override_table[args.language_code][1]) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 02xwrm857ag27gcjx9qx9dhfk2jviwo 796694 796693 2020-10-05T15:50:36Z en>Gonnym 0 796694 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here mw.log(args.override_table[args.language_code][1]) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 31n6ox3tzujwz1i71x3wn7xk5v7cmo0 796695 796694 2020-10-05T17:27:30Z en>Gonnym 0 796695 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column is the <language_code>. - "Actual" column is the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 8qqet3kn5ni6z0sks4jpsmcueh1kd0p 796696 796695 2020-10-05T17:36:04Z en>Gonnym 0 fixed testcases_name_from_tag errors 796696 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column is the <language_code>. - "Actual" column is the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } ewin4n6dwk1mq3abimnzvlnbkvnziyc 796697 796696 2020-10-05T18:14:03Z en>Gonnym 0 796697 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language name>}}. - "Actual" column is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language name>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column is the <language_code>. - "Actual" column is the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 30vce3kze3alorymnpjt0ch9fhmhp9t 796698 796697 2020-10-05T18:19:22Z en>Gonnym 0 796698 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language name>"} ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language name>}}. - "Actual" column is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language name>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column is the <language_code>. - "Actual" column is the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } qrjjuxtwehsin6j6xpys8ulirzo2sqn 796699 796698 2020-10-05T18:26:47Z en>Gonnym 0 doc update 796699 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } fikphmy0zof5h2kp43n4jwji389iss0 796700 796699 2020-10-05T18:52:59Z en>Gonnym 0 fixed testcases_iso_name_to_code 796700 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|part=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 7c0hzhyhfm5urwajtgp1n4984jc6ga3 796701 796700 2020-10-05T19:52:30Z en>Gonnym 0 changed part= to 2= 796701 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_NEW_TEXT"] = "Articles with text from %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find("languages collective") then -- this form may or may not be replaced with the form in the elseif -- Wikipedia:Categories_for_discussion/Log/2020_August_18#Category:Articles_with_text_from_the_Afro-Asiatic_languages_collective -- Naming style: Category:Articles with text from the Afro-Asiatic languages collective part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('Articles with text from') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_NEW_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } i7hld0pomoedqvb4lwgejuux2takbo0 796702 796701 2020-11-03T07:55:14Z en>Gonnym 0 update per CfD 796702 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]+)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } ita6emisgdj71t97e9pv56k4qps4kfd 796703 796702 2020-11-03T08:02:13Z en>Gonnym 0 796703 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]?)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) part2 = "" elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 9ri96h1g9s0jiv9a5jcmy1epb24t56p 796704 796703 2020-11-03T08:06:16Z en>Gonnym 0 796704 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) part2 = "" elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 73tjemvogowxwb9d62adgaieln51las 796705 796704 2020-11-03T08:07:05Z en>Gonnym 0 796705 Scribunto text/plain require('Module:No globals'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+)') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end --[[-------------------------< S H A R E D _ C O D E >------------------------- - Tables: -- language_categories -- error_messages - Functions: -- get_error_message(message) -- get_see_also_section(page_title, language_name, language_code) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_messages = { ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name.", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for %s.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{%s}} template. The correct category is located at: [[:%s]].", } local function get_error_message(message) return string.format('<span style="font-size:100%%; font-style:normal;" class="error">Error: %s </span>[[Category:Lang and lang-xx template errors]]', message) end local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end -- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. -- If {{CS1 language sources}} is converted, it should also use it. local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, "* [[:" .. category.prefixedText .. "]]") end end table.sort(see_also_section) table.insert(see_also_section, 1, '\n\n==See also==') if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end -- Generates a consistent top maintenance template section. local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, '<div style="font-size:x-small;">' .. purge_module._main({"Purge page cache"}) .. '</div>') return table.concat(top_section, "\n\n") end -- Generates a consistent non-text section. local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", } local function non_english_language_text_category(frame) local args = require('Module:Arguments').getArgs(frame) local page_title = mw.title.getCurrentTitle().text -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page_title local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" -- Check if error message if language_code:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name))) else local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) else local current_category_title = mw.title.getCurrentTitle().prefixedText if current_category_title ~= correct_language_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "Lang", correct_language_category_title))) else table.insert(layout, get_top_section(frame)) local script = args.script local script_text if script then script_text = string.format(non_english_language_text_text_strings["IN_SCRIPT"], script) else script_text = "" end local example_default_text = string.format(non_english_language_text_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {"Lang"}} table.insert(layout, string.format(non_english_language_text_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {"Lang", language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) see_also_section = get_see_also_section(page_title, language_name, language_code) end end end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_text_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", } local function non_english_language_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local current_category_title = page_title_object.prefixedText local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then table.insert(layout, get_error_message(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code))) elseif correct_language_category_title ~= current_category_title then table.insert(layout, get_error_message(string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, "In lang", correct_language_category_title))) else local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_text_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {"In lang", language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) see_also_section = get_see_also_section(page_title, language_name, language_code) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_sources_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y >------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[-------------------------< T E S T _ C A S E S _ S H A R E D _ C O D E >-------------------------]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[-------------------------< T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G >------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ N A M E _ F R O M _ T A G >------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ T A G _ F R O M _ N A M E >------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E >------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[-------------------------< T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E >------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[-------------------------< E X P O R T E D F U N C T I O N S >------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } bwwy9zifkm95rq6sjm3hjkf0iffzsgs 796706 796705 2020-11-03T11:11:35Z en>Gonnym 0 sync from sandbox 796706 Scribunto text/plain require('Module:No globals') local p = {} --[[ -------------------------- < L A N G - X X _ S E T T I N G S > -------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('error') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < E X P O R T E D _ F U N C T I O N S > -------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 4umkanmp8itqmvfcpee6x4ms3hin22f 796707 796706 2021-06-04T17:33:09Z en>Trappist the monk 0 796707 Scribunto text/plain require('Module:No globals') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang[1], '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('error') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < E X P O R T E D _ F U N C T I O N S > -------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } gma9jrlgjvotdp1gufa5hn4l34f99pr 796708 796707 2021-10-22T01:56:35Z en>MusikBot II 0 Changed protection settings for "[[Module:Lang/documentor tool]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 3018 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite)) 796707 Scribunto text/plain require('Module:No globals') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang[1], '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('error') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('error') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < E X P O R T E D _ F U N C T I O N S > -------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } gma9jrlgjvotdp1gufa5hn4l34f99pr 796709 796708 2021-12-26T16:37:23Z en>Trappist the monk 0 796709 Scribunto text/plain require('Module:No globals') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang[1], '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < E X P O R T E D _ F U N C T I O N S > -------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 7cdd5r78g4aklfd5vko9r0h83cupw0u 796710 796709 2022-01-10T19:34:14Z en>Trappist the monk 0 796710 Scribunto text/plain require('Module:No globals') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < E X P O R T E D _ F U N C T I O N S > -------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } d8eaxsd8rf2euqmvlio5lx1zsfd1q9s 796711 796710 2022-09-17T22:23:33Z en>Trappist the monk 0 796711 Scribunto text/plain require('Module:No globals') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items inside <nowiki>...</nowiki> tags {{#invoke:Lang/documentor tool|see_also|<nowiki>*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}</nowiki>}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end local args_list = mw.text.unstripNoWiki(frame.args[1]); -- not empty; fetch contents of stripmarker args_list = args_list:gsub ('%s*,%s', '\n'); -- replace comma-separators with newline return frame:preprocess (args_list); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } ha5iyixq25vl1f8kcjfis09xkaa743r 796712 796711 2022-09-17T22:31:39Z en>Trappist the monk 0 796712 Scribunto text/plain require('Module:No globals') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 8rg9ekb9buzwmadypp92ym9rq912s4m 796713 796712 2022-10-22T09:06:43Z en>WOSlinker 0 use require('strict') instead of require('Module:No globals') 796713 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 9i8swjrgtgswjwqv3hzjhuuyd44g4di 796714 796713 2023-06-16T18:09:06Z en>Frietjes 0 error in [[Template:Lang-ms-Arab]] and a few others 796714 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') or '' return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } qo6h9l9wh19316se4o57d89deo35mop 796715 796714 2023-06-16T18:46:01Z en>Trappist the monk 0 silently ignoring a legitimate error is not good; emit an appropriate error message instead; 796715 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)'); if not style or not ('italic' == style or 'inherit' == style) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>'; end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } g5v6vymlbd6bvpat9xab1anrudyt9o4 796716 796715 2023-06-16T18:57:02Z en>Trappist the monk 0 796716 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)'); if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>'; end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } mmhlbt7bgmvef1hm55a5sj8wqzn65li 796717 796716 2023-09-20T16:20:02Z en>Nardog 0 make "Supported private-use IETF language tags" sortable 796717 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)'); if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>'; end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:Language/data/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 77io9jow4ggounlzlqxizug36l9fif2 796718 796717 2024-07-11T15:20:04Z en>Trappist the monk 0 /* top */clean up 796718 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)'); if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>'; end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" if lang_x.exists then local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 1acgwupcv3o45ao2x5f35kpx6n6b9vd 796719 796718 2024-10-07T15:43:46Z en>Trappist the monk 0 switch support from {{lang-??|...}} to {{langx|??|...}}; 796719 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)'); if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>'; end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>.%s', ["LINE3_EXTRA"] = " Also available is %s which displays as %s.", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} -- local lang_x = mw.title.makeTitle(10, "Lang-" .. language_code) local line3_extra = "" local langx_template_example = frame:expandTemplate{title = 'Tlx', args = {'langx', language_code, example_text}} local langx_template = frame:expandTemplate{title = 'langx', args = {language_code, example_text}} line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], langx_template_example, langx_template) -- if lang_x.exists then -- local lang_x_template_example = frame:expandTemplate{title = 'Tlx', args = {lang_x.text, example_text}} -- local lang_x_template = frame:expandTemplate{title = lang_x.text, args = {example_text}} -- line3_extra = string.format(non_english_language_text_strings["LINE3_EXTRA"], lang_x_template_example, lang_x_template) -- end table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, line3_extra)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 259nso1e0oqltrqgzwj0yz3ivbkrzc6 796720 796719 2024-10-07T19:04:00Z en>Gonnym 0 switch to langx 796720 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)'); if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>'; end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>. Also available is %s which displays as %s.', ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } ipki8xjdunnns7y1lwxzpcu798kboyl 796721 796720 2024-10-27T14:00:54Z en>Gonnym 0 796721 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)'); if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>'; end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>. Also available is %s which displays as %s.', ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } 6cu3t2lpfta2z05he16w3u2fp7cfh9m 796722 796721 2024-10-27T14:11:02Z en>Gonnym 0 796722 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)'); if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>'; end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:CatAutoTOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'CatAutoTOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>. Also available is %s which displays as %s.', ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local correct_language_category_title = require('Module:In lang')._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table and args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } ti40ioh5ejannqnt3jt7womvlqr21i9 796723 796722 2024-11-12T11:10:53Z en>Gonnym 0 added automatic handling for categorization of sub-languages into their parent language category for better categorization 796723 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)'); if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>'; end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ P R I M A R Y _ L A N G U A G E _ C O D E > -------------------------- Returns the primary language for sub-langage variants. ]] local function get_primary_language_code(language_code) -- If no hyphen exists, return nil (for cases like "el") if not language_code:find("-") then return nil end -- Match everything before the first hyphen, but only if a hyphen exists if language_code:match("^-") then return nil -- If the code starts with a hyphen, return nil end -- Look for the first part before any hyphen local primary_code = language_code:match("^[^-]+") return primary_code end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:Automatic category TOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'Automatic category TOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if parent_language_category then table.insert(bottom_section, "[[" .. parent_language_category .. "]]") end table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>. Also available is %s which displays as %s.', ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = lang_module._category_from_tag({parent_language_code}) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"], parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local in_lang_module = require('Module:In lang') local correct_language_category_title = in_lang_module._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = in_lang_module._in_lang({parent_language_code, ["list-cats"]="yes"}) end local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table and args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } ni91j4gjvi1occ4ipfs8tarf19xi8w0 796724 796723 2024-11-17T12:54:42Z en>Gonnym 0 fix documentation to match what module does 796724 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override; -- get the override table local private_t = {}; for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"'); table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}'; -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)'); if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>'; end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ P R I M A R Y _ L A N G U A G E _ C O D E > -------------------------- Returns the primary language for sub-langage variants. ]] local function get_primary_language_code(language_code) -- If no hyphen exists, return nil (for cases like "el") if not language_code:find("-") then return nil end -- Match everything before the first hyphen, but only if a hyphen exists if language_code:match("^-") then return nil -- If the code starts with a hyphen, return nil end -- Look for the first part before any hyphen local primary_code = language_code:match("^[^-]+") return primary_code end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:Automatic category TOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'Automatic category TOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if parent_language_category then table.insert(bottom_section, "[[" .. parent_language_category .. "]]") end table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with <code>&lt;span lang="%s"&gt;</code>. Also available is %s which displays as %s.', ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} -- Strip private use subtag from code tag because this is what [[Module:Lang]] does. local language_code_without_private_use = language_code:gsub ('%-x%-.*', '') table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, language_code_without_private_use, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = lang_module._category_from_tag({parent_language_code}) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"], parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local in_lang_module = require('Module:In lang') local correct_language_category_title = in_lang_module._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = in_lang_module._in_lang({parent_language_code, ["list-cats"]="yes"}) end local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table and args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return; -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')); -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } colx6lerud0f9d8ekzf0ipx8ojn9jj9 796725 796724 2024-11-17T13:23:38Z en>Gonnym 0 use syntaxhighlight instead of code 796725 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override -- get the override table local private_t = {} for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"') table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}' -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>' end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ P R I M A R Y _ L A N G U A G E _ C O D E > -------------------------- Returns the primary language for sub-langage variants. ]] local function get_primary_language_code(language_code) -- If no hyphen exists, return nil (for cases like "el") if not language_code:find("-") then return nil end -- Match everything before the first hyphen, but only if a hyphen exists if language_code:match("^-") then return nil -- If the code starts with a hyphen, return nil end -- Look for the first part before any hyphen local primary_code = language_code:match("^[^-]+") return primary_code end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:Automatic category TOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'Automatic category TOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if parent_language_category then table.insert(bottom_section, "[[" .. parent_language_category .. "]]") end table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with %s. Also available is %s which displays as %s.', ["LINE3_SYNTAXHIGHLIGHT"] = "<span lang=\"%s\">", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["LANG"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} -- Strip private use subtag from code tag because this is what [[Module:Lang]] does. local language_code_without_private_use = language_code:gsub("%-x%-.*", "") -- Wrap in syntaxhighlight. local syntaxhighlight = frame:extensionTag( "syntaxhighlight", string.format(non_english_language_text_strings["LINE3_SYNTAXHIGHLIGHT"], language_code_without_private_use), {lang = "html", inline = true} ) table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, syntaxhighlight, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = lang_module._category_from_tag({parent_language_code}) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"], parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local in_lang_module = require('Module:In lang') local correct_language_category_title = in_lang_module._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = in_lang_module._in_lang({parent_language_code, ["list-cats"]="yes"}) end local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table and args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')) -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } oky4a7uuo07xv6czyg9aof57lxpaf0c 796726 796725 2025-01-28T17:13:48Z en>Trappist the monk 0 TEMPLATE not LANG; 796726 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override -- get the override table local private_t = {} for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"') table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}' -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>' end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- language_categories -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local language_categories = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", -- old version ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text from the %s collective", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ P R I M A R Y _ L A N G U A G E _ C O D E > -------------------------- Returns the primary language for sub-langage variants. ]] local function get_primary_language_code(language_code) -- If no hyphen exists, return nil (for cases like "el") if not language_code:find("-") then return nil end -- Match everything before the first hyphen, but only if a hyphen exists if language_code:match("^-") then return nil -- If the code starts with a hyphen, return nil end -- Look for the first part before any hyphen local primary_code = language_code:match("^[^-]+") return primary_code end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(language_categories) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:Automatic category TOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'Automatic category TOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if parent_language_category then table.insert(bottom_section, "[[" .. parent_language_category .. "]]") end table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with %s. Also available is %s which displays as %s.', ["LINE3_SYNTAXHIGHLIGHT"] = "<span lang=\"%s\">", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = language_categories["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = language_categories["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = language_categories["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} -- Strip private use subtag from code tag because this is what [[Module:Lang]] does. local language_code_without_private_use = language_code:gsub("%-x%-.*", "") -- Wrap in syntaxhighlight. local syntaxhighlight = frame:extensionTag( "syntaxhighlight", string.format(non_english_language_text_strings["LINE3_SYNTAXHIGHLIGHT"], language_code_without_private_use), {lang = "html", inline = true} ) table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, syntaxhighlight, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = lang_module._category_from_tag({parent_language_code}) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"], parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local in_lang_module = require('Module:In lang') local correct_language_category_title = in_lang_module._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = in_lang_module._in_lang({parent_language_code, ["list-cats"]="yes"}) end local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table and args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')) -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } g61bo7anc7kckcc0ye0nw2ow8qs4h7l 796727 796726 2025-04-11T07:12:32Z en>Gonnym 0 added two more category types 796727 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override -- get the override table local private_t = {} for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"') table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}' -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>' end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- LANGUAGE_CATEGORIES -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local LANGUAGE_CATEGORIES = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["CS1_SCRIPT"] = "CS1 uses %s-language script (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", ["IPA"] = "Pages with %s IPA" } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the {{tlx|%s}} template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ P R I M A R Y _ L A N G U A G E _ C O D E > -------------------------- Returns the primary language for sub-langage variants. ]] local function get_primary_language_code(language_code) -- If no hyphen exists, return nil (for cases like "el") if not language_code:find("-") then return nil end -- Match everything before the first hyphen, but only if a hyphen exists if language_code:match("^-") then return nil -- If the code starts with a hyphen, return nil end -- Look for the first part before any hyphen local primary_code = language_code:match("^[^-]+") return primary_code end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(LANGUAGE_CATEGORIES) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:Automatic category TOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'Automatic category TOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if parent_language_category then table.insert(bottom_section, "[[" .. parent_language_category .. "]]") end table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with %s. Also available is %s which displays as %s.', ["LINE3_SYNTAXHIGHLIGHT"] = "<span lang=\"%s\">", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = LANGUAGE_CATEGORIES["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = LANGUAGE_CATEGORIES["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = LANGUAGE_CATEGORIES["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_text_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} -- Strip private use subtag from code tag because this is what [[Module:Lang]] does. local language_code_without_private_use = language_code:gsub("%-x%-.*", "") -- Wrap in syntaxhighlight. local syntaxhighlight = frame:extensionTag( "syntaxhighlight", string.format(non_english_language_text_strings["LINE3_SYNTAXHIGHLIGHT"], language_code_without_private_use), {lang = "html", inline = true} ) table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, syntaxhighlight, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = lang_module._category_from_tag({parent_language_code}) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"], parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local in_lang_module = require('Module:In lang') local correct_language_category_title = in_lang_module._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, non_english_language_sources_strings["TEMPLATE"], correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = in_lang_module._in_lang({parent_language_code, ["list-cats"]="yes"}) end local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table and args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')) -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } ifzdeq4h0sdyqxvozkpt3yq55ygd9cb 796728 796727 2025-05-12T16:10:52Z en>Gonnym 0 fix expandTemplate 796728 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override -- get the override table local private_t = {} for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"') table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}' -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>' end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- LANGUAGE_CATEGORIES -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local LANGUAGE_CATEGORIES = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["CS1_SCRIPT"] = "CS1 uses %s-language script (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", ["IPA"] = "Pages with %s IPA" } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the %s template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ P R I M A R Y _ L A N G U A G E _ C O D E > -------------------------- Returns the primary language for sub-langage variants. ]] local function get_primary_language_code(language_code) -- If no hyphen exists, return nil (for cases like "el") if not language_code:find("-") then return nil end -- Match everything before the first hyphen, but only if a hyphen exists if language_code:match("^-") then return nil -- If the code starts with a hyphen, return nil end -- Look for the first part before any hyphen local primary_code = language_code:match("^[^-]+") return primary_code end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(LANGUAGE_CATEGORIES) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:Automatic category TOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'Automatic category TOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if parent_language_category then table.insert(bottom_section, "[[" .. parent_language_category .. "]]") end table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with %s. Also available is %s which displays as %s.', ["LINE3_SYNTAXHIGHLIGHT"] = "<span lang=\"%s\">", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = LANGUAGE_CATEGORIES["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = LANGUAGE_CATEGORIES["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = LANGUAGE_CATEGORIES["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"]}}, correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} -- Strip private use subtag from code tag because this is what [[Module:Lang]] does. local language_code_without_private_use = language_code:gsub("%-x%-.*", "") -- Wrap in syntaxhighlight. local syntaxhighlight = frame:extensionTag( "syntaxhighlight", string.format(non_english_language_text_strings["LINE3_SYNTAXHIGHLIGHT"], language_code_without_private_use), {lang = "html", inline = true} ) table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, syntaxhighlight, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = lang_module._category_from_tag({parent_language_code}) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"], parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local in_lang_module = require('Module:In lang') local correct_language_category_title = in_lang_module._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"]}}, correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = in_lang_module._in_lang({parent_language_code, ["list-cats"]="yes"}) end local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table and args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')) -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } nf7via5h4j5k0kbllqt83rw34skdp6p 796729 787244 2026-06-06T02:39:41Z SM7 3953 62 revisions imported from [[:en:Module:Lang/documentor_tool]] 787244 Scribunto text/plain require('strict'); local p = {}; --[[-------------------------< L A N G - X X _ S E T T I N G S >----------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page ]] function p.lang_xx_settings (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end local out = {}; local params; local style; if content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match ('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match ('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return ''; -- there should be at least one or the template/module won't work TODO: error message? end table.insert (out, '{| class="wikitable" style="text-align:right; float:right"\n|+settings') -- start a wikitable for k, v in params:gmatch ('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match ('label%s*=%s*(%[%[[^%]]+%]%])') or params:match ('label%s*=%s*([^|\n]+') or 'missing label'; end table.insert (out, table.concat ({k, '\n|', v})); -- make rudimentary wikitable entries end style = content:match ('lang_xx_([^|]+)'); return table.concat ({table.concat (out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}); -- add inter-row markup and close the wikitable and done else return ''; -- does not use [[Module:Lang]] so abandon quietly end end --[[-------------------------< U S E S _ M O D U L E >--------------------------------------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false Used in template documentation {{#if:}} parser functions. ]] function p.uses_module (frame) local page = mw.title.makeTitle ('Template', frame.args['template'] or frame.args[1]); -- get a page object for this page in 'Template:' namespace if not page then return ''; -- TODO: error message? end local content = page:getContent(); -- get unparsed content if not page then return ''; -- TODO: error message? end return content:find ('{{%s*#invoke:[Ll]ang%s*|') or ''; -- return index or empty string end return p; 7dx9ccpwajs61qjr2ocrdztaayetm0p 796730 796729 2026-06-06T02:42:45Z SM7 3953 अपडेट कइल गइल 796730 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override -- get the override table local private_t = {} for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"') table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}' -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>' end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- LANGUAGE_CATEGORIES -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local LANGUAGE_CATEGORIES = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["CS1_SCRIPT"] = "CS1 uses %s-language script (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", ["IPA"] = "Pages with %s IPA" } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the %s template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ P R I M A R Y _ L A N G U A G E _ C O D E > -------------------------- Returns the primary language for sub-langage variants. ]] local function get_primary_language_code(language_code) -- If no hyphen exists, return nil (for cases like "el") if not language_code:find("-") then return nil end -- Match everything before the first hyphen, but only if a hyphen exists if language_code:match("^-") then return nil -- If the code starts with a hyphen, return nil end -- Look for the first part before any hyphen local primary_code = language_code:match("^[^-]+") return primary_code end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(LANGUAGE_CATEGORIES) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:Automatic category TOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'Automatic category TOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "Category" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if parent_language_category then table.insert(bottom_section, "[[" .. parent_language_category .. "]]") end table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with %s. Also available is %s which displays as %s.', ["LINE3_SYNTAXHIGHLIGHT"] = "<span lang=\"%s\">", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[Category:Articles containing non-English-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = LANGUAGE_CATEGORIES["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = LANGUAGE_CATEGORIES["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = LANGUAGE_CATEGORIES["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"]}}, correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} -- Strip private use subtag from code tag because this is what [[Module:Lang]] does. local language_code_without_private_use = language_code:gsub("%-x%-.*", "") -- Wrap in syntaxhighlight. local syntaxhighlight = frame:extensionTag( "syntaxhighlight", string.format(non_english_language_text_strings["LINE3_SYNTAXHIGHLIGHT"], language_code_without_private_use), {lang = "html", inline = true} ) table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, syntaxhighlight, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = lang_module._category_from_tag({parent_language_code}) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"], parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[Category:Articles with non-English-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local in_lang_module = require('Module:In lang') local correct_language_category_title = in_lang_module._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"]}}, correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = in_lang_module._in_lang({parent_language_code, ["list-cats"]="yes"}) end local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table and args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')) -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } nf7via5h4j5k0kbllqt83rw34skdp6p 796788 796730 2026-06-06T02:50:43Z SM7 3953 कुछ लोकलाइजेशन 796788 Scribunto text/plain require('strict') local p = {} --[[ -------------------------< P R I V A T E _ T A G S >------------------------------------------------------ {{#invoke:Lang/documentor tool|private_tags}} Reads the override{} table in Module:Lang/data and renders a wiki table of private tags and their associated languages ]] local function private_tags (frame) local override_t = mw.loadData ('Module:Lang/data').override -- get the override table local private_t = {} for tag, lang in pairs (override_t) do if tag:find ('%-x%-') then table.insert (private_t, table.concat ({'\n|-\n|', lang, '||', tag})) end end table.sort (private_t) table.insert (private_t, 1, '{| class="wikitable sortable"') table.insert (private_t, 2, '\n|+ Supported private-use IETF language tags') table.insert (private_t, 3, '\n! Language !! Private-use tag') return table.concat (private_t) .. '\n|}' -- return '<pre>' .. table.concat (private_t) .. '\n|}' .. '</pre>' --error (mw.dumpObject (private_t)) end --[[ -------------------------< L A N G - X X _ S E T T I N G S >---------------------------------------------- {{#invoke:Lang/documentor tool|lang_xx_settings|template={{ROOTPAGENAME}}}} Reads the content of the template and extracts the parameters from {{#invoke:Lang|...}} for display on the template's documentation page. ]] local function lang_xx_settings(frame) local page = mw.title.makeTitle('टेम्पलेट', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end local out = {} local params local style if content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+|[^}]+}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+|[^}]+}}') then -- if this template uses [[Module:Lang]] params = content:match('{{%s*#invoke:%s*[Ll]ang%s*|[^|]+(|[^}]+)}}') or content:match('{{%s*#invoke:%s*[Ll]ang/sandbox%s*|[^|]+(|[^}]+)}}') -- extract the #invoke:'s parameters if not params then return '' -- there should be at least one or the template/module won't work TODO: error message? end table.insert(out, '{| class="wikitable" style="text-align: right; float: right;"\n|+settings') -- start a wikitable for k, v in params:gmatch('%s*|%s*([^%s=]+)%s*=%s*([^%s|]+)') do -- get the parameter names (k) and values (v) if 'label' == k then -- special case for labels because spaces and pipes v = params:match('label%s*=%s*(%[%[[^%]]+%]%])') or params:match('label%s*=%s*([^|\n]+)') or 'missing label' end table.insert(out, table.concat({k, '\n|', v})) -- make rudimentary wikitable entries end style = content:match('lang_xx_([^|]+)') if not style or ('italic' ~= mw.text.trim (style) and 'inherit' ~= mw.text.trim (style)) then return '<span style="color:#d33">Error: template #invoke calls unknown function</span>' end return table.concat({table.concat(out,'\n|-\n! scope="row" | '), '\n|-\n|colspan="2"|style: ', style, '\n|-\n|}'}) -- add inter-row markup and close the wikitable and done else return '' -- does not use [[Module:Lang]] so abandon quietly end end --[[ -------------------------- < U S E S _ M O D U L E > -------------------------- {{#invoke:Lang/documentor tool|uses_module|template={{ROOTPAGENAME}}}} Reads the content of the template to determine if this {{lang-xx}} template uses Module:Lang. Returns the index of the substring '{{#invoke|lang|' in the template page content if true; empty string if false. Used in template documentation {{#if:}} parser functions. ]] local function uses_module(frame) local page = mw.title.makeTitle('Template', frame.args['template'] or frame.args[1]) -- get a page object for this page in 'Template:' namespace if not page then return '' -- TODO: error message? end local content = page:getContent() -- get unparsed content if not page then return '' -- TODO: error message? end return content:find('{{%s*#invoke:[Ll]ang%s*|') or '' -- return index or empty string end --[[ -------------------------- < S H A R E D _ C O D E > -------------------------- - Tables: -- LANGUAGE_CATEGORIES -- error_messages -- strings - Functions: -- make_error(message, layout, parent_category, nocat) -- get_language_link(language_name, language_code) -- get_see_also_section(page_title, language_name, language_code) -- get_hidden_category_template(frame) -- get_top_section(frame) -- get_bottom_section(frame, language_name, see_also_section, parent_category) ]] local LANGUAGE_CATEGORIES = { ["LANGUAGES_SOURCES"] = "Articles with %s-language sources (%s)", ["LANGUAGES_COLLECTIVE_SOURCES"] = "Articles with %s-collective sources (%s)", ["CS1"] = "CS1 %s-language sources (%s)", ["CS1_SCRIPT"] = "CS1 uses %s-language script (%s)", ["LANGUAGE_TEXT"] = "Articles containing %s-language text", ["LANGUAGES_COLLECTIVE_TEXT"] = "Articles with text in %s", ["ENGLISH"] = "Articles containing explicitly cited %s-language text", ["IPA"] = "Pages with %s IPA" } local error_assistance = " Please see [[Template talk:Lang]] for assistance." local error_messages = { ["ASSISTANCE"] = "Please see [[Template talk:Lang]] for assistance.", ["INCORRECT_CATEGORY_TITLE"] = "[[:%s]] is not the category being populated by the %s template. The correct category is located at: [[:%s]].", ["NO_CATEGORY_TITLE_FOUND"] = "No language category found for '''%s.'''" .. error_assistance, ["NOT_VALID_CATEGORY_FORMAT"] = "'''%s''' is not a a valid category title." .. error_assistance, ["NOT_VALID_LANGUAGE_CODE"] = "[[%s]] is not a valid ISO 639 or IETF language name." .. error_assistance, } local strings = { ["ERROR_CATEGORY"] = "[[Category:Lang and lang-xx template errors]]", ["ERROR_SPAN"] = '<span style="font-size: 100%%; font-style: normal;" class="error">Error: %s </span>', ["PURGE_DIV"] = '<div style="font-size: x-small;">%s</div>', ["SEE_ALSO"] = "\n==See also==", ["SEE_ALSO_ITEM"] = "* [[:%s]]", } --[[ -------------------------- < M A K E _ E R R O R > -------------------------- Create an error message. Does not place page in error category if args.nocat is used. Does not categorize in parent cateogory if used in category namespace (usually for /testcases). ]] local function make_error(message, layout, parent_category, nocat) table.insert(layout, string.format(strings["ERROR_SPAN"], message)) if not nocat then table.insert(layout, strings["ERROR_CATEGORY"]) end if mw.title.getCurrentTitle().nsText == "Category" then table.insert(layout, parent_category) end return table.concat(layout) end --[[ -------------------------- < G E T _ L A N G U A G E _ L I N K > -------------------------- Generates a language link for the correct style. Collective languages use the name_from_tag value, while other languages use a display name of "x-language". ]] local function get_language_link(language_name, language_code) local lang_module = require('Module:Lang') -- Is a language collective? if language_name:find('languages') then return lang_module.name_from_tag({language_code, link = "yes"}) else return lang_module.name_from_tag({language_code, link = "yes", label = lang_module.name_from_tag({language_code}) .. "-language"}) end end --[[ -------------------------- < G E T _ P R I M A R Y _ L A N G U A G E _ C O D E > -------------------------- Returns the primary language for sub-langage variants. ]] local function get_primary_language_code(language_code) -- If no hyphen exists, return nil (for cases like "el") if not language_code:find("-") then return nil end -- Match everything before the first hyphen, but only if a hyphen exists if language_code:match("^-") then return nil -- If the code starts with a hyphen, return nil end -- Look for the first part before any hyphen local primary_code = language_code:match("^[^-]+") return primary_code end --[[ -------------------------- < G E T _ S E E _ A L S O _ S E C T I O N > -------------------------- Generates a consistent style See also section for {{Category articles containing non-English-language text}} and {{Non-English-language source category}}. If {{CS1 language sources}} is converted, it should also use it. ]] local function get_see_also_section(page_title, language_name, language_code) local see_also_section = {} for _, category_name in pairs(LANGUAGE_CATEGORIES) do local category = mw.title.new(string.format(category_name, language_name, language_code), 14) if category and page_title ~= category.text and category.exists then table.insert(see_also_section, string.format(strings["SEE_ALSO_ITEM"], category.prefixedText)) end end table.sort(see_also_section) table.insert(see_also_section, 1, strings["SEE_ALSO"]) if table.getn(see_also_section) == 1 then return "" else return table.concat(see_also_section, "\n") end end --[[ -------------------------- < G E T _ H I D D E N _ C A T E G O R Y _ T E M P L A T E > -------------------------- Generates the Template:Hidden category template. This function is separate from the get_top_section() function as this should be used in both error categories and valid categories. ]] local function get_hidden_category_template(frame) return frame:expandTemplate{title = 'Hidden category'} end --[[ -------------------------- < G E T _ T O P _ S E C T I O N > -------------------------- Generates a consistent top maintenance template section which consists of: -- Template:Possibly empty category -- Template:Purge ]] local function get_top_section(frame) local top_section = {} if mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "all") == 0 then table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category'}) else table.insert(top_section, frame:expandTemplate{title = 'Possibly empty category', args = {hidden=true}}) end local purge_module = require('Module:Purge') table.insert(top_section, string.format(strings["PURGE_DIV"], purge_module._main({"Purge page cache"}))) return table.concat(top_section, "\n\n") end --[[ -------------------------- < G E T _ B O T T O M _ S E C T I O N > -------------------------- Generates a consistent non-text section which consists of: -- Template:Automatic category TOC -- A see also section -- {{DEFAULTSORT}} -- Categorization in parent category ]] local function get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) local bottom_section = {} table.insert(bottom_section, frame:expandTemplate{title = 'Automatic category TOC'}) table.insert(bottom_section, see_also_section) if mw.title.getCurrentTitle().nsText == "श्रेणी" then table.insert(bottom_section, frame:preprocess{text = "{{DEFAULTSORT:" .. language_name .. "}}"}) if parent_language_category then table.insert(bottom_section, "[[" .. parent_language_category .. "]]") end table.insert(bottom_section, parent_category) end return table.concat(bottom_section, "\n\n\n") end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ T E X T _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_text_category}} This function implements {{Non-English-language text category}}. ]] local non_english_language_text_strings = { ["LINE1"] = "This category contains articles with %s%s text. The primary purpose of these categories is to facilitate manual or automated checking of text in other languages.", ["LINE2"] = "This category should only be added with the %s family of templates, never explicitly.", ["LINE3"] = 'For example %s, which wraps the text with %s. Also available is %s which displays as %s.', ["LINE3_SYNTAXHIGHLIGHT"] = "<span lang=\"%s\">", ["IN_SCRIPT"] = " (in %s)", ["EXAMPLE_DEFAULT_TEXT"] = "text in %s language here", ["PARENT_CATEGORY"] = "[[श्रेणी:Articles containing non-Bhojpuri-language text]]", ["TEMPLATE"] = "Lang", ["TEMPLATE2"] = "Langx", } local function non_english_language_text_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end -- Naming style: Articles with text from the Berber languages collective local page_title_modified = page.text local split_title = "([^,]+)%%s([^,]*)" local part1 = "" local part2 = "" if page_title_modified:find('Articles with text in') then -- Naming style: Category:Articles with text from Afro-Asiatic languages (as currently implemented in Module:lang) part1, part2 = LANGUAGE_CATEGORIES["LANGUAGES_COLLECTIVE_TEXT"]:match(split_title) elseif page_title_modified:find('explicitly cited') then part1, part2 = LANGUAGE_CATEGORIES["ENGLISH"]:match(split_title) else -- Naming style: Category:Articles containing French-language text part1, part2 = LANGUAGE_CATEGORIES["LANGUAGE_TEXT"]:match(split_title) end page_title_modified = page_title_modified:gsub(part1, "") page_title_modified = page_title_modified:gsub(part2, "") local language_name = page_title_modified local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_text_strings["PARENT_CATEGORY"] if language_name == page.text then -- Error: Category title format not supported. return make_error(string.format(error_messages["NOT_VALID_CATEGORY_FORMAT"], page.text), layout, parent_category, args.nocat) end local lang_module = require('Module:Lang') local language_code = lang_module._tag_from_name({language_name}) if language_code:find('[Ee]rror') then -- Error: Language code not found in database. return make_error(string.format(error_messages["NOT_VALID_LANGUAGE_CODE"], language_name), layout, parent_category, args.nocat) end local correct_language_category_title = lang_module._category_from_tag({language_code}) if correct_language_category_title:find('[Ee]rror') then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if current_category_title ~= correct_language_category_title then -- Error: The current title used is not in the supported format. TODO: can this still be reached? return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, frame:expandTemplate{title = 'Tlx', args = {non_english_language_text_strings["TEMPLATE"]}}, correct_language_category_title), layout, parent_category, args.nocat) end table.insert(layout, get_top_section(frame)) local script_text = "" if args.script then script_text = string.format(non_english_language_text_strings["IN_SCRIPT"], args.script) end local language_link = get_language_link(language_name, language_code) table.insert(layout, string.format(non_english_language_text_strings["LINE1"], language_link, script_text)) local lang_template = frame:expandTemplate{title = 'Tl', args = {non_english_language_text_strings["TEMPLATE"]}} table.insert(layout, string.format(non_english_language_text_strings["LINE2"], lang_template)) local language_code_link = lang_module._name_from_tag({language_code, link="yes", label=language_code}) local example_default_text = string.format(non_english_language_text_strings["EXAMPLE_DEFAULT_TEXT"], language_name) local example_text = args.example or example_default_text local lang_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE"], language_code_link, example_text}} local langx_args = {non_english_language_text_strings["TEMPLATE2"], language_code_link, example_text} local langx_template_example = frame:expandTemplate{title = "Tlx", args = {non_english_language_text_strings["TEMPLATE2"], language_code, example_text}} local langx_template_code = frame:expandTemplate{title = non_english_language_text_strings["TEMPLATE2"], args = {language_code, example_text}} -- Strip private use subtag from code tag because this is what [[Module:Lang]] does. local language_code_without_private_use = language_code:gsub("%-x%-.*", "") -- Wrap in syntaxhighlight. local syntaxhighlight = frame:extensionTag( "syntaxhighlight", string.format(non_english_language_text_strings["LINE3_SYNTAXHIGHLIGHT"], language_code_without_private_use), {lang = "html", inline = true} ) table.insert(layout, string.format(non_english_language_text_strings["LINE3"], lang_template_example, syntaxhighlight, langx_template_example, langx_template_code)) local see_also_section = get_see_also_section(page.text, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = lang_module._category_from_tag({parent_language_code}) end local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_text_strings["PARENT_CATEGORY"], parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_sources_category}} This function implements {{Non-English-language sources category}}. ]] local non_english_language_sources_strings = { ["LINE1"] = "This is a tracking category for articles that use %s to identify %s sources.", ["PARENT_CATEGORY"] = "[[श्रेणी:Articles with non-Bhojpuri-language sources]]", ["TEMPLATE"] = "In lang", } local function non_english_language_sources_category(frame) local page = mw.title.getCurrentTitle() local args = require('Module:Arguments').getArgs(frame) -- args.test is used for /testcases if args.test then page = mw.title.new(args.test) end local page_title = page.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local parent_category = non_english_language_sources_strings["PARENT_CATEGORY"] local in_lang_module = require('Module:In lang') local correct_language_category_title = in_lang_module._in_lang({language_code, ["list-cats"]="yes"}) if correct_language_category_title == "" then -- Error: No category title found for language code. return make_error(string.format(error_messages["NO_CATEGORY_TITLE_FOUND"], language_code), layout, parent_category, args.nocat) end local current_category_title = page.prefixedText if correct_language_category_title ~= current_category_title then -- Error: The current title used is not in the supported format. return make_error( string.format(error_messages["INCORRECT_CATEGORY_TITLE"], current_category_title, frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"]}}, correct_language_category_title), layout, parent_category, args.nocat) end local language_link = get_language_link(language_name, language_code) local text = string.format(non_english_language_sources_strings["LINE1"], frame:expandTemplate{title = 'Tlx', args = {non_english_language_sources_strings["TEMPLATE"], language_code}}, language_link) table.insert(layout, get_top_section(frame)) table.insert(layout, text) local see_also_section = get_see_also_section(page_title, language_name, language_code) local parent_language_code = get_primary_language_code(language_code) local parent_language_category if parent_language_code then parent_language_category = in_lang_module._in_lang({parent_language_code, ["list-cats"]="yes"}) end local bottom = get_bottom_section(frame, language_name, see_also_section, parent_category, parent_language_category) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < N O N _ E N G L I S H _ L A N G U A G E _ C S 1 _ S O U R C E S _ C A T E G O R Y > -------------------------- {{#invoke:Lang/documentor tool|non_english_language_cs1_sources_category}} This function implements {{Non-English-language CS1 sources category}}. ]] local non_english_language_cs1_text_strings = { ["LINE1"] = "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to identify a source in [[%s language|%s]]. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", ["PARENT_CATEGORY"] = "[[Category:CS1 foreign language sources]]", -- #TODO change to "Articles with non-english CS1 language sources" or "CS1 non-English language sources" } --"This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", --"[[Category:CS1 uses foreign language script]]", -- "This is a tracking category for [[WP:CS1|CS1 citations]] that use the parameter %s. Pages in this category should only be added by CS1 templates and [[Module:Citation/CS1]].", -- "to identify a source in [[%s language|%s]].", -- "to hold a citation title that uses %s characters and contains the language prefix <code>%s:</code>.", local function non_english_language_cs1_sources_category(frame) local page_title_object = mw.title.getCurrentTitle() local page_title = page_title_object.text local language_code = page_title:match('%(([%a%-]+)%)') local language_name = require('Module:Lang')._name_from_tag({language_code}) local layout = {} table.insert(layout, get_hidden_category_template(frame)) local see_also_section = "" local parameter_doc = frame:expandTemplate{title = 'para', args = {"language", language_code}} table.insert(layout, get_top_section(frame)) table.insert(layout, string.format(non_english_language_cs1_text_strings["LINE1"], parameter_doc, language_name, language_name)) local see_also_section = get_see_also_section(page_title, language_name, language_code) local bottom = get_bottom_section(frame, language_name, see_also_section, non_english_language_cs1_text_strings["PARENT_CATEGORY"]) return table.concat(layout, "\n\n") .. bottom end --[[ -------------------------- < T E S T _ C A S E S _ S H A R E D _ C O D E > -------------------------- ]] local function compare_by_keys2(a, b) -- local function used by table.sort() return a[2] < b[2] -- ascending sort by code end local function compare_by_keys(a, b) -- local function used by table.sort() return a[1] < b[1] -- ascending sort by code end -- Used by testcases_iso_code_to_name() local function get_language_code_table_from_code(args) local entry = {} --if args.override_table[args.language_code] then -- table.insert(entry, args.override_table[args.language_code][1]) -- :gsub(' %b()$', '') fails here --else table.insert(entry, args.language_code) -- end return entry end -- Used by testcases_name_from_tag() local function get_language_code_and_name_table_from_code(args) local entry = {} if args.override_table and args.override_table[args.language_code] then table.insert(entry, args.language_code) local language_code, _ = args.override_table[args.language_code][1]:gsub(' %b()$', '') table.insert(entry, language_code) else table.insert(entry, args.language_code) table.insert(entry, args.language_table[args.language_code]) end return entry end -- Used by testcases_category_from_tag() local function get_language_code_and_category_table_from_code(args) local entry = {} table.insert(entry, args.language_code) table.insert(entry, args.test_function({args.language_code})) return entry end -- Used by testcases_iso_name_to_code() and testcases_tag_from_name() local function get_language_name_and_code_table_from_code(args) local entry = {} if args.override_table[args.language_code] then table.insert(entry, args.override_table[args.language_code][1]) -- only the first name when there are multiples table.insert(entry, args.language_code) else table.insert(entry, args.language_names[1]) -- only the first name when there are multiples table.insert(entry, args.language_code) end return entry end local function get_table(table_function, language_table, length, range, iso_number, test_function) local table_of_language_name_and_code_tables = {} local override_table_name = "override" if iso_number then override_table_name = "override_" .. iso_number end local override_table = require("Module:ISO 639 name/ISO_639_override/sandbox")[override_table_name] -- For most ISO 639s. if range then for language_code, language_names in pairs(language_table) do if language_code:find(range) then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For ISO 639-1. elseif length then for language_code, language_names in pairs(language_table) do if language_code:len() == 2 then table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end -- For general /testcases. else for language_code, language_names in pairs(language_table) do table.insert(table_of_language_name_and_code_tables, table_function({ override_table = override_table, language_code = language_code, language_names = language_names, test_function = test_function, language_table = language_table })) end end return table_of_language_name_and_code_tables end local function get_undabbed_table(language_list, length, range) local undabbed_language_table = {} -- for this test, ISO 639-3 language name disambiguators must be removed; un-dabbed names go here for language_code, language_names in pairs(language_list) do -- For most ISO 639s. if range then if language_code:find(range) then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For ISO 639-1. elseif length then if language_code:len() == 2 then undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') -- undab and save only the first name; ignore all other names assigned to a code end -- For general /testcases. else undabbed_language_table[language_code] = language_names[1]:gsub(' %b()$', '') end end return undabbed_language_table end --[[ -------------------------- < T E S T C A S E S _ C A T E G O R Y _ F R O M _ T A G > -------------------------- Entry point for the various category_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<category name according to Module:Lang>"} - "Expected" column value is the category name according to Module:Lang. - "Actual" column value is the result of {{#invoke:Lang/sandbox|category_from_tag|<language_code>}}. TODO: Currently not working. ]] local function testcases_category_from_tag(self, args) local cat_from_tag_function = require('Module:Lang')._category_from_tag local language_tables = get_table(get_language_code_and_category_table_from_code, args.language_list, args.length, args.range, args.iso_number, cat_from_tag_function) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|category_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ N A M E _ F R O M _ T A G > -------------------------- Entry point for the various name_from_tag testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_code>", "<language_name>"} - "Expected" column value is the <language_name>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|name_from_tag|<language_code>}}. ]] local function testcases_name_from_tag(self, args) local undabbed_language_table = get_undabbed_table(args.language_list, args.length, args.range, nil) local language_tables = get_table(get_language_code_and_name_table_from_code, undabbed_language_table, args.length, args.range) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|name_from_tag|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ T A G _ F R O M _ N A M E > -------------------------- Entry point for the various tag_from_name testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column value is the result of sandbox version {{#invoke:Lang/sandbox|tag_from_name|<language_name>}}. TODO: Currently not working. ]] local function testcases_tag_from_name(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) local ordered_table = {} table.sort(unordered_table) for _, key in ipairs(unordered_table) do table.insert(ordered_table, {key, reverse_table[key]}) end self:preprocess_equals_preprocess_many( '{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ C O D E _ T O _ N A M E > -------------------------- Entry point for the various iso_code_to_name testcases. Build a table of test patterns where each entry in the table is a table with one member: {"<language_code>"} - "Expected" column value is the result of the live version of {{#invoke:ISO 639 name|iso_639_name_to_code|<language_code>}}. - "Actual" column value is the result of sandbox version {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_code>}}. ]] local function testcases_iso_code_to_name(self, args) local language_tables = get_table(get_language_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_code_to_name|link=yes|', '}}', '{{#invoke:ISO 639 name|iso_639_code_to_name|link=yes|', '}}', language_tables, {nowiki=false} ) end --[[ -------------------------- < T E S T C A S E S _ I S O _ N A M E _ T O _ C O D E > -------------------------- Entry point for the various iso_name_to_code testcases. Build a table of test patterns where each entry in the table is a table with two members: {"<language_name>", "<language_code>"} - "Expected" column value is the <language_code>. - "Actual" column is value the result of {{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|<language_name>}}. ]] local function testcases_iso_name_to_code(self, args) local language_tables = get_table(get_language_name_and_code_table_from_code, args.language_list, args.length, args.range, args.iso_number, nil) table.sort(language_tables, compare_by_keys2) self:preprocess_equals_preprocess_many( '{{#invoke:ISO 639 name/sandbox|iso_639_name_to_code|2=' .. args.iso_number .. "|", '}}', '', '', language_tables, {nowiki=false} ) end --[[--------------------------< S E E _ A L S O >-------------------------------------------------------------- adds items to the list of items in §See also section of Template:Lang-x/doc; Evaluates single positional parameter which is a comma-separated list of items including list markup. {{#invoke:Lang/documentor tool|see_also|*{{tl|Lang-tt-Cyrl}}, *{{tl|Lang-tt-Latn}}, *{{tl|Lang-tt-Arab}}}} ]] local function see_also (frame) if nil == frame.args[1] or '' == frame.args[1] then -- if empty, ... return -- ... return nothing end return frame:preprocess (frame.args[1]:gsub ('%s*,%s', '\n')) -- preprocess so any templates are rendered before saving and done end --[[ -------------------------< E X P O R T E D _ F U N C T I O N S > ----------------------------------------- ]] return { lang_xx_settings = lang_xx_settings, uses_module = uses_module, see_also = see_also, non_english_language_text_category = non_english_language_text_category, non_english_language_sources_category = non_english_language_sources_category, non_english_language_cs1_sources_category = non_english_language_cs1_sources_category, private_tags = private_tags, -- Module:Lang testcases testcases_category_from_tag = testcases_category_from_tag, testcases_name_from_tag = testcases_name_from_tag, testcases_tag_from_name = testcases_tag_from_name, -- Module:ISO 639 name testcases testcases_iso_code_to_name = testcases_iso_code_to_name, testcases_iso_name_to_code = testcases_iso_name_to_code, } dl32jny6b040uespy93wo90xaamcvsf टेम्पलेट:In lang 10 74867 796622 670398 2020-09-19T16:34:44Z en>Trappist the monk 0 use [[Module:In lang]]; 796622 wikitext text/x-wiki {{#invoke:In lang|in_lang|template=in lang<noinclude>|{{CONTENTLANGUAGE}}</noinclude>}}<noinclude> {{documentation}} </noinclude> szbgb2lf6rekweszdnzzmouvi00fwpl 796623 712056 2026-06-06T02:18:28Z SM7 3953 1 revision imported from [[:en:Template:In_lang]] 712056 wikitext text/x-wiki {{#invoke:In lang|in_lang|template=in lang<noinclude>|{{CONTENTLANGUAGE}}</noinclude>}}<noinclude> {{documentation}} </noinclude> szbgb2lf6rekweszdnzzmouvi00fwpl जयप्रकाश नारायण अंतराष्ट्रीय हवाईअड्डा 0 76294 796493 700424 2026-06-05T12:34:02Z SM7 3953 सफाई कइल गइल, सुधार कइल गइल 796493 wikitext text/x-wiki {{Infobox airport | name = जयप्रकाश नारायण अंतराष्ट्रीय हवाईअड्डा | IATA = PAT | ICAO = VEPT | pushpin_map = India Patna#Bihar#India#Asia | pushpin_label = '''PAT''' | type = सरकारी | owner = [[Airports Authority of India]] | operator = [[Airports Authority of India]] | city-served = [[पटना]], [[बिहार]], [[भारत]] | location = <!--only if different than above--> | metric-elev = yes | elevation-f = 170 | elevation-m = 52 | coordinates = {{Coord|25|35|37|N|085|05|31|E|region:IN_type:airport|display=inline,title}} | website = | metric-rwy = y | r1-number = 07/25 | r1-length-m = 2072 | r1-length-f = 6798 | r1-surface = [[Asphalt]] | stat1-header = Passengers | stat1-data = 4,525,765({{increase}} 11.4%) | stat-year = March 2019 - March 2020 | stat2-header = Aircraft movements | stat2-data = 30,959({{increase}} 10.2%) | stat3-header = Cargo tonnage | stat3-data = 12,249 ({{increase}} 7.1%) | footnotes = Source: [[Airport Authority of India|AAI]]<ref name="traffic_stats1">{{cite web|url=https://www.aai.aero/sites/default/files/traffic-news/Jan2k20Annex3.pdf|title=Traffic News for the month of March 2019: Annexure-III|work=[[Airports Authority of India]]|date=1 May 2019|access-date=1 May 2019|page=3}}</ref><ref name="traffic_stats2">{{cite web|url=https://www.aai.aero/sites/default/files/traffic-news/Jan2k20Annex2.pdf|title=Traffic News for the month of January 2020: Annexure-II|work=[[Airports Authority of India]]}}</ref><ref name="traffic_stats3">{{cite web|url=https://www.aai.aero/sites/default/files/traffic-news/Mar2k18annex4.pdf|title=Traffic News for the month of January 2020: Annexure-IV|work=[[Airports Authority of India]]|date=January 2020}}</ref><ref name="cargo_stats4">{{cite web|url= https://www.aai.aero/sites/default/files/traffic-news/Jan2k20Annex4.pdf| title=Cargo News for January 2020}}</ref> }} '''जयप्रकाश नारायण अंतराष्ट्रीय हवाईअड्डा''' [[बिहार]] के राजधानी [[पटना]] मे एगो [[हवाईअड्डा]] बा। एकर नांव स्वतंत्रता सेनानी [[जयप्रकाश नारायण]] के नांव प धइल बाटे। ई [[भारत]] के चउदहमा सभ से बिजी हवाईअड्डा हटे। अबहिन एकर बिस्तार काज चलऽता जेवन की 2021 ले पुराई। == बिस्तार == एकर रनवे 7000 फीट लाम बाटे आ ई पटना चिड़ियाखाना आ फुलवारी शरीफ रेलवे स्टेशन के बीचे बाटे। रनवे पुरुब से 1937 मीटर आ पक्खिम् से 1677 मीटर लाम बाटे। == संदर्भ == {{Reflist|29em}} [[श्रेणी:भारत के हवाईअड्डा]] {{India-airport-stub}} 9knogwwom3jhml0r2l58f30tynbl5wa Module:In lang 828 84425 796652 779825 2025-11-11T13:56:46Z en>Trappist the monk 0 796652 Scribunto text/plain require('strict'); --[[--------------------------< _ I N _ L A N G >-------------------------------------------------------------- implements {{in lang}} Module entry point from another module |link=yes - creates wikilinked language names |template=<template name> - customizes error messages created by Module:lang |list-cats=yes - documentation tool returns language-category names of cats populated by this template <span class="languageicon">(in <language>)</span> ]] local function _in_lang (args) local yesno = require('Module:Yesno') local synonym_table = mw.loadData ('Module:Lang/ISO 639 synonyms'); -- ISO 639-2/639-2T code translation to 639-1 code local list_cats = 'yes' == args['list-cats']; -- make a boolean local list = {}; local cats = {}; local maint_msgs = {}; if not args[1] then local template = (args['template'] and table.concat ({'{{', args['template'], '}}: '})) or ''; -- make template name (if provided by the template) return table.concat ({'<span style=\"color:#d33\">error: ', template, 'missing language tag</span>'}); end local module = 'Module:Lang' .. (mw.getCurrentFrame():getTitle():match ('/sandbox') or ''); -- if this module is the sandbox, local name_from_tag = require (module)._name_from_tag; -- use Module:Lang/sandbox; Module:Lang else local namespace = mw.title.getCurrentTitle().namespace; -- used for categorization local this_wiki_lang = mw.language.getContentLanguage().code; -- get this wiki's language code local override_t = mw.loadData ('Module:Lang/data').override; -- this table holds IETF tag/name definitions known to Module:Lang for i, lang in ipairs (args) do local code = args[i]:lower(); local t = {code, ['link'] = args['link'], ['template'] = args['template']}; -- build an 'args' table lang = name_from_tag (t) -- get the language name table.insert (list, lang) -- add this language or error message to the list if code:find ('%-') and not override_t[code] then -- except for the IETF tags listed in <override_t> code = code:match ('^%a%a%a?%f[^%a]'); -- strip off region, script, and variant subtags so that they aren't used to make category names end if synonym_table[code] then -- if 639-2/639-2T code has a 639-1 synonym if (0 == namespace) and not list_cats then -- when listing cats don't include this cat; TODO: right choice? table.insert (cats, table.concat ({'[[Category:Lang and lang-xx code promoted to ISO 639-1|', code ..']]'})); end table.insert (maint_msgs, ' <span class="lang-comment" style="font-style:normal; display:none; color:#33aa33; margin-left:0.3em">') table.insert (maint_msgs, table.concat ({'code: ', code, ' promoted to code: ', synonym_table[code]})); table.insert (maint_msgs, ';</span>'); code = synonym_table[code]; -- use the synonym end if (0 == namespace) or list_cats then -- when in article space if lang:find ('[Ee]rror') then -- add error category (message provided by Module:Lang) if not list_cats then -- don't include this cat when listing cats; TODO: right choice? table.insert (cats, '[[Category:in lang template errors]]'); end elseif this_wiki_lang ~= code:match ('^%a%a%a?') then -- categorize article only when code is not this wiki's language code or variants thereof if lang:match ('%[%[.-|.-%]%]') then -- wikilinked individual language name lang = lang:match ('%[%[.-|(.-)%]%]'); elseif lang:match ('%[%[.-%]%]') then -- wikilinked collective languages name lang = lang:match ('%[%[(.-)%]%]'); end -- neither of these then plain-text language name if lang:find ('languages') then -- add appropriate language-name category table.insert (cats, table.concat ({'[[Category:Articles with sources in ', lang, ' (', code, ')]]'})); else table.insert (cats, table.concat ({'[[Category:Articles with ', lang, '-language sources (', code, ')]]'})); end end end end if list_cats then local cats = table.concat (cats, ', '):gsub ('[%[%]]', ''); -- make a string of categories and then strip wikilink markup return cats end local capBoolean = yesno(args['cap']) or yesno(args['caps']) local result = {'<span class="languageicon">('}; -- opening span and ( table.insert (result, capBoolean and 'In ' or 'in '); -- add capitalized or uncapitalized 'in' table.insert (result, mw.text.listToText (list, ', ', (2 < #list) and ', and ' or ' and ' )); -- and concatenate the language list table.insert (result, ')</span>'); -- add closing ) and closing span table.insert (result, table.concat (maint_msgs) or ''); -- add maint messages, if any table.insert (result, table.concat (cats)); -- add categories return table.concat (result); -- make a big string and done end --[[--------------------------< I N _ L A N G >---------------------------------------------------------------- implements {{in lang}} Module entry point from an {{#invoke:lang/utilities/sanbox|in_lang|<code>|<code2>|<code3>|<code...>|link=yes|template=in lang|list-cats=yes}} ]] local function in_lang (frame) local args = require ('Module:Arguments').getArgs (frame); return _in_lang (args); end --[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------ ]] return { in_lang = in_lang, -- module entry from {{#invoke:}} _in_lang = _in_lang, -- module entry from another module } 7grnzcal7l91wobu0cylp19un0mmv1z 796653 796652 2026-06-06T02:20:30Z SM7 3953 1 revision imported from [[:en:Module:In_lang]] 796652 Scribunto text/plain require('strict'); --[[--------------------------< _ I N _ L A N G >-------------------------------------------------------------- implements {{in lang}} Module entry point from another module |link=yes - creates wikilinked language names |template=<template name> - customizes error messages created by Module:lang |list-cats=yes - documentation tool returns language-category names of cats populated by this template <span class="languageicon">(in <language>)</span> ]] local function _in_lang (args) local yesno = require('Module:Yesno') local synonym_table = mw.loadData ('Module:Lang/ISO 639 synonyms'); -- ISO 639-2/639-2T code translation to 639-1 code local list_cats = 'yes' == args['list-cats']; -- make a boolean local list = {}; local cats = {}; local maint_msgs = {}; if not args[1] then local template = (args['template'] and table.concat ({'{{', args['template'], '}}: '})) or ''; -- make template name (if provided by the template) return table.concat ({'<span style=\"color:#d33\">error: ', template, 'missing language tag</span>'}); end local module = 'Module:Lang' .. (mw.getCurrentFrame():getTitle():match ('/sandbox') or ''); -- if this module is the sandbox, local name_from_tag = require (module)._name_from_tag; -- use Module:Lang/sandbox; Module:Lang else local namespace = mw.title.getCurrentTitle().namespace; -- used for categorization local this_wiki_lang = mw.language.getContentLanguage().code; -- get this wiki's language code local override_t = mw.loadData ('Module:Lang/data').override; -- this table holds IETF tag/name definitions known to Module:Lang for i, lang in ipairs (args) do local code = args[i]:lower(); local t = {code, ['link'] = args['link'], ['template'] = args['template']}; -- build an 'args' table lang = name_from_tag (t) -- get the language name table.insert (list, lang) -- add this language or error message to the list if code:find ('%-') and not override_t[code] then -- except for the IETF tags listed in <override_t> code = code:match ('^%a%a%a?%f[^%a]'); -- strip off region, script, and variant subtags so that they aren't used to make category names end if synonym_table[code] then -- if 639-2/639-2T code has a 639-1 synonym if (0 == namespace) and not list_cats then -- when listing cats don't include this cat; TODO: right choice? table.insert (cats, table.concat ({'[[Category:Lang and lang-xx code promoted to ISO 639-1|', code ..']]'})); end table.insert (maint_msgs, ' <span class="lang-comment" style="font-style:normal; display:none; color:#33aa33; margin-left:0.3em">') table.insert (maint_msgs, table.concat ({'code: ', code, ' promoted to code: ', synonym_table[code]})); table.insert (maint_msgs, ';</span>'); code = synonym_table[code]; -- use the synonym end if (0 == namespace) or list_cats then -- when in article space if lang:find ('[Ee]rror') then -- add error category (message provided by Module:Lang) if not list_cats then -- don't include this cat when listing cats; TODO: right choice? table.insert (cats, '[[Category:in lang template errors]]'); end elseif this_wiki_lang ~= code:match ('^%a%a%a?') then -- categorize article only when code is not this wiki's language code or variants thereof if lang:match ('%[%[.-|.-%]%]') then -- wikilinked individual language name lang = lang:match ('%[%[.-|(.-)%]%]'); elseif lang:match ('%[%[.-%]%]') then -- wikilinked collective languages name lang = lang:match ('%[%[(.-)%]%]'); end -- neither of these then plain-text language name if lang:find ('languages') then -- add appropriate language-name category table.insert (cats, table.concat ({'[[Category:Articles with sources in ', lang, ' (', code, ')]]'})); else table.insert (cats, table.concat ({'[[Category:Articles with ', lang, '-language sources (', code, ')]]'})); end end end end if list_cats then local cats = table.concat (cats, ', '):gsub ('[%[%]]', ''); -- make a string of categories and then strip wikilink markup return cats end local capBoolean = yesno(args['cap']) or yesno(args['caps']) local result = {'<span class="languageicon">('}; -- opening span and ( table.insert (result, capBoolean and 'In ' or 'in '); -- add capitalized or uncapitalized 'in' table.insert (result, mw.text.listToText (list, ', ', (2 < #list) and ', and ' or ' and ' )); -- and concatenate the language list table.insert (result, ')</span>'); -- add closing ) and closing span table.insert (result, table.concat (maint_msgs) or ''); -- add maint messages, if any table.insert (result, table.concat (cats)); -- add categories return table.concat (result); -- make a big string and done end --[[--------------------------< I N _ L A N G >---------------------------------------------------------------- implements {{in lang}} Module entry point from an {{#invoke:lang/utilities/sanbox|in_lang|<code>|<code2>|<code3>|<code...>|link=yes|template=in lang|list-cats=yes}} ]] local function in_lang (frame) local args = require ('Module:Arguments').getArgs (frame); return _in_lang (args); end --[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------ ]] return { in_lang = in_lang, -- module entry from {{#invoke:}} _in_lang = _in_lang, -- module entry from another module } 7grnzcal7l91wobu0cylp19un0mmv1z 796654 796653 2026-06-06T02:31:48Z SM7 3953 श्रेणी नाँव सुधारल गइल / अनुबाद 796654 Scribunto text/plain require('strict'); --[[--------------------------< _ I N _ L A N G >-------------------------------------------------------------- implements {{in lang}} Module entry point from another module |link=yes - creates wikilinked language names |template=<template name> - customizes error messages created by Module:lang |list-cats=yes - documentation tool returns language-category names of cats populated by this template <span class="languageicon">(in <language>)</span> ]] local function _in_lang (args) local yesno = require('Module:Yesno') local synonym_table = mw.loadData ('Module:Lang/ISO 639 synonyms'); -- ISO 639-2/639-2T code translation to 639-1 code local list_cats = 'yes' == args['list-cats']; -- make a boolean local list = {}; local cats = {}; local maint_msgs = {}; if not args[1] then local template = (args['template'] and table.concat ({'{{', args['template'], '}}: '})) or ''; -- make template name (if provided by the template) return table.concat ({'<span style=\"color:#d33\">error: ', template, 'missing language tag</span>'}); end local module = 'Module:Lang' .. (mw.getCurrentFrame():getTitle():match ('/sandbox') or ''); -- if this module is the sandbox, local name_from_tag = require (module)._name_from_tag; -- use Module:Lang/sandbox; Module:Lang else local namespace = mw.title.getCurrentTitle().namespace; -- used for categorization local this_wiki_lang = mw.language.getContentLanguage().code; -- get this wiki's language code local override_t = mw.loadData ('Module:Lang/data').override; -- this table holds IETF tag/name definitions known to Module:Lang for i, lang in ipairs (args) do local code = args[i]:lower(); local t = {code, ['link'] = args['link'], ['template'] = args['template']}; -- build an 'args' table lang = name_from_tag (t) -- get the language name table.insert (list, lang) -- add this language or error message to the list if code:find ('%-') and not override_t[code] then -- except for the IETF tags listed in <override_t> code = code:match ('^%a%a%a?%f[^%a]'); -- strip off region, script, and variant subtags so that they aren't used to make category names end if synonym_table[code] then -- if 639-2/639-2T code has a 639-1 synonym if (0 == namespace) and not list_cats then -- when listing cats don't include this cat; TODO: right choice? table.insert (cats, table.concat ({'[[Category:Lang and lang-xx code promoted to ISO 639-1|', code ..']]'})); end table.insert (maint_msgs, ' <span class="lang-comment" style="font-style:normal; display:none; color:#33aa33; margin-left:0.3em">') table.insert (maint_msgs, table.concat ({'code: ', code, ' promoted to code: ', synonym_table[code]})); table.insert (maint_msgs, ';</span>'); code = synonym_table[code]; -- use the synonym end if (0 == namespace) or list_cats then -- when in article space if lang:find ('[Ee]rror') then -- add error category (message provided by Module:Lang) if not list_cats then -- don't include this cat when listing cats; TODO: right choice? table.insert (cats, '[[Category:in lang template errors]]'); end elseif this_wiki_lang ~= code:match ('^%a%a%a?') then -- categorize article only when code is not this wiki's language code or variants thereof if lang:match ('%[%[.-|.-%]%]') then -- wikilinked individual language name lang = lang:match ('%[%[.-|(.-)%]%]'); elseif lang:match ('%[%[.-%]%]') then -- wikilinked collective languages name lang = lang:match ('%[%[(.-)%]%]'); end -- neither of these then plain-text language name if lang:find ('languages') then -- add appropriate language-name category table.insert (cats, table.concat ({'[[श्रेणी:लेख जिनहन में स्रोत के भाषा ', lang, ' (', code, ') बाटे]]'})); else table.insert (cats, table.concat ({'[[श्रेणी:लेख जिनहन में ', lang, '-भाषा के स्रोत बाटे (', code, ')]]'})); end end end end if list_cats then local cats = table.concat (cats, ', '):gsub ('[%[%]]', ''); -- make a string of categories and then strip wikilink markup return cats end local capBoolean = yesno(args['cap']) or yesno(args['caps']) local result = {'<span class="languageicon">('}; -- opening span and ( table.insert (result, capBoolean and 'In ' or 'in '); -- add capitalized or uncapitalized 'in' table.insert (result, mw.text.listToText (list, ', ', (2 < #list) and ', and ' or ' and ' )); -- and concatenate the language list table.insert (result, ')</span>'); -- add closing ) and closing span table.insert (result, table.concat (maint_msgs) or ''); -- add maint messages, if any table.insert (result, table.concat (cats)); -- add categories return table.concat (result); -- make a big string and done end --[[--------------------------< I N _ L A N G >---------------------------------------------------------------- implements {{in lang}} Module entry point from an {{#invoke:lang/utilities/sanbox|in_lang|<code>|<code2>|<code3>|<code...>|link=yes|template=in lang|list-cats=yes}} ]] local function in_lang (frame) local args = require ('Module:Arguments').getArgs (frame); return _in_lang (args); end --[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------ ]] return { in_lang = in_lang, -- module entry from {{#invoke:}} _in_lang = _in_lang, -- module entry from another module } 8dtusud28zv090kmgdbzu1be82fv051 टेम्पलेट:Non-English-language sources category 10 85319 796655 2019-08-12T13:33:28Z en>Trappist the monk 0 create; 796655 wikitext text/x-wiki {{Polluted category}} {{Tracking category}} {{#ifeq:{{PAGESINCATEGORY:{{{1|}}}}}|0|{{Possibly empty category}}}} This is a tracking category for articles that use {{tlx|in lang|{{#invoke:string|match|s={{{1|}}}|pattern=%(([%a%-]+)%)|plain=false}}}} to identify [[{{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}} language|{{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language]] sources. {{#if:{{#ifexist:Category:Articles containing {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}}|pattern=%(([%a%-]+)%)|plain=false}}}}-language text|1}}{{#ifexist:Category:Articles with {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language external links|1}}{{#ifexist:Category:CS1 {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language sources ({{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}})|1}}| ==See also== }}{{#ifexist:Category:Articles containing {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}}|pattern=%(([%a%-]+)%)|plain=false}}}}-language text| *[[:Category:Articles containing {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language text]]}}{{#ifexist:Category:Articles with {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language external links| *[[:Category:Articles with {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language external links]]}}{{#ifexist:Category:CS1 {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language sources ({{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}})| *[[:Category:CS1 {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language sources ({{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}})‎]]}} [[Category:Articles_with_non-English-language_sources|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}]] goszwvepbtdl538jftqua3ax8x1yyw0 796656 796655 2019-08-12T13:36:17Z en>Trappist the monk 0 hide errors; 796656 wikitext text/x-wiki <includeonly>{{Polluted category}} {{Tracking category}} {{#ifeq:{{PAGESINCATEGORY:{{{1|}}}}}|0|{{Possibly empty category}}}} This is a tracking category for articles that use {{tlx|in lang|{{#invoke:string|match|s={{{1|}}}|pattern=%(([%a%-]+)%)|plain=false}}}} to identify [[{{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}} language|{{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language]] sources. {{#if:{{#ifexist:Category:Articles containing {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}}|pattern=%(([%a%-]+)%)|plain=false}}}}-language text|1}}{{#ifexist:Category:Articles with {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language external links|1}}{{#ifexist:Category:CS1 {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language sources ({{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}})|1}}| ==See also== }}{{#ifexist:Category:Articles containing {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}}|pattern=%(([%a%-]+)%)|plain=false}}}}-language text| *[[:Category:Articles containing {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language text]]}}{{#ifexist:Category:Articles with {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language external links| *[[:Category:Articles with {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language external links]]}}{{#ifexist:Category:CS1 {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language sources ({{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}})| *[[:Category:CS1 {{#invoke:lang|name_from_code|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language sources ({{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}})‎]]}} [[Category:Articles_with_non-English-language_sources|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}]]</includeonly><noinclude>{{documentation}}</noinclude> pxyu8mc1pp1e895h4dklky5ef19a948 796657 796656 2019-10-20T14:33:20Z en>Trappist the monk 0 lang function name change; 796657 wikitext text/x-wiki <includeonly>{{Polluted category}} {{Tracking category}} {{#ifeq:{{PAGESINCATEGORY:{{{1|}}}}}|0|{{Possibly empty category}}}} This is a tracking category for articles that use {{tlx|in lang|{{#invoke:string|match|s={{{1|}}}|pattern=%(([%a%-]+)%)|plain=false}}}} to identify [[{{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}} language|{{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language]] sources. {{#if:{{#ifexist:Category:Articles containing {{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}}|pattern=%(([%a%-]+)%)|plain=false}}}}-language text|1}}{{#ifexist:Category:Articles with {{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language external links|1}}{{#ifexist:Category:CS1 {{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language sources ({{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}})|1}}| ==See also== }}{{#ifexist:Category:Articles containing {{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}}|pattern=%(([%a%-]+)%)|plain=false}}}}-language text| *[[:Category:Articles containing {{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language text]]}}{{#ifexist:Category:Articles with {{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language external links| *[[:Category:Articles with {{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language external links]]}}{{#ifexist:Category:CS1 {{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language sources ({{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}})| *[[:Category:CS1 {{#invoke:lang|name_from_tag|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}}}-language sources ({{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}})‎]]}} [[Category:Articles_with_non-English-language_sources|{{#invoke:string|match|s={{{1|}}} |pattern=%(([%a%-]+)%)|plain=false}}]]</includeonly><noinclude>{{documentation}}</noinclude> 8c7qngy84k4qyk9xe0nshbmy9gsfbno 796658 796657 2019-11-24T19:30:52Z en>Trappist the monk 0 use [[Module:Lang/documentor tool]] 796658 wikitext text/x-wiki <includeonly>{{Polluted category}} {{Tracking category}} {{#ifeq:{{PAGESINCATEGORY:{{{1|}}}}}|0|{{Possibly empty category}}}} {{#invoke:lang/documentor tool|non_en_src_cat|{{{1|}}}}}</includeonly><noinclude>{{documentation}}</noinclude> tkrfmadgnblze5liiuowyy6p2ipwrcf 796659 796658 2020-09-19T16:56:23Z en>Gonnym 0 module now handles this as well 796659 wikitext text/x-wiki <includeonly>{{#invoke:Lang/documentor tool|non_en_src_cat}}</includeonly> <noinclude> {{Documentation}} </noinclude> cz03tr7umqajd369p66ftair0qkhjya 796660 796659 2020-09-22T10:35:38Z en>Gonnym 0 updating function name 796660 wikitext text/x-wiki <includeonly>{{#invoke:Lang/documentor tool|non_english_language_sources_category}}</includeonly> <noinclude> {{Documentation}} </noinclude> tth392pjya3d72u358xiaffc3eucl79 796661 796660 2020-09-22T10:39:47Z en>Gonnym 0 Gonnym moved page [[Template:Non-English-language source category]] to [[Template:Non-English-language sources category]]: plural 796660 wikitext text/x-wiki <includeonly>{{#invoke:Lang/documentor tool|non_english_language_sources_category}}</includeonly> <noinclude> {{Documentation}} </noinclude> tth392pjya3d72u358xiaffc3eucl79 796662 720087 2022-07-14T17:59:50Z en>MusikBot II 0 Protected "[[Template:Non-English-language sources category]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 250 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite)) 796662 wikitext text/x-wiki <includeonly>{{#invoke:Lang/documentor tool|non_english_language_sources_category}}</includeonly> <noinclude> {{Documentation}} </noinclude> tth392pjya3d72u358xiaffc3eucl79 796663 796662 2026-06-06T02:32:43Z SM7 3953 8 revisions imported from [[:en:Template:Non-English-language_sources_category]] 796662 wikitext text/x-wiki <includeonly>{{#invoke:Lang/documentor tool|non_english_language_sources_category}}</includeonly> <noinclude> {{Documentation}} </noinclude> tth392pjya3d72u358xiaffc3eucl79 796664 796663 2026-06-06T02:35:28Z SM7 3953 पन्ना [[टेम्पलेट:Non-Bhojpuri-language sources category]] पर अनुप्रेषित कइल गइल 796664 wikitext text/x-wiki #REDIRECT [[टेम्पलेट:Non-Bhojpuri-language sources category]] 5109ch1tzavpp7e98ruj81iztutp47h ताइ ची 0 99905 796523 787358 2026-06-05T22:23:09Z SM7 3953 [[User:SM7/stubsorter|Stubsorter]] के मदद से {{Sport-stub}} {{Health-stub}} जोड़ल गइल। 796523 wikitext text/x-wiki '''ताइ ची''' चाहे '''ताई ची''' ({{Langx|en|Tai chi}}) [[चीन]] के एगो [[मार्शल आर्ट]] हवे। शुरू में ई लड़ाई आ खुद के बचाव खातिर बनावल गइल रहे। बाकिर आज ज्यादातर लोग खातिर ई [[एक्सरसाइज़]] ([[कसरत]]), रिलैक्सेशन टेक्नीक आ खेल बन गइल बा। एक्सरसाइज़ आ रिलैक्सेशन के रूप में ताई ची निश्चित क्रम (सीक्वेन्स) में कइल जाला। एह क्रम के ''फॉर्म्स'' (forms) भा ''ताओलू'' (taolu) कहल जाला। एहमें हरकत बहुत हल्का, बहत पानी जइसन आ लगातार होखे ला। एह चलते लोग एकरा के अक्सर “मोशन में मेडिटेशन” भी कह देला। कुछ रूपन में ई हरकत तेज़ आ ज्यादा ताकतो वाला हो सकेला। खेल के रूप में, ताई ची के मुकाबला में खेलाड़ी लोगन के फॉर्म्स, पुशिंग हैंड्स (pushing hands) आ फ्री स्पैरिंग (free sparring) में प्रदर्शन के आधार पर जज कइल जाला। मार्शल आर्ट के तौर पर, अभ्यास करे वाला लोग फॉर्म्स के असली इस्तेमाल सीखे ला। साथे पार्टनर के संग ट्रेनिंग भी करे ला। एह सब के मकसद होखे ला कि खुद के बचाव सही आ असरदार तरीका से कइल जा सके। [[श्रेणी:मार्शल आर्ट]] [[श्रेणी:चीनी आविष्कार]] {{Sport-stub}} {{Health-stub}} mvcwvzw6x4438dtm1whrtbomtbk9elb 796524 796523 2026-06-05T22:34:17Z SM7 3953 अंग्रेजी विकिपीडिया से अनुबाद क के बिस्तार कइल गइल 796524 wikitext text/x-wiki '''ताइ ची''' चाहे '''ताई ची''' ({{Langx|en|Tai chi}}) [[चीन]] के एगो [[मार्शल आर्ट]] हवे। शुरू में ई लड़ाई आ खुद के बचाव खातिर बनावल गइल रहे। बाकिर आज ज्यादातर लोग खातिर ई [[एक्सरसाइज़]] ([[कसरत]]), रिलैक्सेशन टेक्नीक आ खेल बन गइल बा। एक्सरसाइज़ आ रिलैक्सेशन के रूप में ताई ची निश्चित क्रम (सीक्वेन्स) में कइल जाला। एह क्रम के ''फॉर्म्स'' (forms) भा ''ताओलू'' (taolu) कहल जाला। एहमें हरकत बहुत हल्का, बहत पानी जइसन आ लगातार होखे ला। एह चलते लोग एकरा के अक्सर “मोशन में मेडिटेशन” भी कह देला। कुछ रूपन में ई हरकत तेज़ आ ज्यादा ताकतो वाला हो सकेला। खेल के रूप में, ताई ची के मुकाबला में खेलाड़ी लोगन के फॉर्म्स, पुशिंग हैंड्स (pushing hands) आ फ्री स्पैरिंग (free sparring) में प्रदर्शन के आधार पर जज कइल जाला। मार्शल आर्ट के तौर पर, अभ्यास करे वाला लोग फॉर्म्स के असली इस्तेमाल सीखे ला। साथे पार्टनर के संग ट्रेनिंग भी करे ला। एह सब के मकसद होखे ला कि खुद के बचाव सही आ असरदार तरीका से कइल जा सके। ताई ची के कई शैली (इस्टाइल) चलन में बाड़ी स, जवना में परंपरागत आ आधुनिक दुनो तरह के शैली शामिल बा। हालाँकि, एकर सटीक उत्पत्ति के बारे में पक्का जानकारी नइखे, बाकिर एकर सबसे पुरान आ नीक तरीका से दर्ज इतिहास मिंग आ छिंग राजवंश के बीच के संक्रमण काल में [[हेनान प्रांत]] के चेन गाँव आ झाबाओ गाँव से जुड़ल मानल जाला। ई इलाका [[उत्तरी चीन के मैदान]] में स्थित बा। एह क्षेत्र में सदियन तक विद्रोह, आक्रमण आ प्रतिकूल आर्थिक-सामाजिक परिस्थिति रहल, जवना के कारण कई तरह के मार्शल आर्ट सभ के बिकास भइल। एह मार्शल आर्ट सभ में [[शाओलिन मठ]] से जुड़ल युद्धकला सभ शामिल रहल, जवन मैदान के पश्चिमी किनारा पर स्थित सोंग पर्वत पर अवस्थित बा। अइसन माहौल ताई ची समेत कई युद्धक कला के विकास आ प्रसार में महत्त्वपूर्ण भूमिका निभवलस। आज के जमाना में प्रचलित अधिकतर ताई ची शैली अपना विकास के संबंध पाँच ठे परंपरागत स्कूलन से जोड़ेलीं—चेन, यांग, वू (हाओ), वू आ सन। 20वीं सदी के शुरुआत में यांग चेंगफू, वू जियांगुआन, सुन लुतांग आ अउरी दूसर विशेषज्ञ लोग ताई ची के सेहत संबंधी लाभ खातिर बढ़ावा दिहल लोग आ एकर अभ्यास के मानकीकृत करे के काम कइलस। एह प्रयास के समर्थन तत्कालीन राष्ट्रवादी सरकार द्वारा कइल गइल रहे। 1949 के बाद [[पीपल्स रिपब्लिक ऑफ चाइना]] के सरकार एह काम के अउरी आगे बढ़वलस आ एकरा के संस्थागत रूप दे दिहलस। 2020 में ताई ची के [[यूनेस्को]] (UNESCO) के मानवता के अमूर्त सांस्कृतिक विरासत के प्रतिनिधि लिस्ट में शामिल कइल गइल। [[श्रेणी:मार्शल आर्ट]] [[श्रेणी:चीनी आविष्कार]] {{Sport-stub}} {{Health-stub}} fvvt4t60xlu1gbm6tml34bpz3gnfuka 796600 796524 2026-06-05T22:52:08Z SM7 3953 ज्ञानसंदूक जोड़ल गइल, संदर्भ जोड़ल/सुधारल गइल 796600 wikitext text/x-wiki {{Infobox Martial art | logo = Yin and Yang symbol.svg | logocaption = The lower {{tlit|zh|pinyin|[[dantian]]}} in tai chi:<br />{{tlit|zh|pinyin|[[Taijitu]]}} ([[yin and yang]]) rotate, while<br />the core reverts to stillness ({{tlit|zh|pinyin|[[Wuji (philosophy)|wuji]]}}). | logosize = 100px | image = Yang-single (restoration).jpg | imagecaption = यांग चेंगफू ({{circa|1931}}), ''सिंगल व्हिप'' मुद्रा में, यांग-स्टाइल ताई ची के सोलो फॉर्म | imagesize = | name = ताई ची<br />{{lang|zh-Hant|{{nobold|太極拳}}}} | aka = | focus = [[ताओ धर्म]] | hardness = <!-- Forms: {{horizontal list|Competition|Light contact ([[pushing hands]], no strikes)|Full contact (strikes, kicks, throws, takedowns etc.)}}--> | country = [[चीन]] | creator = चेन वांगतिंग भा झांग सानफेंग | formation = 16वीं सदी के अंत में | famous pract = | parenthood = | ancestor arts = | descendant arts = | olympic = | website = | meaning = | martialart = }} {{Infobox intangible heritage | Name = Taijiquan | Image = | Caption = | Country = चीन | ID = 424 | Region = APA | Year = 2020 | List = Representative | Session = 15th | Below = [[File:Unesco Cultural Heritage logo.svg|100px]] | Note = UNESCO Cultural Heritage }} '''ताइ ची''' चाहे '''ताई ची''' ({{Langx|en|Tai chi}}) [[चीन]] के एगो [[मार्शल आर्ट]] हवे। शुरू में ई लड़ाई आ खुद के बचाव खातिर बनावल गइल रहे। बाकिर आज ज्यादातर लोग खातिर ई [[एक्सरसाइज़]] ([[कसरत]]), रिलैक्सेशन टेक्नीक आ खेल बन गइल बा। एक्सरसाइज़ आ रिलैक्सेशन के रूप में ताई ची निश्चित क्रम (सीक्वेन्स) में कइल जाला। एह क्रम के ''फॉर्म्स'' (forms) भा ''ताओलू'' (taolu) कहल जाला। एहमें हरकत बहुत हल्का, बहत पानी जइसन आ लगातार होखे ला। एह चलते लोग एकरा के अक्सर “मोशन में मेडिटेशन” भी कह देला।<ref name="m470">{{cite web |title=The Health Benefits of Tai Chi |website=Harvard Health |date=6 April 2010 |url=https://www.health.harvard.edu/exercise-and-fitness/the-health-benefits-of-tai-chi |access-date=5 June 2026}}</ref> कुछ रूपन में ई हरकत तेज़ आ ज्यादा ताकतो वाला हो सकेला। खेल के रूप में, ताई ची के मुकाबला में खेलाड़ी लोगन के फॉर्म्स, पुशिंग हैंड्स (pushing hands) आ फ्री स्पैरिंग (free sparring) में प्रदर्शन के आधार पर जज कइल जाला। मार्शल आर्ट के तौर पर, अभ्यास करे वाला लोग फॉर्म्स के असली इस्तेमाल सीखे ला। साथे पार्टनर के संग ट्रेनिंग भी करे ला। एह सब के मकसद होखे ला कि खुद के बचाव सही आ असरदार तरीका से कइल जा सके। ताई ची के कई शैली (इस्टाइल) चलन में बाड़ी स, जवना में परंपरागत आ आधुनिक दुनो तरह के शैली शामिल बा। हालाँकि, एकर सटीक उत्पत्ति के बारे में पक्का जानकारी नइखे, बाकिर एकर सबसे पुरान आ नीक तरीका से दर्ज इतिहास मिंग आ छिंग राजवंश के बीच के संक्रमण काल में [[हेनान प्रांत]] के चेन गाँव आ झाबाओ गाँव से जुड़ल मानल जाला। ई इलाका [[उत्तरी चीन के मैदान]] में स्थित बा। एह क्षेत्र में सदियन तक विद्रोह, आक्रमण आ प्रतिकूल आर्थिक-सामाजिक परिस्थिति रहल, जवना के कारण कई तरह के मार्शल आर्ट सभ के बिकास भइल। एह मार्शल आर्ट सभ में [[शाओलिन मठ]] से जुड़ल युद्धकला सभ शामिल रहल, जवन मैदान के पश्चिमी किनारा पर स्थित सोंग पर्वत पर अवस्थित बा। अइसन माहौल ताई ची समेत कई युद्धक कला के विकास आ प्रसार में महत्त्वपूर्ण भूमिका निभवलस। आज के जमाना में प्रचलित अधिकतर ताई ची शैली अपना विकास के संबंध पाँच ठे परंपरागत स्कूलन से जोड़ेलीं—चेन, यांग, वू (हाओ), वू आ सन। 20वीं सदी के शुरुआत में यांग चेंगफू, वू जियांगुआन, सुन लुतांग आ अउरी दूसर विशेषज्ञ लोग ताई ची के सेहत संबंधी लाभ खातिर बढ़ावा दिहल लोग आ एकर अभ्यास के मानकीकृत करे के काम कइलस। एह प्रयास के समर्थन तत्कालीन राष्ट्रवादी सरकार द्वारा कइल गइल रहे। 1949 के बाद [[पीपल्स रिपब्लिक ऑफ चाइना]] के सरकार एह काम के अउरी आगे बढ़वलस आ एकरा के संस्थागत रूप दे दिहलस। 2020 में ताई ची के [[यूनेस्को]] (UNESCO) के मानवता के अमूर्त सांस्कृतिक विरासत के प्रतिनिधि लिस्ट में शामिल कइल गइल। {{clear}} == संदर्भ == {{Reflist|29em}} [[श्रेणी:मार्शल आर्ट]] [[श्रेणी:चीनी आविष्कार]] {{Sport-stub}} {{Health-stub}} ddopshdwdxq1q11z8co0x2ebpw7r9oc एल नीनो 0 100951 796839 796474 2026-06-06T08:03:03Z SM7 3953 सुधार कइल गइल 796839 wikitext text/x-wiki [[File:Sst_9798_animated.gif|thumb|260x250px|[[1997–98 एल नीनो घटना]] के दौरान [[समुंद्री सतह तापमान]] (SST) में एनामली देखावत एनीमेशन लूप, पूरबी उष्णकटिबंधीय प्रशांत महासागर में अस्वाभाविक रूप से गरम समुंद्री सतह।]] '''एल नीनो''' चाहे '''एल निनो''' ({{Langx|en|El Niño}} {{lit|शिशु यीशु}}<ref name="noaa" />) एगो प्राकृतिक [[जलवायु|जलवायु बैज्ञानिक]]-घटना हवे जेकरा दौरान बिचला आ पूरबी [[प्रशांत महासागर]] में [[बिसुवत रेखा|भूमध्यरेखीय इलाका]] में समुंद्री सतह के पानी के तापमान आम दसा से बेसी हो जाला;<ref name="usgs" /><ref name="NASA">{{cite web |last=Observatory |first=NASA Earth |title=El Niño |website=NASA Science |date=7 October 2024 |url=https://science.nasa.gov/earth/explore/el-nino/ |access-date=5 June 2026}}</ref><ref name="noaa" /> एकरा चलते निचला वायुमंडल में बहे वाली [[हवा]] (सरफेस विंड्स) — खास क के [[ट्रेड विंड]] के नाँव से जानल जाये वाली पुरुआ हवा — के पैटर्न आम दसा से बहुत अलग किसिम के हो जाला; आ एह घटना के परभाव बिसेस रूप से पेरू के समुंद्रतटीय इलाका, आ बाद में बिस्तार ले के भारत-अमेरिका समेत मय बिस्व के [[मौसम]] पर पड़े लाl ख़ास क के पूरा बिस्व भर<ref name="noaa" /> के [[उष्णकटिबंध|उष्णकटिबंधीय इलाका]] सभ में मौसम आम दसा से बहुत अलग हो जाला। ई रेगुलर होखे वाली घटना हवे जे आमतौर प 2 से 7 साल पर रिपीट होखे ले। कौनों दू गो इवेंट एकदम एक्के नियन ना होलें।<ref name="usgs">{{cite web |title=What is "El Niño" and what are its effects? |website=USGS |date=1 March 2016 |url=https://www.usgs.gov/faqs/what-el-nino-and-what-are-its-effects |access-date=5 June 2026}}</ref> एल नीनो के उल्टा होखे वाली घटना के [[ला नीना]] हवे।<ref name="noaa" /> एह पूरा घटना (फेनोमेना) के '''[[एल नीनो-सदर्न ऑसलेशन|एल नीनो-एन्सो]]''' (''El Niño — ENSO'') चाहे '''एल नीनो दक्खिनी दोलन''' के नाँव से जानल जाला। एल नीनो आ एकर उल्टा इस्थिति [[ला नीना]] दुन्नो एह ब्यापक फेनामेना के अलग-अलग आ बिसेस रूप से घटित होखे वाला फेज हवें। प्रशांत महासागर के ओह इलाका में जे भूमध्यरेखा के आसपास पड़े ला तीन तरह के दसा हो सके लीं — सामान्य भा आम दसा (जब न एल नीनो वाला फेज होखे, न ला नीना वाला फेज होखे), एल नीनो — जब पानी सामन्य से बेसी गरम हो जाय; आ एकरा बिपरीत [[ला नीना]] के दसा जेह में समुंद्री सतह के तापमान आम दसा से कम दर्ज कइल जाय। परंपरागत (क्लासिकल) रूप से एल नीनो के एगो समुंद्री धारा के रूप में परिभाषित/चिन्हित कइल जाव जे हम्बोल्ट धारा भा पेरू के ठंडा धारा के उल्टा बह के एकरा के रिप्लेस क देवे।{{sfn|Shrivashtava|2026|p=}}<ref name="AMS2009">{{cite journal |last1=Eric Guilyrdi et. al. |title=Understanding El Nino in Ocean-Atmosphere General Circulation Models: Progress and Challenges |journal=American Meteorological Society, BAMS |date=मार्च 2009 |pages=325- |url=https://journals.ametsoc.org/view/journals/bams/90/3/2008bams2387_1.pdf |access-date=5 जून 2026}}</ref> अबतक ले दू गो सभसे मजबूत एल नीनो इवेंट दर्ज कइल गइल बाड़ें जे 1982-83 में आ 1997-98 में भइल रहलें।<ref name="noaa">{{cite web |title=A comprehensive Resource |website=El Nino Theme Page |date=24 December 2009 |url=https://www.pmel.noaa.gov/elnino/what-is-el-nino |access-date=5 June 2026}}</ref> [[बिस्व मौसम संगठन]] (WMO) साल 2026 खातिर चेतावनी जारी कइले बाटे कि एह साल एल नीनो इवेंट खातिर तइयार रहल जाव।<ref name="WMO26">{{cite web |title=WMO: Prepare for El Niño |website=World Meteorological Organization |date=1 June 2026 |url=https://wmo.int/news/media-centre/wmo-prepare-el-nino |access-date=5 June 2026}}</ref> == संदर्भ == {{Reflist|33em}} == ग्रंथसूची == {{refbegin|30em}} * {{cite book |last=Shrivashtava |first=Vinod |title=Bharat Ka Bhugol |publisher=Prabhat Prakashan |date=10 April 2026 |isbn=978-93-7573-698-1 |url=https://books.google.co.in/books?id=LaDPEQAAQBAJ&newbks=0&lpg=PA61&dq=%25E0%25A4%258F%25E0%25A4%25B2%2520%25E0%25A4%25A8%25E0%25A5%2580%25E0%25A4%25A8%25E0%25A5%258B%2520%25E0%25A4%25AE%25E0%25A4%25B9%25E0%25A4%25BE%25E0%25A4%25B8%25E0%25A4%25BE%25E0%25A4%2597%25E0%25A4%25B0%25E0%25A5%2580%25E0%25A4%25AF%2520%25E0%25A4%25A7%25E0%25A4%25BE%25E0%25A4%25B0%25E0%25A4%25BE&pg=PA61#v=onepage&q=%25E0%25A4%258F%25E0%25A4%25B2%2520%25E0%25A4%25A8%25E0%25A5%2580%25E0%25A4%25A8%25E0%25A5%258B%2520%25E0%25A4%25AE%25E0%25A4%25B9%25E0%25A4%25BE%25E0%25A4%25B8%25E0%25A4%25BE%25E0%25A4%2597%25E0%25A4%25B0%25E0%25A5%2580%25E0%25A4%25AF%2520%25E0%25A4%25A7%25E0%25A4%25BE%25E0%25A4%25B0%25E0%25A4%25BE&f=false |language=hi |access-date=5 June 2026}} {{refend}} == बाहरी कड़ी == *[https://www.bbc.com/news/articles/cj97npgk92po What are El Niño and La Niña, and how do they change ... - BBC] [[श्रेणी:मौसम बिज्ञान संबंधी घटना आ चीज]] [[श्रेणी:जलवायु बिज्ञान]] {{Climate-stub}} {{पर्यावरण-आधार}} g7dq2sys7139xl8tuvnzl0b1gd2b0jt काशी रेलवे स्टेशन 0 100953 796494 796484 2026-06-05T12:37:27Z SM7 3953 सुधार कइल गइल 796494 wikitext text/x-wiki {{Infobox station | name = काशी | image = [[File:Indian_Railways_Suburban_Railway_Logo.svg|150px]] | type = [[भारतीय रेल]] के इस्टेशन | style = Indian Railways | alt = | caption = | country = India | coordinates = {{coord|25.327494|83.031522|display=inline}} | elevation = 81.268 meters (266.6 feet) | owned = [[भारतीय रेल]] | platforms = 3 | tracks = 4 डबल (बिजली वाला ट्रैक) | train_operators = [[भारतीय रेल]] | connections = [[ऑटो रिक्शा]]<br/>[[बस]] | structure = स्टैंडर्ड (जमीन-लेवल स्टेशन) | parking = मौजूद | bicycle = मौजूद | accessible = | code = {{Indian railway code | code = KEI | zone = [[उत्तरी रेल मंडल|उत्तरी रेलवे]] | division = {{rwd|वाराणसी}} }} | zone = उत्तर रेल मंडल | website = | opened = <!-- {{Start date|YYYY|MM|DD|df=y}} --> | closed = <!-- {{End date|YYYY|MM|DD|df=y}} --> | passengers = | pass_year = | pass_percent = | pass_system = | map_type = India Uttar Pradesh Varanasi | map_dot_label = '''काशी''' | map_caption = बनारस नक्शा पर लोकेशन | mapframe = yes | mapframe-caption = Interactive map | mapframe-custom = {{Maplink|frame=yes|plain=yes|frame-align=center|frame-width=300|frame-height=180|zoom=14|type=point|marker=rail}} }} '''काशी रेलवे स्टेशन''' [[वाराणसी जिला]] के रेलवे स्टेशनन में से एगो हवे। ई [[वाराणसी जंक्शन रेलवे स्टेशन]] से लगभग 6 किलोमीटर पूरब, [[मुगलसराय जंक्शन रेलवे स्टेशन]] से लगभग 11 किलोमीटर उत्तर-पश्चिम आ [[बाबतपुर हवाईअड्डा|लाल बहादुर शास्त्री हवाईअड्डा]] से लगभग 26 किलोमीटर दक्षिण-पूर्व में स्थित बा। काशी रेलवे स्टेशन वाराणसी जिला के पूर्वी उपनगरन के सेवा देला आ वाराणसी जंक्शन आ पंडित दीन दयाल उपाध्याय जंक्शन के बाद क्षेत्र के एगो प्रमुख सेकेंडरी रेलवे स्टेशन के रूप में काम करे ला। == इहो देखल जाय == * [[बनारस रेलवे स्टेशन]] (मंडुआडीह स्टेशन) * [[बनारस कैंट रेलवे स्टेशन]] (वाराणसी जंक्शन) * [[वाराणसी सिटी रेलवे स्टेशन]] [[श्रेणी:बनारस रेलवे डिवीजन]] [[श्रेणी:उत्तर प्रदेश के रेलवे स्टेशन]] {{Rail-transport-stub}} lwhzblj8vv7hz81ms7000uhhie1nlgu 796507 796494 2026-06-05T13:00:41Z SM7 3953 बिस्तार कइल गइल 796507 wikitext text/x-wiki {{Infobox station | name = काशी | image = [[File:Indian_Railways_Suburban_Railway_Logo.svg|150px]] | type = [[भारतीय रेल]] के इस्टेशन | style = Indian Railways | alt = | caption = | country = India | coordinates = {{coord|25.327494|83.031522|display=inline}} | elevation = 81.268 meters (266.6 feet) | owned = [[भारतीय रेल]] | platforms = 3 | tracks = 4 डबल (बिजली वाला ट्रैक) | train_operators = [[भारतीय रेल]] | connections = [[ऑटो रिक्शा]]<br/>[[बस]] | structure = स्टैंडर्ड (जमीन-लेवल स्टेशन) | parking = मौजूद | bicycle = मौजूद | accessible = | code = {{Indian railway code | code = KEI | zone = [[उत्तरी रेल मंडल|उत्तरी रेलवे]] | division = {{rwd|वाराणसी}} }} | zone = उत्तर रेल मंडल | website = | opened = <!-- {{Start date|YYYY|MM|DD|df=y}} --> | closed = <!-- {{End date|YYYY|MM|DD|df=y}} --> | passengers = | pass_year = | pass_percent = | pass_system = | map_type = India Uttar Pradesh Varanasi | map_dot_label = '''काशी''' | map_caption = बनारस नक्शा पर लोकेशन | mapframe = yes | mapframe-caption = Interactive map | mapframe-custom = {{Maplink|frame=yes|plain=yes|frame-align=center|frame-width=300|frame-height=180|zoom=14|type=point|marker=rail}} }} '''काशी रेलवे स्टेशन''' [[वाराणसी जिला]] के रेलवे स्टेशनन में से एगो हवे। ई [[वाराणसी जंक्शन रेलवे स्टेशन]] से लगभग 6 किलोमीटर पूरब, [[मुगलसराय जंक्शन रेलवे स्टेशन]] से लगभग 11 किलोमीटर उत्तर-पश्चिम आ [[बाबतपुर हवाईअड्डा|लाल बहादुर शास्त्री हवाईअड्डा]] से लगभग 26 किलोमीटर दक्षिण-पूर्व में स्थित बा। काशी रेलवे स्टेशन वाराणसी जिला के पूर्वी उपनगरन के सेवा देला आ वाराणसी जंक्शन आ पंडित दीन दयाल उपाध्याय जंक्शन के बाद क्षेत्र के एगो प्रमुख सेकेंडरी रेलवे स्टेशन के रूप में काम करे ला। == नवीनीकरण == रेलवे द्वारा एह स्टेशन के नया तरीका से बिकसित क के आधुनिक सुबिधा सभ से लैस कइल गइल। स्टेशन पर सुघर देवाल, वेटिंग रूम, सर्कुलेटिंग एरिया आ पैदल ऊपरी पुल (फुट ओवरब्रिज / एफओबी) के निर्माण आ सुधार कइल गइल। स्टेशन के देवालिन पर धार्मिक आ सांस्कृतिक विषय से जुड़ल आकर्षक चित्रकारी कइल गइल बा। खराब रोशनी के समस्या दूर करे खातिर एलईडी लाइट लगावल गइल, जबकि रात में स्टेशन के सुंदरता बढ़ावे खातिर सजावटी रोशनी के भी इस्तेमाल कइल गइल। एह अपग्रेडिंग के काम पर करीबन 1 करोड़ से बेसी रुपया खर्च कइल गइल। == इहो देखल जाय == * [[बनारस रेलवे स्टेशन]] (मंडुआडीह स्टेशन) * [[बनारस कैंट रेलवे स्टेशन]] (वाराणसी जंक्शन) * [[वाराणसी सिटी रेलवे स्टेशन]] [[श्रेणी:बनारस रेलवे डिवीजन]] [[श्रेणी:उत्तर प्रदेश के रेलवे स्टेशन]] {{Rail-transport-stub}} bunsq4kyfidbv5q3efm3spoveob5lxm 796508 796507 2026-06-05T13:03:36Z SM7 3953 बिस्तार कइल गइल 796508 wikitext text/x-wiki {{Infobox station | name = काशी | image = [[File:Indian_Railways_Suburban_Railway_Logo.svg|150px]] | type = [[भारतीय रेल]] के इस्टेशन | style = Indian Railways | alt = | caption = | country = India | coordinates = {{coord|25.327494|83.031522|display=inline}} | elevation = 81.268 meters (266.6 feet) | owned = [[भारतीय रेल]] | platforms = 3 | tracks = 4 डबल (बिजली वाला ट्रैक) | train_operators = [[भारतीय रेल]] | connections = [[ऑटो रिक्शा]]<br/>[[बस]] | structure = स्टैंडर्ड (जमीन-लेवल स्टेशन) | parking = मौजूद | bicycle = मौजूद | accessible = | code = {{Indian railway code | code = KEI | zone = [[उत्तरी रेल मंडल|उत्तरी रेलवे]] | division = {{rwd|वाराणसी}} }} | zone = उत्तर रेल मंडल | website = | opened = <!-- {{Start date|YYYY|MM|DD|df=y}} --> | closed = <!-- {{End date|YYYY|MM|DD|df=y}} --> | passengers = | pass_year = | pass_percent = | pass_system = | map_type = India Uttar Pradesh Varanasi | map_dot_label = '''काशी''' | map_caption = बनारस नक्शा पर लोकेशन | mapframe = yes | mapframe-caption = Interactive map | mapframe-custom = {{Maplink|frame=yes|plain=yes|frame-align=center|frame-width=300|frame-height=180|zoom=14|type=point|marker=rail}} }} '''काशी रेलवे स्टेशन''' [[वाराणसी जिला]] के रेलवे स्टेशनन में से एगो हवे। ई [[वाराणसी जंक्शन रेलवे स्टेशन]] से लगभग 6 किलोमीटर पूरब, [[मुगलसराय जंक्शन रेलवे स्टेशन]] से लगभग 11 किलोमीटर उत्तर-पश्चिम आ [[बाबतपुर हवाईअड्डा|लाल बहादुर शास्त्री हवाईअड्डा]] से लगभग 26 किलोमीटर दक्षिण-पूर्व में स्थित बा। काशी रेलवे स्टेशन वाराणसी जिला के पूर्वी उपनगरन के सेवा देला आ वाराणसी जंक्शन आ पंडित दीन दयाल उपाध्याय जंक्शन के बाद क्षेत्र के एगो प्रमुख सेकेंडरी रेलवे स्टेशन के रूप में काम करे ला। == नवीनीकरण == रेलवे द्वारा एह स्टेशन के नया तरीका से बिकसित क के आधुनिक सुबिधा सभ से लैस कइल गइल। स्टेशन पर सुघर देवाल, वेटिंग रूम, सर्कुलेटिंग एरिया आ पैदल ऊपरी पुल (फुट ओवरब्रिज / एफओबी) के निर्माण आ सुधार कइल गइल। स्टेशन के देवालिन पर धार्मिक आ सांस्कृतिक विषय से जुड़ल आकर्षक चित्रकारी कइल गइल बा। खराब रोशनी के समस्या दूर करे खातिर एलईडी लाइट लगावल गइल, जबकि रात में स्टेशन के सुंदरता बढ़ावे खातिर सजावटी रोशनी के भी इस्तेमाल कइल गइल। एह अपग्रेडिंग के काम पर करीबन 1 करोड़ से बेसी रुपया खर्च कइल गइल। == भबिस्य के योजना == बनारस में बढ़त ट्रैफिक भीड़ आ उद्योग-धंधा के बढ़त जरूरत के देखते [[नेशनल हाईवेज अथॉरिटी ऑफ इंडिया]] (NHAI) द्वारा काशी रेलवे स्टेशन के इंटरमोडल स्टेशन (IMS) खातिर चुनल गइल। प्रस्तावित इंटरमोडल स्टेशन के रेल, सड़क, मास रैपिड ट्रांजिट सिस्टम, बस रैपिड ट्रांजिट सिस्टम आ अंतर्देशीय जलमार्ग जइसन अलग-अलग परिवहन माध्यमन से जोड़ल जाई। एह परियोजना के विकास [[पब्लिक–प्राइवेट पार्टनरशिप]] (PPP) मॉडल के तहत कइल जाई। इंटरमोडल स्टेशन के निर्माण आ विकास खातिर लगभग 47.26 एकड़ जमीन के जरूरत अनुमानित कइल गइल बा। == इहो देखल जाय == * [[बनारस रेलवे स्टेशन]] (मंडुआडीह स्टेशन) * [[बनारस कैंट रेलवे स्टेशन]] (वाराणसी जंक्शन) * [[वाराणसी सिटी रेलवे स्टेशन]] [[श्रेणी:बनारस रेलवे डिवीजन]] [[श्रेणी:उत्तर प्रदेश के रेलवे स्टेशन]] {{Rail-transport-stub}} 65dcarviabt5scow1pc10hasjjs4r33 बाबतपुर हवाई अड्डा, बनारस 0 100955 796487 2026-06-05T12:23:56Z SM7 3953 पन्ना [[बाबतपुर हवाई अड्डा]] पर अनुप्रेषित कइल गइल 796487 wikitext text/x-wiki #REDIRECT [[बाबतपुर हवाई अड्डा]] 60palo2x0j2pm1j8h50qpymh505ciuv 796498 796487 2026-06-05T12:39:47Z SM7 3953 सुधार कइल गइल 796498 wikitext text/x-wiki #REDIRECT [[बाबतपुर हवाईअड्डा]] 477v17oxhpl9h7gdjzux95zrhk6xt17 बाबतपुर हवाईअड्डा 0 100956 796488 2026-06-05T12:28:10Z SM7 3953 नया आधार लेख 796488 wikitext text/x-wiki '''लाल बहादुर शास्त्री हवाई अड्डा''' (आईएटीए: VNS, आईसीएओ: VEBN), जेकरा आम नाँव '''बाबतपुर हवाई अड्डा''' के नाँव से जानल जाला, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] के सेवा देवे वाला एगो इंटरनेशनल हवाई अड्डा हवे। ई बनारस से लगभग 26 किलोमीटर उत्तर-पश्चिम में स्थित [[बाबतपुर]] में बा। पहिले एकर नाँव वाराणसी हवाई अड्डा रहल, बाकिर अक्टूबर 2005 में भारत के दूसरा प्रधानमंत्री [[लाल बहादुर शास्त्री]] के सम्मान में एकर नाम बदल के वर्तमान नाम रखल गइल। वित्तीय साल 2024–25 में 40 लाख से बेसी यात्री एह हवाई अड्डा के इस्तेमाल कइलें, जवना के बाद ई भारत के प्रमुख हवाई अड्डन में गिनल जाए लागल। यात्री आवागमन के हिसाब से ई भारत के 19वाँ सबसे व्यस्त हवाई अड्डा आ उत्तर प्रदेश के दूसरा सबसे व्यस्त हवाई अड्डा हवे। एयरपोर्ट्स काउंसिल इंटरनेशनल द्वारा 2020 में एह हवाई अड्डा के एशिया-प्रशांत क्षेत्र के सबसे बढ़िया हवाई अड्डा (सालाना 20 लाख से 50 लाख यात्री श्रेणी) के पुरस्कार दिहल गइल रहे। ई भारत के पहिलका हवाई अड्डा भी हवे जहाँ एनाउन्समेंट [[संस्कृत|संस्कृत भाषा]] में भी कइल जाले। 1zeta10hca7ae9i62ca3cnoh61gy8uo 796490 796488 2026-06-05T12:28:56Z SM7 3953 [[विकिपीडिया:हॉट-कैट|हॉट-कैट]] द्वारा [[श्रेणी:बनारस]] जोड़ल गइल 796490 wikitext text/x-wiki '''लाल बहादुर शास्त्री हवाई अड्डा''' (आईएटीए: VNS, आईसीएओ: VEBN), जेकरा आम नाँव '''बाबतपुर हवाई अड्डा''' के नाँव से जानल जाला, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] के सेवा देवे वाला एगो इंटरनेशनल हवाई अड्डा हवे। ई बनारस से लगभग 26 किलोमीटर उत्तर-पश्चिम में स्थित [[बाबतपुर]] में बा। पहिले एकर नाँव वाराणसी हवाई अड्डा रहल, बाकिर अक्टूबर 2005 में भारत के दूसरा प्रधानमंत्री [[लाल बहादुर शास्त्री]] के सम्मान में एकर नाम बदल के वर्तमान नाम रखल गइल। वित्तीय साल 2024–25 में 40 लाख से बेसी यात्री एह हवाई अड्डा के इस्तेमाल कइलें, जवना के बाद ई भारत के प्रमुख हवाई अड्डन में गिनल जाए लागल। यात्री आवागमन के हिसाब से ई भारत के 19वाँ सबसे व्यस्त हवाई अड्डा आ उत्तर प्रदेश के दूसरा सबसे व्यस्त हवाई अड्डा हवे। एयरपोर्ट्स काउंसिल इंटरनेशनल द्वारा 2020 में एह हवाई अड्डा के एशिया-प्रशांत क्षेत्र के सबसे बढ़िया हवाई अड्डा (सालाना 20 लाख से 50 लाख यात्री श्रेणी) के पुरस्कार दिहल गइल रहे। ई भारत के पहिलका हवाई अड्डा भी हवे जहाँ एनाउन्समेंट [[संस्कृत|संस्कृत भाषा]] में भी कइल जाले। [[श्रेणी:बनारस]] cb0ckxmlzly38mqzu15ptbbaxjt70gd 796491 796490 2026-06-05T12:31:58Z SM7 3953 [[User:SM7/stubsorter|Stubsorter]] के मदद से {{Airport-stub}} जोड़ल गइल। 796491 wikitext text/x-wiki '''लाल बहादुर शास्त्री हवाई अड्डा''' (आईएटीए: VNS, आईसीएओ: VEBN), जेकरा आम नाँव '''बाबतपुर हवाई अड्डा''' के नाँव से जानल जाला, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] के सेवा देवे वाला एगो इंटरनेशनल हवाई अड्डा हवे। ई बनारस से लगभग 26 किलोमीटर उत्तर-पश्चिम में स्थित [[बाबतपुर]] में बा। पहिले एकर नाँव वाराणसी हवाई अड्डा रहल, बाकिर अक्टूबर 2005 में भारत के दूसरा प्रधानमंत्री [[लाल बहादुर शास्त्री]] के सम्मान में एकर नाम बदल के वर्तमान नाम रखल गइल। वित्तीय साल 2024–25 में 40 लाख से बेसी यात्री एह हवाई अड्डा के इस्तेमाल कइलें, जवना के बाद ई भारत के प्रमुख हवाई अड्डन में गिनल जाए लागल। यात्री आवागमन के हिसाब से ई भारत के 19वाँ सबसे व्यस्त हवाई अड्डा आ उत्तर प्रदेश के दूसरा सबसे व्यस्त हवाई अड्डा हवे। एयरपोर्ट्स काउंसिल इंटरनेशनल द्वारा 2020 में एह हवाई अड्डा के एशिया-प्रशांत क्षेत्र के सबसे बढ़िया हवाई अड्डा (सालाना 20 लाख से 50 लाख यात्री श्रेणी) के पुरस्कार दिहल गइल रहे। ई भारत के पहिलका हवाई अड्डा भी हवे जहाँ एनाउन्समेंट [[संस्कृत|संस्कृत भाषा]] में भी कइल जाले। [[श्रेणी:बनारस]] {{Airport-stub}} iq7jqwhohh80kiycwdwaln21da0fjti 796492 796491 2026-06-05T12:32:31Z SM7 3953 [[विकिपीडिया:हॉट-कैट|हॉट-कैट]] द्वारा [[श्रेणी:भारत के हवाईअड्डा]] जोड़ल गइल 796492 wikitext text/x-wiki '''लाल बहादुर शास्त्री हवाई अड्डा''' (आईएटीए: VNS, आईसीएओ: VEBN), जेकरा आम नाँव '''बाबतपुर हवाई अड्डा''' के नाँव से जानल जाला, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] के सेवा देवे वाला एगो इंटरनेशनल हवाई अड्डा हवे। ई बनारस से लगभग 26 किलोमीटर उत्तर-पश्चिम में स्थित [[बाबतपुर]] में बा। पहिले एकर नाँव वाराणसी हवाई अड्डा रहल, बाकिर अक्टूबर 2005 में भारत के दूसरा प्रधानमंत्री [[लाल बहादुर शास्त्री]] के सम्मान में एकर नाम बदल के वर्तमान नाम रखल गइल। वित्तीय साल 2024–25 में 40 लाख से बेसी यात्री एह हवाई अड्डा के इस्तेमाल कइलें, जवना के बाद ई भारत के प्रमुख हवाई अड्डन में गिनल जाए लागल। यात्री आवागमन के हिसाब से ई भारत के 19वाँ सबसे व्यस्त हवाई अड्डा आ उत्तर प्रदेश के दूसरा सबसे व्यस्त हवाई अड्डा हवे। एयरपोर्ट्स काउंसिल इंटरनेशनल द्वारा 2020 में एह हवाई अड्डा के एशिया-प्रशांत क्षेत्र के सबसे बढ़िया हवाई अड्डा (सालाना 20 लाख से 50 लाख यात्री श्रेणी) के पुरस्कार दिहल गइल रहे। ई भारत के पहिलका हवाई अड्डा भी हवे जहाँ एनाउन्समेंट [[संस्कृत|संस्कृत भाषा]] में भी कइल जाले। [[श्रेणी:बनारस]] [[श्रेणी:भारत के हवाईअड्डा]] {{Airport-stub}} m5rg3n4hj8s9mnkvknc521zbk4xyh3t 796495 796492 2026-06-05T12:39:15Z SM7 3953 SM7 पन्ना [[बाबतपुर हवाई अड्डा]] के [[बाबतपुर हवाईअड्डा]] पर स्थानांतरण कइलें: भोजपुरी विकिपीडिया पर एकरूपता खातिर 796492 wikitext text/x-wiki '''लाल बहादुर शास्त्री हवाई अड्डा''' (आईएटीए: VNS, आईसीएओ: VEBN), जेकरा आम नाँव '''बाबतपुर हवाई अड्डा''' के नाँव से जानल जाला, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] के सेवा देवे वाला एगो इंटरनेशनल हवाई अड्डा हवे। ई बनारस से लगभग 26 किलोमीटर उत्तर-पश्चिम में स्थित [[बाबतपुर]] में बा। पहिले एकर नाँव वाराणसी हवाई अड्डा रहल, बाकिर अक्टूबर 2005 में भारत के दूसरा प्रधानमंत्री [[लाल बहादुर शास्त्री]] के सम्मान में एकर नाम बदल के वर्तमान नाम रखल गइल। वित्तीय साल 2024–25 में 40 लाख से बेसी यात्री एह हवाई अड्डा के इस्तेमाल कइलें, जवना के बाद ई भारत के प्रमुख हवाई अड्डन में गिनल जाए लागल। यात्री आवागमन के हिसाब से ई भारत के 19वाँ सबसे व्यस्त हवाई अड्डा आ उत्तर प्रदेश के दूसरा सबसे व्यस्त हवाई अड्डा हवे। एयरपोर्ट्स काउंसिल इंटरनेशनल द्वारा 2020 में एह हवाई अड्डा के एशिया-प्रशांत क्षेत्र के सबसे बढ़िया हवाई अड्डा (सालाना 20 लाख से 50 लाख यात्री श्रेणी) के पुरस्कार दिहल गइल रहे। ई भारत के पहिलका हवाई अड्डा भी हवे जहाँ एनाउन्समेंट [[संस्कृत|संस्कृत भाषा]] में भी कइल जाले। [[श्रेणी:बनारस]] [[श्रेणी:भारत के हवाईअड्डा]] {{Airport-stub}} m5rg3n4hj8s9mnkvknc521zbk4xyh3t 796499 796495 2026-06-05T12:40:10Z SM7 3953 सुधार कइल गइल 796499 wikitext text/x-wiki '''लाल बहादुर शास्त्री हवाई अड्डा''' (आईएटीए: VNS, आईसीएओ: VEBN), जेकरा आम नाँव '''बाबतपुर हवाई अड्डा''' के नाँव से जानल जाला, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] के सेवा देवे वाला एगो इंटरनेशनल हवाई अड्डा हवे। ई बनारस से लगभग 26 किलोमीटर उत्तर-पश्चिम में स्थित [[बाबतपुर]] में बा। पहिले एकर नाँव वाराणसी हवाई अड्डा रहल, बाकिर अक्टूबर 2005 में भारत के दूसरा प्रधानमंत्री [[लाल बहादुर शास्त्री]] के सम्मान में एकर नाम बदल के वर्तमान नाम रखल गइल। वित्तीय साल 2024–25 में 40 लाख से बेसी यात्री एह हवाई अड्डा के इस्तेमाल कइलें, जवना के बाद ई भारत के प्रमुख हवाई अड्डन में गिनल जाए लागल। यात्री आवागमन के हिसाब से ई भारत के 19वाँ सबसे व्यस्त हवाई अड्डा आ उत्तर प्रदेश के दूसरा सबसे व्यस्त हवाई अड्डा हवे। एयरपोर्ट्स काउंसिल इंटरनेशनल द्वारा 2020 में एह हवाई अड्डा के एशिया-प्रशांत क्षेत्र के सबसे बढ़िया हवाई अड्डा (सालाना 20 लाख से 50 लाख यात्री श्रेणी) के पुरस्कार दिहल गइल रहे। ई भारत के पहिलका हवाई अड्डा भी हवे जहाँ एनाउन्समेंट [[संस्कृत|संस्कृत भाषा]] में भी कइल जाले। [[श्रेणी:बनारस]] [[श्रेणी:भारत के हवाईअड्डा]] {{भारत-हवाईअड्डा-आधार}} 7gmml8hf6o3052z9cz6wtmf39ssrwpe 796500 796499 2026-06-05T12:43:28Z SM7 3953 [[विकिपीडिया:हॉट-कैट|हॉट-कैट]] द्वारा [[श्रेणी:वाराणसी जिला]] जोड़ल गइल 796500 wikitext text/x-wiki '''लाल बहादुर शास्त्री हवाई अड्डा''' (आईएटीए: VNS, आईसीएओ: VEBN), जेकरा आम नाँव '''बाबतपुर हवाई अड्डा''' के नाँव से जानल जाला, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] के सेवा देवे वाला एगो इंटरनेशनल हवाई अड्डा हवे। ई बनारस से लगभग 26 किलोमीटर उत्तर-पश्चिम में स्थित [[बाबतपुर]] में बा। पहिले एकर नाँव वाराणसी हवाई अड्डा रहल, बाकिर अक्टूबर 2005 में भारत के दूसरा प्रधानमंत्री [[लाल बहादुर शास्त्री]] के सम्मान में एकर नाम बदल के वर्तमान नाम रखल गइल। वित्तीय साल 2024–25 में 40 लाख से बेसी यात्री एह हवाई अड्डा के इस्तेमाल कइलें, जवना के बाद ई भारत के प्रमुख हवाई अड्डन में गिनल जाए लागल। यात्री आवागमन के हिसाब से ई भारत के 19वाँ सबसे व्यस्त हवाई अड्डा आ उत्तर प्रदेश के दूसरा सबसे व्यस्त हवाई अड्डा हवे। एयरपोर्ट्स काउंसिल इंटरनेशनल द्वारा 2020 में एह हवाई अड्डा के एशिया-प्रशांत क्षेत्र के सबसे बढ़िया हवाई अड्डा (सालाना 20 लाख से 50 लाख यात्री श्रेणी) के पुरस्कार दिहल गइल रहे। ई भारत के पहिलका हवाई अड्डा भी हवे जहाँ एनाउन्समेंट [[संस्कृत|संस्कृत भाषा]] में भी कइल जाले। [[श्रेणी:बनारस]] [[श्रेणी:भारत के हवाईअड्डा]] [[श्रेणी:वाराणसी जिला]] {{भारत-हवाईअड्डा-आधार}} l5e3xnjaa0x2e4crlmtcekpgtrku9y2 लाल बहादुर शास्त्री हवाई अड्डा 0 100957 796489 2026-06-05T12:28:32Z SM7 3953 पन्ना [[बाबतपुर हवाई अड्डा]] पर अनुप्रेषित कइल गइल 796489 wikitext text/x-wiki #REDIRECT [[बाबतपुर हवाई अड्डा]] 60palo2x0j2pm1j8h50qpymh505ciuv 796497 796489 2026-06-05T12:39:31Z SM7 3953 सुधार कइल गइल 796497 wikitext text/x-wiki #REDIRECT [[बाबतपुर हवाईअड्डा]] 477v17oxhpl9h7gdjzux95zrhk6xt17 बाबतपुर हवाई अड्डा 0 100958 796496 2026-06-05T12:39:15Z SM7 3953 SM7 पन्ना [[बाबतपुर हवाई अड्डा]] के [[बाबतपुर हवाईअड्डा]] पर स्थानांतरण कइलें: भोजपुरी विकिपीडिया पर एकरूपता खातिर 796496 wikitext text/x-wiki #REDIRECT [[बाबतपुर हवाईअड्डा]] 477v17oxhpl9h7gdjzux95zrhk6xt17 जी.टी. रोड 0 100959 796502 2026-06-05T12:49:50Z SM7 3953 SM7 पन्ना [[जी.टी. रोड]] के [[जीटी रोड]] पर स्थानांतरण कइलें: बेहतर/कॉमन भोजपुरी नाँव (Better/common name) ([[WP:COMMONNAME]]) 796502 wikitext text/x-wiki #REDIRECT [[जीटी रोड]] 7irntvgb82d72j77ndqh36c49w7ptbm ग्रैंड ट्रंक रोड 0 100960 796504 2026-06-05T12:52:14Z SM7 3953 पन्ना [[जीटी रोड]] पर अनुप्रेषित कइल गइल 796504 wikitext text/x-wiki #REDIRECT [[जीटी रोड]] 7irntvgb82d72j77ndqh36c49w7ptbm 796505 796504 2026-06-05T12:53:02Z SM7 3953 Added {{[[:Template:R from long name|R from long name]]}} tag to redirect 796505 wikitext text/x-wiki #REDIRECT [[जीटी रोड]] {{Redirect category shell| {{R from long name}} }} b6lcdjjd89cxgu5znzbabtcrwgksm9u ग्रांड ट्रंक रोड 0 100961 796506 2026-06-05T12:53:40Z SM7 3953 पन्ना [[जीटी रोड]] पर अनुप्रेषित कइल गइल 796506 wikitext text/x-wiki #REDIRECT [[जीटी रोड]] {{Redirect category shell| {{R from long name}} }} b6lcdjjd89cxgu5znzbabtcrwgksm9u बनारस शहर 0 100962 796509 2026-06-05T13:11:27Z SM7 3953 पन्ना [[बनारस]] पर अनुप्रेषित कइल गइल 796509 wikitext text/x-wiki #REDIRECT [[बनारस]] fmczl6hebkdr6r63bqi7c4za42lo3wz बनारस रेलवे स्टेशन 0 100963 796510 2026-06-05T13:12:42Z SM7 3953 नया आधार लेख 796510 wikitext text/x-wiki '''बनारस रेलवे स्टेशन''' (स्टेशन कोड: BNRS), जेकरा के पहिले '''मंडुआडीह रेलवे स्टेशन''' के नाम से जानल जात रहे, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] में स्थित बा। ई बनारस के प्रमुख रेलवे स्टेशनन में से एगो हवे। स्टेशन पर लगावल गइल नया साइनबोर्डन पर स्टेशन के नाम हिंदी, अंग्रेजी, उर्दू आ संस्कृत भाषा में लिखल गइल बा। [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन]] पर बहुत भीड़ होखे के कारण एह स्टेशन के बेहतर सुविधा वाला प्रमुख रेलवे स्टेशन के रूप में विकसित कइल गइल बा। 0r113nkz9mjn7p00zbyx7b4l8rqnikd 796511 796510 2026-06-05T13:13:25Z SM7 3953 [[विकिपीडिया:हॉट-कैट|हॉट-कैट]] द्वारा [[श्रेणी:बनारस]] जोड़ल गइल 796511 wikitext text/x-wiki '''बनारस रेलवे स्टेशन''' (स्टेशन कोड: BNRS), जेकरा के पहिले '''मंडुआडीह रेलवे स्टेशन''' के नाम से जानल जात रहे, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] में स्थित बा। ई बनारस के प्रमुख रेलवे स्टेशनन में से एगो हवे। स्टेशन पर लगावल गइल नया साइनबोर्डन पर स्टेशन के नाम हिंदी, अंग्रेजी, उर्दू आ संस्कृत भाषा में लिखल गइल बा। [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन]] पर बहुत भीड़ होखे के कारण एह स्टेशन के बेहतर सुविधा वाला प्रमुख रेलवे स्टेशन के रूप में विकसित कइल गइल बा। [[श्रेणी:बनारस]] 7mrbfnxmzebwczz10h4nsuhg3ert728 796512 796511 2026-06-05T13:13:43Z SM7 3953 [[विकिपीडिया:हॉट-कैट|हॉट-कैट]] द्वारा [[श्रेणी:उत्तर प्रदेश के रेलवे स्टेशन]] जोड़ल गइल 796512 wikitext text/x-wiki '''बनारस रेलवे स्टेशन''' (स्टेशन कोड: BNRS), जेकरा के पहिले '''मंडुआडीह रेलवे स्टेशन''' के नाम से जानल जात रहे, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] में स्थित बा। ई बनारस के प्रमुख रेलवे स्टेशनन में से एगो हवे। स्टेशन पर लगावल गइल नया साइनबोर्डन पर स्टेशन के नाम हिंदी, अंग्रेजी, उर्दू आ संस्कृत भाषा में लिखल गइल बा। [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन]] पर बहुत भीड़ होखे के कारण एह स्टेशन के बेहतर सुविधा वाला प्रमुख रेलवे स्टेशन के रूप में विकसित कइल गइल बा। [[श्रेणी:बनारस]] [[श्रेणी:उत्तर प्रदेश के रेलवे स्टेशन]] l7lo34f242w73wr4ug9xa2lvirwffww 796513 796512 2026-06-05T13:14:40Z SM7 3953 [[User:SM7/stubsorter|Stubsorter]] के मदद से {{India-rail-transport-stub}} जोड़ल गइल। 796513 wikitext text/x-wiki '''बनारस रेलवे स्टेशन''' (स्टेशन कोड: BNRS), जेकरा के पहिले '''मंडुआडीह रेलवे स्टेशन''' के नाम से जानल जात रहे, भारत के उत्तर प्रदेश राज्य के [[बनारस|बनारस शहर]] में स्थित बा। ई बनारस के प्रमुख रेलवे स्टेशनन में से एगो हवे। स्टेशन पर लगावल गइल नया साइनबोर्डन पर स्टेशन के नाम हिंदी, अंग्रेजी, उर्दू आ संस्कृत भाषा में लिखल गइल बा। [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन]] पर बहुत भीड़ होखे के कारण एह स्टेशन के बेहतर सुविधा वाला प्रमुख रेलवे स्टेशन के रूप में विकसित कइल गइल बा। [[श्रेणी:बनारस]] [[श्रेणी:उत्तर प्रदेश के रेलवे स्टेशन]] {{India-rail-transport-stub}} {{rail-transport-stub}} 58e3np87wms2464telv9gh6x6638tpe वाराणसी सिटी रेलवे स्टेशन 0 100964 796514 2026-06-05T13:18:13Z SM7 3953 नया आधार लेख 796514 wikitext text/x-wiki '''वाराणसी सिटी रेलवे स्टेशन''' [[बनारस]] के प्रमुख रेलवे स्टेशनन में से एगो हवे। ई [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन रेलवे स्टेशन]] (कैंट स्टेशन) से लगभग 4 किलोमीटर उत्तर-पूर्व, [[बनारस हिंदू विश्वविद्यालय|बनारस हिंदू यूनिवर्सिटी]] से लगभग 10 किलोमीटर उत्तर-पूर्व आ [[बाबतपुर हवाईअड्डा|लाल बहादुर शास्त्री हवाई अड्डा]] से लगभग 23 किलोमीटर दक्खिन-पुरुब में स्थित बा। [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन]] (कैंट स्टेशन) पर बहुत बेसी भीड़भाड़ होखे के कारण ई स्टेशन टर्मिनल स्टेशन के रूप में भी काम करेला, जहाँ से कई रेलगाड़ी सभ के शुरुआत आ समापन होखेला। gyy9tnjoyak2kxws06zdzurs76c5fvs 796515 796514 2026-06-05T13:18:24Z SM7 3953 [[विकिपीडिया:हॉट-कैट|हॉट-कैट]] द्वारा [[श्रेणी:बनारस]] जोड़ल गइल 796515 wikitext text/x-wiki '''वाराणसी सिटी रेलवे स्टेशन''' [[बनारस]] के प्रमुख रेलवे स्टेशनन में से एगो हवे। ई [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन रेलवे स्टेशन]] (कैंट स्टेशन) से लगभग 4 किलोमीटर उत्तर-पूर्व, [[बनारस हिंदू विश्वविद्यालय|बनारस हिंदू यूनिवर्सिटी]] से लगभग 10 किलोमीटर उत्तर-पूर्व आ [[बाबतपुर हवाईअड्डा|लाल बहादुर शास्त्री हवाई अड्डा]] से लगभग 23 किलोमीटर दक्खिन-पुरुब में स्थित बा। [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन]] (कैंट स्टेशन) पर बहुत बेसी भीड़भाड़ होखे के कारण ई स्टेशन टर्मिनल स्टेशन के रूप में भी काम करेला, जहाँ से कई रेलगाड़ी सभ के शुरुआत आ समापन होखेला। [[श्रेणी:बनारस]] 0ifrwxll6fd17mrlxowkyde44xpnu12 796516 796515 2026-06-05T13:18:41Z SM7 3953 [[विकिपीडिया:हॉट-कैट|हॉट-कैट]] द्वारा [[श्रेणी:उत्तर प्रदेश के रेलवे स्टेशन]] जोड़ल गइल 796516 wikitext text/x-wiki '''वाराणसी सिटी रेलवे स्टेशन''' [[बनारस]] के प्रमुख रेलवे स्टेशनन में से एगो हवे। ई [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन रेलवे स्टेशन]] (कैंट स्टेशन) से लगभग 4 किलोमीटर उत्तर-पूर्व, [[बनारस हिंदू विश्वविद्यालय|बनारस हिंदू यूनिवर्सिटी]] से लगभग 10 किलोमीटर उत्तर-पूर्व आ [[बाबतपुर हवाईअड्डा|लाल बहादुर शास्त्री हवाई अड्डा]] से लगभग 23 किलोमीटर दक्खिन-पुरुब में स्थित बा। [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन]] (कैंट स्टेशन) पर बहुत बेसी भीड़भाड़ होखे के कारण ई स्टेशन टर्मिनल स्टेशन के रूप में भी काम करेला, जहाँ से कई रेलगाड़ी सभ के शुरुआत आ समापन होखेला। [[श्रेणी:बनारस]] [[श्रेणी:उत्तर प्रदेश के रेलवे स्टेशन]] l59cfyvc389mewdqltqq3nynusyuz8z 796517 796516 2026-06-05T13:19:08Z SM7 3953 [[User:SM7/stubsorter|Stubsorter]] के मदद से {{India-rail-transport-stub}} जोड़ल गइल। 796517 wikitext text/x-wiki '''वाराणसी सिटी रेलवे स्टेशन''' [[बनारस]] के प्रमुख रेलवे स्टेशनन में से एगो हवे। ई [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन रेलवे स्टेशन]] (कैंट स्टेशन) से लगभग 4 किलोमीटर उत्तर-पूर्व, [[बनारस हिंदू विश्वविद्यालय|बनारस हिंदू यूनिवर्सिटी]] से लगभग 10 किलोमीटर उत्तर-पूर्व आ [[बाबतपुर हवाईअड्डा|लाल बहादुर शास्त्री हवाई अड्डा]] से लगभग 23 किलोमीटर दक्खिन-पुरुब में स्थित बा। [[बनारस कैंट रेलवे स्टेशन|वाराणसी जंक्शन]] (कैंट स्टेशन) पर बहुत बेसी भीड़भाड़ होखे के कारण ई स्टेशन टर्मिनल स्टेशन के रूप में भी काम करेला, जहाँ से कई रेलगाड़ी सभ के शुरुआत आ समापन होखेला। [[श्रेणी:बनारस]] [[श्रेणी:उत्तर प्रदेश के रेलवे स्टेशन]] {{India-rail-transport-stub}} 6fvax55y87jyk9ie24h4m0c11n194sx लाल बहादुर शास्त्री एयरपोर्ट 0 100965 796518 2026-06-05T14:37:33Z SM7 3953 पन्ना [[बाबतपुर हवाईअड्डा]] पर अनुप्रेषित कइल गइल 796518 wikitext text/x-wiki #REDIRECT [[बाबतपुर हवाईअड्डा]] 477v17oxhpl9h7gdjzux95zrhk6xt17 मंडुआडीह रेलवे स्टेशन 0 100966 796520 2026-06-05T17:19:41Z SM7 3953 पन्ना [[बनारस रेलवे स्टेशन]] पर अनुप्रेषित कइल गइल 796520 wikitext text/x-wiki #REDIRECT [[बनारस रेलवे स्टेशन]] 1y4i38zb921plmuhnkeg8emy9fdeyyg विकिपीडिया:आँकड़ा सभ/२०२६/जून 4 100967 796522 2026-06-05T19:21:33Z NeechalBOT 7874 statistics 796522 wikitext text/x-wiki <!--- stats starts--->{{प्रयोगकर्ता:Neechalkaran/statnotice}}{| class="wikitable sortable" style="width:90%" |- ! Date(Time) ! Pages ! Articles ! Edits ! Users ! Files ! Activeusers {{User:Neechalkaran/template/daily |Date =५-६-२०२६ |Pages = 81762 |dPages = 21 |Articles = 9065 |dArticles = 6 |Edits = 793428 |dEdits = 62 |Files = 54 |dFiles = 0 |Users = 40031 |dUsers = 9 |Ausers = 55 |dAusers = 0 }} <!---Place new stats here---> |} <!--- stats ends---> 7x7oeiw3dvkjebkp1hoqwuvwesh230k टेम्पलेट:Infobox Martial art 10 100968 796525 2010-09-04T14:15:19Z en>Rich Farmbrough 0 moved [[Template:Infobox Martial art]] to [[Template:Infobox martial art]] over redirect: Caps 796525 wikitext text/x-wiki #REDIRECT [[Template:Infobox martial art]] dw6ibgdw1mr9r3dnomak3yov0aze2ut 796526 796525 2026-06-05T22:41:58Z SM7 3953 1 revision imported from [[:en:Template:Infobox_Martial_art]] 796525 wikitext text/x-wiki #REDIRECT [[Template:Infobox martial art]] dw6ibgdw1mr9r3dnomak3yov0aze2ut टेम्पलेट:Infobox martial art 10 100969 796527 2006-12-14T18:57:20Z en>Nmnogueira 0 [[WP:AES|←]]Created page with '{| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}...' 796527 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->150px}}| ]] }} |- ! colspan="2" style="font-size: larger; background-color: #4682b4;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{caption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also know as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | name = | aka = | image = | caption = | style = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext", with an optional size field. (e.g. ''JKD.jpg|150px'') *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''caption''', a caption to be used with the image. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. </noinclude> mhgj86tsuv5p3hom7wa8sjrajkzi1sl 796528 796527 2006-12-14T19:03:55Z en>Nmnogueira 0 796528 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #4682b4;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also know as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | image = | imagecaption = | name = | aka = | style = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext", with an optional size field. (e.g. ''JKD.jpg|150px'') *'''logocaption''', a caption to be used with the logo. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. </noinclude> lapv0hmvkowz7ucvtiqbrncdunbgihj 796529 796528 2006-12-14T19:07:01Z en>Nmnogueira 0 796529 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #4682b4;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also know as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext", with an optional size field. (e.g. ''JKD.jpg|150px'') *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. </noinclude> 6bvy0oys3dkl0elk74jpq0lt5ghpqoa 796530 796529 2006-12-14T19:07:54Z en>Nmnogueira 0 796530 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #4682b4;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also know as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. </noinclude> nhqlbx26ykdkmsctjjvlt5xo6txsc8g 796531 796530 2006-12-15T20:14:22Z en>Nmnogueira 0 796531 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em; align="right"" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #4682b4;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also know as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. </noinclude> 15n8ogrjtrq36s6jt3uxij1nvv4c02v 796532 796531 2006-12-15T20:15:37Z en>Nmnogueira 0 796532 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #4682b4;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also know as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. </noinclude> nhqlbx26ykdkmsctjjvlt5xo6txsc8g 796533 796532 2007-02-17T02:04:00Z en>MArcane 0 minor spelling fix 796533 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #4682b4;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. </noinclude> i3z3yqs5j9q13gj9twt1dl0tjcxpnwl 796534 796533 2007-03-13T22:39:28Z 82.73.147.80 add hardness (by lack of a better word) 796534 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #4682b4;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | hardness = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''hardness''', the degree of violence in duelling, e.g. [[contact sport|semi-contact]], full-contact, etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. </noinclude> 0acb3ntrsrx6bg3865lt1w5i7viuagt 796535 796534 2007-05-02T20:41:56Z en>Scottalter 0 changed background color 796535 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | hardness = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''hardness''', the degree of violence in duelling, e.g. [[contact sport|semi-contact]], full-contact, etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. </noinclude> tngf0v8ihbsirz9gy9f7xfdbgrgoyww 796536 796535 2007-05-08T14:46:44Z en>Nmnogueira 0 added category "sports infobox templates" 796536 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | hardness = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''hardness''', the degree of violence in duelling, e.g. [[contact sport|semi-contact]], full-contact, etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. [[Category:sports infobox templates|Martial Art]] </noinclude> gak8cuirfiujz8qi0liciy8a5tzr44m 796537 796536 2007-06-21T15:57:25Z en>Medains 0 796537 wikitext text/x-wiki {| class="infobox" border="1" cellpadding="2" width="300" cellpadding="2" cellspacing="0" style="float:right;clear:right;" ! colspan="2" bgcolor="#CADCAD" | {{{nationality}}} |- ! colspan="2" bgcolor="#AAAEEE" | {{{school}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- ! colspan="2" | Founder |- | width="150" | {{{founder}}} | width="150" | {{{founder dates}}} |- ! colspan="3" | Date founded |- | width="150" | {{{period founded}}} | width="150" | {{{date founded}}} |- ! colspan="2" | Current headmaster |- | width="150" | {{{headmaster}}} | width="150" | {{{headmaster dates}}} |- ! colspan="2" bgcolor="#AAAEEE" | Arts taught |- | width="150" | '''Name''' | width="150" | '''Description''' |- | width="150" | {{{art1}}} | width="150" | {{{description1}}} |- | width="150" | {{{art2}}} | width="150" | {{{description2}}} |- | width="150" | {{{art3}}} | width="150" | {{{description3}}} |- | width="150" | {{{art4}}} | width="150" | {{{description4}}} |- | width="150" | {{{art5}}} | width="150" | {{{description5}}} |- | width="150" | {{{art6}}} | width="150" | {{{description6}}} |- | width="150" | {{{art7}}} | width="150" | {{{description7}}} |- | width="150" | {{{art8}}} | width="150" | {{{description8}}} |- | width="150" | {{{art9}}} | width="150" | {{{description9}}} |- | width="150" | {{{art10}}} | width="150" | {{{description10}}} |- ! colspan="2" bgcolor="#AAAEEE" | Ancestor schools |- | colspan="2" | <small>{{{ancestors}}}</small> |- ! colspan="2" bgcolor="#AAAEEE" | Descendant schools |- | colspan="2" | <small>{{{descendants}}}</small> |- |}<noinclude> <nowiki>{{infobox martial art school | nationality = | school = | image = | imagecaption = | founder = | founder dates = | period founded = | date founded = | headmaster = | headmaster dates = | art1 = | description1 = | art2 = | description2 = | art3 = | description3 = | art4 = | description4 = | art5 = | description5 = | art6 = | description6 = | art7 = | description7 = | art8 = | description8 = | art9 = | description9 = | art10 = | description10 = | ancestors = | descendants = }}</nowiki> ==Guide== IMPORTANT: Any field after the "=" may be left blank, but all of the above must be included. *'''nationality''' = please include linked text for the nationality of the martial art being described, such as <nowiki>[[Chinese martial arts]]</nowiki>. For [[Japanese martial arts]], please precede the nationality with either <nowiki>[[Koryū|Traditional]], or [[Gendai budō|Modern]]</nowiki>, as appropriate. *'''school''' = The name of the school, correctly romanized. For martial arts from a nationality with a foreign alphabet, the name should be followed by <nowiki>"<br>"</nowiki>, and then the native way of writing it. *'''image''' = Preferably an image of the art being practiced. Neither brackets, nor the <nowiki>"image:"</nowiki> tag are necessary. *'''imagecaption''' = A caption. Preferably a complete sentence ending with a period. *'''founder''' = The name of the founder, correctly romanized. For persons of a nationality with a foreign alphabet, the name should be followed by <nowiki>"<br>"</nowiki>, and then the native way of writing it. *'''founder dates''' = Dates of birth and death for the founder. Note necessary to place the dates in parentheses, but otherwise follow all rules at [[WP:DATE]]. *'''period founded''' = State the name of the historical period in which the school was founded, followed by the beginning and ending dates of the period in parentheses. *'''date founded''' = The date the school was founded. Be as exact as possible, but generally only a year will be known. *'''headmaster''' = The name of the current headmaster. If none is known, state "Unknown". If there are multiple, state "various". Make all efforts not to leave this field blank. *'''headmaster dates''' = The same as "founder dates", above. *'''art1''' = Up to ten fields for the "type" of martial art practiced, such as [[aikido]], [[kenjutsu]], [[Tai Chi Chuan]], etc... are provided. State the the foreign term here, using standard rules for foreign terms. *'''description1''' = Define briefly what the martial art is, e.g., "sword art" (for kenjutsu), or "grappling sport" (for judo). *'''art and description 2 - 10''' = same as above *'''ancestors''' = Alphabetically list all of the schools that influenced the creation or practice of this school, please separate them by a single [[bullet (typography)|bullet]] separated by a space on each side, thusly: "school • school". Typically, these will be the schools in which the founder trained prior to founding the art. *'''descendants''' = Alphabetically list all of the schools whose creation or practice were influenced by this school, and separate them as in "ancestors", above. </noinclude> gkk1y6ae0nntl7o5zud65xdb0gt5bpl 796538 796537 2007-06-21T15:58:44Z en>Medains 0 revert (oops) 796538 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | hardness = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''hardness''', the degree of violence in duelling, e.g. [[contact sport|semi-contact]], full-contact, etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator'''. the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. [[Category:sports infobox templates|Martial Art]] </noinclude> gak8cuirfiujz8qi0liciy8a5tzr44m 796539 796538 2007-09-15T20:10:36Z en>User5802 0 fixed typo 796539 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | hardness = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], [[Grappling]]'', etc. *'''hardness''', the degree of violence in duelling, e.g. [[contact sport|semi-contact]], full-contact, etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator''', the creator of the martial art, if there is one. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. [[Category:sports infobox templates|Martial Art]] </noinclude> r6vidggxqmvkegp9coabeapoa06e36a 796540 796539 2007-09-25T13:56:08Z en>Nate1481 0 expand explination 796540 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | hardness = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the main style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], or [[Grappling]]'', etc. but keep it brief, info boxes are not for essays. *'''hardness''', the degree of violence in duelling/sparing, e.g. [[contact sport|semi-contact]], full-contact, etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator''', the creator of the martial art, ''if there is one''. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. [[Category:sports infobox templates|Martial Art]] </noinclude> btsvaqmq8d1723bqrdyvhf1k5xrhuyb 796541 796540 2007-09-28T08:00:54Z en>User5802 0 typo 796541 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | hardness = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the main style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], or [[Grappling]]'', etc. but keep it brief, info boxes are not for essays. *'''hardness''', the degree of violence in duelling/sparring, e.g. [[contact sport|semi-contact]], full-contact, etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator''', the creator of the martial art, ''if there is one''. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art. [[Category:sports infobox templates|Martial Art]] </noinclude> rs5cx8lkke9z2hc1v3ad1j9vegbwh14 796542 796541 2007-09-28T09:05:16Z en>Nate1481 0 clartify 796542 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> ==Usage== All fields are optional, but should be filled as many as possible. <pre>{{Infobox_martial_art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | aka = | style = | hardness = | country = | creator = | parenthood = | famous_pract = | olympic = | website = }}</pre> Fields included: *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''aka''', alternative names for the martial art. *'''style''', the main style of the martial art. This can include ''[[Kicking]], [[Punch (strike)|Punching]], [[Trapping (Martial Arts)|Trapping]], or [[Grappling]]'', etc. but keep it brief, info boxes are not for essays. *'''hardness''', the degree of violence in duelling/sparring, e.g. [[contact sport|semi-contact]], full-contact, etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flagicon}} *'''creator''', the creator of the martial art, ''if there is one''. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art (should link own article or details in article) *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art if there is a single organisation, if multiple organisations leave out. [[Category:sports infobox templates|Martial Art]] </noinclude> dehy85lqqo6wvw9a4oigc19yyljxyli 796543 796542 2007-10-23T22:58:40Z en>Bradford44 0 creating documentation subpage and transcluding 796543 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Style''' <!-- -->{{!}} {{{style}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{template doc}} </noinclude> t3a2z1ej1j1p45yfuew00b7m83meaqx 796544 796543 2007-11-08T10:29:29Z en>Nate1481 0 up date based in dissussion on [[WP:WPMA]] 796544 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{style<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{Focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{template doc}} </noinclude> immtuho8q8u4thhzmheh4o1tmqcxema 796545 796544 2007-11-08T10:37:38Z en>Nate1481 0 fix 796545 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{Focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{Focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{template doc}} </noinclude> dswmpjfocbibwh9l5ahn5mnrol1g1hm 796546 796545 2007-11-08T10:39:31Z en>Nate1481 0 update 796546 wikitext text/x-wiki {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{template doc}} </noinclude> 7443an7dl1x1ukcaf5l0maixye1ih6j 796547 796546 2007-11-21T17:05:44Z en>Bradford44 0 updating "template doc" to "documentation" 796547 wikitext text/x-wiki <noinclude>{{intricate}}</noinclude> {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{documentation}} </noinclude> 5oy1ulrxaqv5gk4cfrrqdyvl3ykuv54 796548 796547 2007-11-23T05:57:30Z 61.45.15.143 add ja link 796548 wikitext text/x-wiki <noinclude>{{intricate}}</noinclude> {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{documentation}} [[ja:Template:武道・武術]] </noinclude> az9g0nep9uiow5adsp7bc35qacrzlmz 796549 796548 2007-11-24T11:58:11Z 61.45.15.143 add ja link 796549 wikitext text/x-wiki <noinclude>{{intricate}}</noinclude> {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{documentation}} [[ja:Template:Infobox_武道・武術]] </noinclude> 68sujhnqzf895ndk3m3w8z63zdgxwii 796550 796549 2007-11-24T15:42:55Z en>Bradford44 0 moving interwiki link to documentation subpage 796550 wikitext text/x-wiki <noinclude>{{intricate}}</noinclude> {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{documentation}} </noinclude> 5oy1ulrxaqv5gk4cfrrqdyvl3ykuv54 796551 796550 2008-04-16T16:21:54Z en>Nate1481 0 ad ansestor & decendent 796551 wikitext text/x-wiki <noinclude>{{intricate}}</noinclude> {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{ancestor_arts<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Ancestor arts''' <!-- -->{{!}} {{{ancestor_arts}}} }} |- {{#if:{{{descendant_arts<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Descendant arts''' <!-- -->{{!}} {{{descendant_arts}}}}} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{documentation}} </noinclude> 2gcsevlbnzxx466gcuiiy1wghjansx1 796552 796551 2008-07-02T05:54:27Z 68.148.164.166 796552 wikitext text/x-wiki <noinclude>{{intricate}}</noinclude>{| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{ancestor_arts<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Ancestor arts''' <!-- -->{{!}} {{{ancestor_arts}}} }} |- {{#if:{{{descendant_arts<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Descendant arts''' <!-- -->{{!}} {{{descendant_arts}}}}} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{documentation}} </noinclude> otbkhfb18ynz3dmaxnroeblf79fx162 796553 796552 2008-07-02T05:55:57Z 68.148.164.166 [[WP:UNDO|Undid]] revision 223021109 by [[Special:Contributions/68.148.164.166|68.148.164.166]] ([[User talk:68.148.164.166|talk]]) 796553 wikitext text/x-wiki <noinclude>{{intricate}}</noinclude> {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{ancestor_arts<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Ancestor arts''' <!-- -->{{!}} {{{ancestor_arts}}} }} |- {{#if:{{{descendant_arts<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Descendant arts''' <!-- -->{{!}} {{{descendant_arts}}}}} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{documentation}} </noinclude> 2gcsevlbnzxx466gcuiiy1wghjansx1 796554 796553 2008-07-04T11:51:35Z en>Sardanaphalus 0 moved [[Template:Infobox martial art]] to [[Template:Infobox Martial art]]: "Infobox" + Sentenced-cased (MoS) topic name 796553 wikitext text/x-wiki <noinclude>{{intricate}}</noinclude> {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{ancestor_arts<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Ancestor arts''' <!-- -->{{!}} {{{ancestor_arts}}} }} |- {{#if:{{{descendant_arts<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Descendant arts''' <!-- -->{{!}} {{{descendant_arts}}}}} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} }} |}<noinclude> {{documentation}} </noinclude> 2gcsevlbnzxx466gcuiiy1wghjansx1 796555 796554 2008-07-25T15:27:10Z en>Nate1481 0 796555 wikitext text/x-wiki <noinclude>{{intricate}}</noinclude> {| class="infobox" style="width: 23em; font-size: 0.9em;" |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{logo|}}}|<!--then:-->[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|<!--then:-->{{{logosize}}}|<!--else:-->150px}}| ]]<br/><small>{{{logocaption|}}}</small> }} |- ! colspan="2" style="font-size: larger; background-color: #ccccff;" | {{{name}}} |- |colspan="2" style="text-align:center; font-size:90%;"| {{#if:{{{image|}}}|<!--then:-->[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|<!--then:-->{{{imagesize}}}|<!--else:-->200px}}| ]]<br/><small>{{{imagecaption|}}}</small> }} |- {{#if:{{{aka<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Also known as''' <!-- -->{{!}} {{{aka}}} }} |- {{#if:{{{focus<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Focus''' <!-- -->{{!}} {{{focus}}} }} |- {{#if:{{{hardness<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Hardness''' <!-- -->{{!}} {{{hardness}}} }} |- {{#if:{{{country<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Country of origin''' <!-- -->{{!}} {{{country}}} }} |- {{#if:{{{creator<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Creator''' <!-- -->{{!}} {{{creator}}} }} |- {{#if:{{{parenthood<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Parenthood''' <!-- -->{{!}} {{{parenthood}}} }} |- {{#if:{{{famous_pract<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Famous practitioners''' <!-- -->{{!}} {{{famous_pract}}} }} |- {{#if:{{{ancestor_arts<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Ancestor arts''' <!-- -->{{!}} {{{ancestor_arts}}} }} |- {{#if:{{{descendant_arts<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Descendant arts''' <!-- -->{{!}} {{{descendant_arts}}}}} |- {{#if:{{{olympic<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Olympic Sport''' <!-- -->{{!}} {{{olympic}}} }} |- {{#if:{{{website<includeonly>|</includeonly>}}}| <!-- -->{{!}} '''Official Site''' <!-- -->{{!}} {{{website}}} {{reflist}}}} |}<noinclude> {{documentation}} </noinclude> lhr2f6al498a2aysv913h9ix7p87nn0 796556 796555 2009-02-02T10:19:18Z en>Thumperward 0 convert to {{infobox}} for code clarity and future maintainability. if there are any issues with the code, please let me know and I'll try to fix them ASAP 796556 wikitext text/x-wiki {{ infobox | title = {{#if:{{{logo|}}}|[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|{{{logosize}}}|150px}}]]}} | above = {{{logocaption|}}} | abovestyle = font-weight: normal; font-size: small | subtitle = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | subtitlestyle = font-size: 120% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|{{{imagesize}}}|}}]]}} | caption = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{aka|}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Parenthood | data6 = {{{parenthood|}}} | label7 = Famous practitioners | data7 = {{{famous_pract|}}} | label8 = Ancestor arts | data8 = {{{ancestor_arts|}}} | label9 = Descendant arts | data9 = {{{descendant_arts|}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|}}} }}<noinclude>{{documentation}}{{intricate}}</noinclude> 0e65wv64itw06tlrfmryp81ab9othww 796557 796556 2009-02-02T10:21:41Z en>Thumperward 0 oops 796557 wikitext text/x-wiki {{ infobox | title = {{#if:{{{logo|}}}|[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|{{{logosize}}}|150px}}]]}} | above = {{{logocaption|}}} | abovestyle = font-weight: normal; font-size: small | subheader = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | subheaderstyle = font-size: 120% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|{{{imagesize}}}|}}]]}} | caption = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{aka|}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Parenthood | data6 = {{{parenthood|}}} | label7 = Famous practitioners | data7 = {{{famous_pract|}}} | label8 = Ancestor arts | data8 = {{{ancestor_arts|}}} | label9 = Descendant arts | data9 = {{{descendant_arts|}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|}}} }}<noinclude>{{documentation}}{{intricate}}</noinclude> 8taadec4f187gaj8hwn7vp2ufhp72dk 796558 796557 2009-02-02T10:22:41Z en>Thumperward 0 further tweaks 796558 wikitext text/x-wiki {{ infobox | title = {{#if:{{{logo|}}}|[[Image:{{{logo}}}|{{#if:{{{logosize|}}}|{{{logosize}}}|150px}}]]}} | above = {{{logocaption|}}} | abovestyle = font-weight: normal; font-size: smaller | subheader = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | subheaderstyle = font-size: 130%; font-weight: bold | image = {{#if:{{{image|}}}|[[Image:{{{image}}}|{{#if:{{{imagesize|}}}|{{{imagesize}}}|}}]]}} | caption = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{aka|}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Parenthood | data6 = {{{parenthood|}}} | label7 = Famous practitioners | data7 = {{{famous_pract|}}} | label8 = Ancestor arts | data8 = {{{ancestor_arts|}}} | label9 = Descendant arts | data9 = {{{descendant_arts|}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|}}} }}<noinclude>{{documentation}}{{intricate}}</noinclude> 0tk1ed891r59exlj4xpvwwbw5ob1npl 796559 796558 2009-02-02T10:25:53Z en>Thumperward 0 fix images 796559 wikitext text/x-wiki {{ infobox | title = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|150px}}]]}} | above = {{{logocaption|}}} | abovestyle = font-weight: normal; font-size: 85% | subheader = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | subheaderstyle = font-size: 130%; font-weight: bold | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|150px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 85% | label1 = Also known as | data1 = {{{aka|}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Parenthood | data6 = {{{parenthood|}}} | label7 = Famous practitioners | data7 = {{{famous_pract|}}} | label8 = Ancestor arts | data8 = {{{ancestor_arts|}}} | label9 = Descendant arts | data9 = {{{descendant_arts|}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|}}} }}<noinclude>{{documentation}}{{intricate}}</noinclude> 5xa7424nfjrivhh2o05p1vyb6xzhd8h 796560 796559 2009-02-02T10:36:02Z en>Thumperward 0 swap attributes around, increase default image size to 200px 796560 wikitext text/x-wiki {{ infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{aka|}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Parenthood | data6 = {{{parenthood|}}} | label7 = Famous practitioners | data7 = {{{famous_pract|}}} | label8 = Ancestor arts | data8 = {{{ancestor_arts|}}} | label9 = Descendant arts | data9 = {{{descendant_arts|}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|}}} }}<noinclude>{{documentation}}{{intricate}}</noinclude> 8grpyi20jsgkkhmuuer3723qf7dxdo7 796561 796560 2009-02-02T10:40:09Z en>Thumperward 0 rm doc template, move to doc page 796561 wikitext text/x-wiki {{ infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{aka|}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Parenthood | data6 = {{{parenthood|}}} | label7 = Famous practitioners | data7 = {{{famous_pract|}}} | label8 = Ancestor arts | data8 = {{{ancestor_arts|}}} | label9 = Descendant arts | data9 = {{{descendant_arts|}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|}}} }}<noinclude>{{documentation}}</noinclude> 40zld0rqt4qbk19al7tppfx1cpeh1vs 796562 796561 2009-08-21T08:33:42Z en>Irønie 0 interwiki 796562 wikitext text/x-wiki {{ infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{aka|}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Parenthood | data6 = {{{parenthood|}}} | label7 = Famous practitioners | data7 = {{{famous_pract|}}} | label8 = Ancestor arts | data8 = {{{ancestor_arts|}}} | label9 = Descendant arts | data9 = {{{descendant_arts|}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|}}} }}<noinclude>{{documentation}} [[fr:Template:Infox Art martial]] </noinclude> cpix7q3hqmlkd00k67j1bg49ip7fte0 796563 796562 2009-12-30T18:20:14Z en>Yakudza19 0 interwiki 796563 wikitext text/x-wiki {{ infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{aka|}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Parenthood | data6 = {{{parenthood|}}} | label7 = Famous practitioners | data7 = {{{famous_pract|}}} | label8 = Ancestor arts | data8 = {{{ancestor_arts|}}} | label9 = Descendant arts | data9 = {{{descendant_arts|}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|}}} }}<noinclude>{{documentation}} [[fr:Template:Infox Art martial]] [[ru:Шаблон:Infobox martial art group]] </noinclude> fnmdyntpb8h5zs6kjndaaiagzkgo408 796564 796563 2010-02-24T10:47:24Z en>Kookyunii 0 796564 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} }}<noinclude> {{documentation}} [[fr:Template:Infox Art martial]] [[ru:Шаблон:Infobox martial art group]] </noinclude> srhy0dictsbjm8bgbtcjf0p0yqlx6z4 796565 796564 2010-09-04T14:15:19Z en>Rich Farmbrough 0 moved [[Template:Infobox Martial art]] to [[Template:Infobox martial art]] over redirect: Caps 796564 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} }}<noinclude> {{documentation}} [[fr:Template:Infox Art martial]] [[ru:Шаблон:Infobox martial art group]] </noinclude> srhy0dictsbjm8bgbtcjf0p0yqlx6z4 796566 796565 2011-04-08T14:14:12Z en>MerlIwBot 0 robot Removing: [[fr:Modèle:Infox Art martial]] 796566 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} }}<noinclude> {{documentation}} [[ru:Шаблон:Infobox martial art group]] </noinclude> ncmwelt4frcm5m1dms8jhiwy2wbili7 796567 796566 2011-06-14T16:44:08Z en>Tommy-g-98 0 796567 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} }}<noinclude> {{documentation}} [[ru:Шаблон:Infobox martial art group]] </noinclude> emo9qo3ptbg8vhpcphws7vqxspy7prj 796568 796567 2011-06-14T18:25:33Z en>Tommy-g-98 0 796568 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial Art | data13 = {{{martialart|}}} }}<noinclude> {{documentation}} [[ru:Шаблон:Infobox martial art group]] </noinclude> tu4xwepoip4epup8xjd49105qvwpr16 796569 796568 2011-06-14T18:30:37Z en>Tommy-g-98 0 796569 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial Art | data13 = {{{martialart|}}} | label14 = No. of Moves | data14 = moves | label15 = No. of Different Moves | data15 = {{{dif_moves|}}} }}<noinclude> {{documentation}} [[ru:Шаблон:Infobox martial art group]] </noinclude> 1wev4nr1l7i2s1tni1h6glpt35widj7 796570 796569 2011-06-14T18:33:33Z en>Tommy-g-98 0 796570 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial Art | data13 = {{{martialart|}}} | label14 = No. of Moves | data14 = {{{moves|}}} | label15 = No. of Different Moves | data15 = {{{dif_moves|}}} }}<noinclude> {{documentation}} [[ru:Шаблон:Infobox martial art group]] </noinclude> dde80qx8g4bayasgna8znh3m8pylb2k 796571 796570 2011-07-03T16:12:42Z en>Aoidh 0 Reverted to revision 434276143 by Tommy-g-98: Removed "moves". ([[WP:TW|TW]]) 796571 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial Art | data13 = {{{martialart|}}} }}<noinclude> {{documentation}} [[ru:Шаблон:Infobox martial art group]] </noinclude> tu4xwepoip4epup8xjd49105qvwpr16 796572 796571 2012-03-19T18:39:04Z en>Rich Farmbrough 0 796572 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial art | data13 = {{{martialart|}}} }}<noinclude> {{documentation}} [[ru:Шаблон:Infobox martial art group]] </noinclude> 2htnos9temhdp6n8mc64wa2pl4n3n0r 796573 796572 2013-07-17T03:55:17Z en>EmausBot 0 Bot: Migrating 1 interwiki links, now provided by [[Wikipedia:Wikidata|Wikidata]] on [[d:Q5915378]] 796573 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial art | data13 = {{{martialart|}}} }}<noinclude> {{documentation}} </noinclude> r3x4hmuyjnvinaikk138rwlmkt8e4tk 796574 796573 2013-09-21T16:33:27Z en>Zyxw 0 add "module" parameter for embedding other infoboxes - see [[Taekwondo]] for example 796574 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; font-size: 90% | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | captionstyle = font-size: 90% | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial art | data13 = {{{martialart|}}} | data14 = {{{misc|{{{module|}}}}}} }}<noinclude> {{documentation}} </noinclude> krq16s11h9jsy5zhlb5do5kwgp4hczm 796575 796574 2015-06-24T18:49:08Z en>Izkala 0 [[WP:ACCESS]] 796575 wikitext text/x-wiki {{infobox | title = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} | above = {{#if:{{{logo|}}}|[[Image:{{{logo}}}{{!}}{{#if:{{{logosize|}}}|{{{logosize}}}|200px}}]]}} | subheader = {{{logocaption|}}} | subheaderstyle = font-weight: normal; | image = {{#if:{{{image|}}}|[[Image:{{{image}}}{{!}}{{#if:{{{imagesize|}}}|{{{imagesize}}}|200px}}]]}} | caption = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial art | data13 = {{{martialart|}}} | data14 = {{{misc|{{{module|}}}}}} }}<noinclude> {{documentation}} </noinclude> 94qqtm5opyusnvpvzjdahmnjm9vv8s2 796576 796575 2015-06-24T18:51:13Z en>Izkala 0 l 796576 wikitext text/x-wiki {{Infobox | title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px|alt={{{logocaption|}}}}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|alt={{{imagecaption|}}}}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial art | data13 = {{{martialart|}}} | data14 = {{{misc|{{{module|}}}}}} }}<noinclude> {{Documentation}} </noinclude> muyb6fbfgruaas0suhbf8ggul9d57vc 796577 796576 2018-01-19T00:30:29Z en>Primefac 0 Protected "[[Template:Infobox martial art]]": [[WP:SEMIPROT|semi-protection]] of high-usage templates to combat systematic vandalism ([Edit=Require autoconfirmed or confirmed access] (indefinite) [Move=Require autoconfirmed or confirmed access] (indefi... 796576 wikitext text/x-wiki {{Infobox | title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px|alt={{{logocaption|}}}}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|alt={{{imagecaption|}}}}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial art | data13 = {{{martialart|}}} | data14 = {{{misc|{{{module|}}}}}} }}<noinclude> {{Documentation}} </noinclude> muyb6fbfgruaas0suhbf8ggul9d57vc 796578 796577 2018-08-17T21:00:47Z en>Jonesey95 0 rm imagecaption as a duplicate of alt=. Inappropriate use, and it can cause linter errors 796578 wikitext text/x-wiki {{Infobox | title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px|alt={{{logocaption|}}}}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|alt=}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial art | data13 = {{{martialart|}}} | data14 = {{{misc|{{{module|}}}}}} }}<noinclude> {{Documentation}} </noinclude> qe04nbiyrrvf4pbmdckzc64wdigrj84 796579 796578 2018-08-17T21:01:14Z en>Jonesey95 0 rm other alt, inappropriate use 796579 wikitext text/x-wiki {{Infobox | title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Creator | data5 = {{{creator|}}} | label6 = Famous practitioners | data6 = {{{famous pract|{{{famous_pract|}}}}}} | label7 = Parenthood | data7 = {{{parenthood|}}} | label8 = Ancestor arts | data8 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label9 = Descendant arts | data9 = {{{descendant arts|{{{descendant_arts|}}}}}} | label10 = Olympic sport | data10 = {{{olympic|}}} | label11 = Official website | data11 = {{{website|{{{homepage|}}}}}} | label12 = Meaning | data12 = {{{meaning|}}} | label13 = Martial art | data13 = {{{martialart|}}} | data14 = {{{misc|{{{module|}}}}}} }}<noinclude> {{Documentation}} </noinclude> 1qusk4kmtwz4k4usu41chxbfmw2nz4u 796580 796579 2023-09-06T13:50:35Z en>Mladifilozof 0 fix formation parameter 796580 wikitext text/x-wiki {{Infobox | title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{{famous pract|{{{famous_pract|}}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label10 = Descendant arts | data10 = {{{descendant arts|{{{descendant_arts|}}}}}} | label11 = Olympic sport | data11 = {{{olympic|}}} | label12 = Official website | data12 = {{{website|{{{homepage|}}}}}} | label13 = Meaning | data13 = {{{meaning|}}} | label14 = Martial art | data14 = {{{martialart|}}} | data15 = {{{misc|{{{module|}}}}}} }}<noinclude> {{Documentation}} </noinclude> oft84zmbcq5seerndg38xzeshnaz0fv 796581 796580 2023-09-06T14:13:16Z en>Mladifilozof 0 add cognates parameter 796581 wikitext text/x-wiki {{Infobox | title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{{famous pract|{{{famous_pract|}}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label10 = Descendant arts | data10 = {{{descendant arts|{{{descendant_arts|}}}}}} | label11 = Cognate arts | data11 = {{{cognates|{{{cognates|}}}}}} | label12 = Olympic sport | data12 = {{{olympic|}}} | label13 = Official website | data13 = {{{website|{{{homepage|}}}}}} | label14 = Meaning | data14 = {{{meaning|}}} | label15 = Martial art | data15 = {{{martialart|}}} | data16 = {{{misc|{{{module|}}}}}} }}<noinclude> {{Documentation}} </noinclude> dvli2dbp10kv9f2rq9xst8e4y0dn68i 796582 796581 2023-09-06T21:45:05Z en>Mladifilozof 0 cognates to related arts 796582 wikitext text/x-wiki {{Infobox | title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{{famous pract|{{{famous_pract|}}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label10 = Descendant arts | data10 = {{{descendant arts|{{{descendant_arts|}}}}}} | label11 = Cognate arts | data11 = {{{related arts|{{{related_arts|}}}}}} | label12 = Olympic sport | data12 = {{{olympic|}}} | label13 = Official website | data13 = {{{website|{{{homepage|}}}}}} | label14 = Meaning | data14 = {{{meaning|}}} | label15 = Martial art | data15 = {{{martialart|}}} | data16 = {{{misc|{{{module|}}}}}} }}<noinclude> {{Documentation}} </noinclude> 8hq2xhvz16lwmx9fq6vlvetuvcfrbrm 796583 796582 2023-09-06T21:46:16Z en>Mladifilozof 0 796583 wikitext text/x-wiki {{Infobox | title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{{famous pract|{{{famous_pract|}}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label10 = Descendant arts | data10 = {{{descendant arts|{{{descendant_arts|}}}}}} | label11 = Related arts | data11 = {{{related arts|{{{related_arts|}}}}}} | label12 = Olympic sport | data12 = {{{olympic|}}} | label13 = Official website | data13 = {{{website|{{{homepage|}}}}}} | label14 = Meaning | data14 = {{{meaning|}}} | label15 = Martial art | data15 = {{{martialart|}}} | data16 = {{{misc|{{{module|}}}}}} }}<noinclude> {{Documentation}} </noinclude> bl1807e5a5k13kq01ik8zhv1p0e2fbp 796584 796583 2023-09-10T10:23:47Z en>Mladifilozof 0 fix imagesize 796584 wikitext text/x-wiki {{Infobox | title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{imagesize|}}}||sizedefault=200px}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{{famous pract|{{{famous_pract|}}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label10 = Descendant arts | data10 = {{{descendant arts|{{{descendant_arts|}}}}}} | label11 = Related arts | data11 = {{{related arts|{{{related_arts|}}}}}} | label12 = Olympic sport | data12 = {{{olympic|}}} | label13 = Official website | data13 = {{{website|{{{homepage|}}}}}} | label14 = Meaning | data14 = {{{meaning|}}} | label15 = Martial art | data15 = {{{martialart|}}} | data16 = {{{misc|{{{module|}}}}}} }}<noinclude> {{Documentation}} </noinclude> n6fcgamo9i71jejmmle81btjjkc84gz 796585 796584 2025-01-30T16:01:51Z en>Frietjes 0 796585 wikitext text/x-wiki {{Infobox | title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAMEBASE}}}} | subheader = {{#if:{{{native_name|{{{native name|}}}}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{{native_name|{{{native name}}}}}}{{#if:{{{native_name_lang|}}}|</div>}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{imagesize|}}}||sizedefault=200px}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{{othername|{{{aka|}}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{{country|{{{origin|}}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{{famous pract|{{{famous_pract|}}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{{ancestor arts|{{{ancestor_arts|}}}}}} | label10 = Descendant arts | data10 = {{{descendant arts|{{{descendant_arts|}}}}}} | label11 = Related arts | data11 = {{{related arts|{{{related_arts|}}}}}} | label12 = Olympic sport | data12 = {{{olympic|}}} | label13 = Official website | data13 = {{{website|{{{homepage|}}}}}} | label14 = Meaning | data14 = {{{meaning|}}} | label15 = Martial art | data15 = {{{martialart|}}} | data16 = {{{misc|{{{module|}}}}}} }}<noinclude> {{documentation}} </noinclude> b1th5f7fyj4gr6q04b4fk0512uhssqs 796586 796585 2025-01-30T16:03:09Z en>Frietjes 0 add [[Category:Pages using infobox martial art with unknown parameters]] 796586 wikitext text/x-wiki {{Infobox | title = {{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} | subheader = {{#if:{{{native_name|}}}{{{native name|}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{if empty|{{{native_name|}}}|{{{native name}}}}}{{#if:{{{native_name_lang|}}}|</div>}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}||sizedefault=200px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{imagesize|}}}||sizedefault=200px}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{if empty|{{{othername|}}}|{{{aka|}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{if empty|{{{country|}}}|{{{origin|}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{if empty|{{{famous pract|}}}|{{{famous_pract|}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{if empty|{{{ancestor arts|}}}|{{{ancestor_arts|}}}}} | label10 = Descendant arts | data10 = {{if empty|{{{descendant arts|}}}|{{{descendant_arts|}}}}} | label11 = Related arts | data11 = {{if empty|{{{related arts|}}}|{{{related_arts|}}}}} | label12 = Olympic sport | data12 = {{{olympic|}}} | label13 = Official website | data13 = {{if empty|{{{website|}}}|{{{homepage|}}}}} | label14 = Meaning | data14 = {{{meaning|}}} | label15 = Martial art | data15 = {{{martialart|}}} | data16 = {{if empty|{{{misc|}}}|{{{module|}}}}} }}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox martial art with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox martial art]] with unknown parameter "_VALUE_"|ignoreblank=y| aka | ancestor arts | ancestor_arts | country | creator | descendant arts | descendant_arts | famous pract | famous_pract | focus | formation | hardness | homepage | image | imagecaption | imagesize | logo | logocaption | logosize | martialart | meaning | misc | module | name | native name | native_name | native_name_lang | olympic | origin | othername | parenthood | related arts | related_arts | website }}<noinclude> {{documentation}} </noinclude> 4rnty94jwhw3f8qgnvv7xxptgwhx1cs 796587 796586 2025-01-30T16:19:06Z en>Frietjes 0 796587 wikitext text/x-wiki {{Infobox | title = {{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} | subheader = {{#if:{{{native_name|}}}{{{native name|}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{if empty|{{{native_name|}}}|{{{native name}}}}}{{#if:{{{native_name_lang|}}}|</div>}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}|alt={{{logoalt|}}}|sizedefault=200px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{imagesize|}}}|alt={{{imagealt|}}}|sizedefault=200px}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{if empty|{{{othername|}}}|{{{aka|}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{if empty|{{{country|}}}|{{{origin|}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{if empty|{{{famous pract|}}}|{{{famous_pract|}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{if empty|{{{ancestor arts|}}}|{{{ancestor_arts|}}}}} | label10 = Descendant arts | data10 = {{if empty|{{{descendant arts|}}}|{{{descendant_arts|}}}}} | label11 = Related arts | data11 = {{if empty|{{{related arts|}}}|{{{related_arts|}}}}} | label12 = Olympic sport | data12 = {{{olympic|}}} | label13 = Official website | data13 = {{if empty|{{{website|}}}|{{{homepage|}}}}} | label14 = Meaning | data14 = {{{meaning|}}} | label15 = Martial art | data15 = {{{martialart|}}} | data16 = {{if empty|{{{misc|}}}|{{{module|}}}}} }}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox martial art with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox martial art]] with unknown parameter "_VALUE_"|ignoreblank=y| aka | ancestor arts | ancestor_arts | country | creator | descendant arts | descendant_arts | famous pract | famous_pract | focus | formation | hardness | homepage | image | imagealt | imagecaption | imagesize | logo | logoalt | logocaption | logosize | martialart | meaning | misc | module | name | native name | native_name | native_name_lang | olympic | origin | othername | parenthood | related arts | related_arts | website }}<noinclude> {{documentation}} </noinclude> d2nqifeusf8jvm8a4fsg8gykjt24gy8 796588 796587 2025-02-28T00:48:12Z en>Goszei 0 796588 wikitext text/x-wiki {{Infobox | title = {{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} | subheader = {{#if:{{{native_name|}}}{{{native name|}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{if empty|{{{native_name|}}}|{{{native name}}}}}{{#if:{{{native_name_lang|}}}|</div>}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}|alt={{{logoalt|}}}|sizedefault=220px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{imagesize|}}}|alt={{{imagealt|}}}|sizedefault=220px}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{if empty|{{{othername|}}}|{{{aka|}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{if empty|{{{country|}}}|{{{origin|}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{if empty|{{{famous pract|}}}|{{{famous_pract|}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{if empty|{{{ancestor arts|}}}|{{{ancestor_arts|}}}}} | label10 = Descendant arts | data10 = {{if empty|{{{descendant arts|}}}|{{{descendant_arts|}}}}} | label11 = Related arts | data11 = {{if empty|{{{related arts|}}}|{{{related_arts|}}}}} | label12 = Olympic sport | data12 = {{{olympic|}}} | label13 = Official website | data13 = {{if empty|{{{website|}}}|{{{homepage|}}}}} | label14 = Meaning | data14 = {{{meaning|}}} | label15 = Martial art | data15 = {{{martialart|}}} | data16 = {{if empty|{{{misc|}}}|{{{module|}}}}} }}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox martial art with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox martial art]] with unknown parameter "_VALUE_"|ignoreblank=y| aka | ancestor arts | ancestor_arts | country | creator | descendant arts | descendant_arts | famous pract | famous_pract | focus | formation | hardness | homepage | image | imagealt | imagecaption | imagesize | logo | logoalt | logocaption | logosize | martialart | meaning | misc | module | name | native name | native_name | native_name_lang | olympic | origin | othername | parenthood | related arts | related_arts | website }}<noinclude> {{documentation}} </noinclude> k6xcov8n84ew37d0w0ixyhqt4jr7a91 796589 796588 2025-08-08T15:54:56Z en>O-ring 0 /* top */ 796589 wikitext text/x-wiki {{Infobox | title = {{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} | subheader = {{#if:{{{native_name|}}}{{{native name|}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{if empty|{{{native_name|}}}|{{{native name|}}}}}{{#if:{{{native_name_lang|}}}|</div>}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}|alt={{{logoalt|}}}|sizedefault=220px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{imagesize|}}}|alt={{{imagealt|}}}|sizedefault=220px}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{if empty|{{{othername|}}}|{{{aka|}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{if empty|{{{country|}}}|{{{origin|}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{if empty|{{{famous pract|}}}|{{{famous_pract|}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{if empty|{{{ancestor arts|}}}|{{{ancestor_arts|}}}}} | label10 = Descendant arts | data10 = {{if empty|{{{descendant arts|}}}|{{{descendant_arts|}}}}} | label11 = Related arts | data11 = {{if empty|{{{related arts|}}}|{{{related_arts|}}}}} | label12 = Olympic sport | data12 = {{{olympic|}}} | label13 = Official website | data13 = {{if empty|{{{website|}}}|{{{homepage|}}}}} | label14 = Meaning | data14 = {{{meaning|}}} | label15 = Martial art | data15 = {{{martialart|}}} | data16 = {{if empty|{{{misc|}}}|{{{module|}}}}} }}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox martial art with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox martial art]] with unknown parameter "_VALUE_"|ignoreblank=y| aka | ancestor arts | ancestor_arts | country | creator | descendant arts | descendant_arts | famous pract | famous_pract | focus | formation | hardness | homepage | image | imagealt | imagecaption | imagesize | logo | logoalt | logocaption | logosize | martialart | meaning | misc | module | name | native name | native_name | native_name_lang | olympic | origin | othername | parenthood | related arts | related_arts | website }}<noinclude> {{documentation}} </noinclude> pfuectayumgebmry3t7qi1i5cixbi7i 796590 796589 2026-06-05T22:42:43Z SM7 3953 63 revisions imported from [[:en:Template:Infobox_martial_art]] 796589 wikitext text/x-wiki {{Infobox | title = {{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} | subheader = {{#if:{{{native_name|}}}{{{native name|}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{if empty|{{{native_name|}}}|{{{native name|}}}}}{{#if:{{{native_name_lang|}}}|</div>}}}} | image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logosize|}}}|alt={{{logoalt|}}}|sizedefault=220px}} | caption1 = {{{logocaption|}}} | image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{imagesize|}}}|alt={{{imagealt|}}}|sizedefault=220px}} | caption2 = {{{imagecaption|}}} | label1 = Also known as | data1 = {{if empty|{{{othername|}}}|{{{aka|}}}}} | label2 = Focus | data2 = {{{focus|}}} | label3 = Hardness | data3 = {{{hardness|}}} | label4 = Country of origin | data4 = {{if empty|{{{country|}}}|{{{origin|}}}}} | label5 = Date of formation | data5 = {{{formation|}}} | label6 = Creator | data6 = {{{creator|}}} | label7 = Famous practitioners | data7 = {{if empty|{{{famous pract|}}}|{{{famous_pract|}}}}} | label8 = Parenthood | data8 = {{{parenthood|}}} | label9 = Ancestor arts | data9 = {{if empty|{{{ancestor arts|}}}|{{{ancestor_arts|}}}}} | label10 = Descendant arts | data10 = {{if empty|{{{descendant arts|}}}|{{{descendant_arts|}}}}} | label11 = Related arts | data11 = {{if empty|{{{related arts|}}}|{{{related_arts|}}}}} | label12 = Olympic sport | data12 = {{{olympic|}}} | label13 = Official website | data13 = {{if empty|{{{website|}}}|{{{homepage|}}}}} | label14 = Meaning | data14 = {{{meaning|}}} | label15 = Martial art | data15 = {{{martialart|}}} | data16 = {{if empty|{{{misc|}}}|{{{module|}}}}} }}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox martial art with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox martial art]] with unknown parameter "_VALUE_"|ignoreblank=y| aka | ancestor arts | ancestor_arts | country | creator | descendant arts | descendant_arts | famous pract | famous_pract | focus | formation | hardness | homepage | image | imagealt | imagecaption | imagesize | logo | logoalt | logocaption | logosize | martialart | meaning | misc | module | name | native name | native_name | native_name_lang | olympic | origin | othername | parenthood | related arts | related_arts | website }}<noinclude> {{documentation}} </noinclude> pfuectayumgebmry3t7qi1i5cixbi7i टेम्पलेट:Infobox martial art/doc 10 100970 796591 2025-01-30T16:06:26Z en>Frietjes 0 /* See also */ 796591 wikitext text/x-wiki {{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE YOU CAN EDIT THE TEMPLATE DOCUMENTATION BELOW THIS COMMENT -->{{Infobox martial art | logo = Mediawiki-logo.png | logocaption = logocaption | logosize = 100px | image = Mediawiki-logo.png | imagecaption = imagecaption | imagesize = 100px | name = name | native_name = native_name | aka = aka | focus = focus | hardness = hardness | country = country | formation = formation | parenthood = parenthood | related arts = related arts | famous_pract = famous_pract | olympic = olympic | website = website | meaning = meaning | martialart = martial_art }} This is an [[WP:INFOBOX|infobox]] for use in articles about types of [[martial arts]]. == Usage == All fields are optional, but as many as possible should be filled in. <syntaxhighlight lang="wikitext">{{Infobox martial art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | native_name = | native_name_lang= | aka = | focus = | hardness = | country = | creator = | formation = | famous pract = | parenthood = | ancestor arts = | descendant arts = | related arts = | olympic = | website = | meaning = | martialart = }}</syntaxhighlight> == Parameters == *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''native_name''', organization's name in its local language *'''native_name_lang''', required ISO 639-1 code of the above native language *'''aka''', alternative names for the martial art. *'''focus''', the main focus of the martial art. Using ''one'' of '''Striking''', '''Grappling''', '''Weapons''', '''Mixed''' or '''Hybrid''' these last two are for use where a main focus is not present, having a focus does not exclude other training, but does give a 'flavour' of the art. If a specific weapon (e.g. the katana in iaido) is use then this should be included in brackets. Links such as <nowiki>[[Hybrid martial arts|Hybrid]], [[Strike (attack)|Striking]], [[Grappling]]</nowiki> should be used. Exceptions may occur where a broad (i.e. including non-practitioners) consensus is formed on the talk page e.g. [[Wing Chun]] *'''hardness''', the degree of violence in duelling/sparring, e.g. [[contact sport|semi-contact]], full-contact, etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flag icon}}. If the origin is ambiguous or mixed (e.g. boxing) flags should not be used and consider omitting the field entirely. *'''creator''', the creator of the martial art, ''if there is one''. *'''formation''', the date the martial art was formed, ''if there is one''. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art (should link own article or details in article) *'''ancestor arts''', The martial arts that inspired this one. *'''descendant arts''', The martial arts that were inspired this one. *'''related arts''', The martial arts that share the same ancestor as this one. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art if there is a single organisation, if multiple organisations leave out. == See also == *{{tl|infobox koryu}} *{{tl|infobox martial artist}} *{{tl|infobox martial art form}} *{{tl|infobox martial art school}} *{{tl|infobox Chinese}} == Tracking category == *{{clc|Pages using infobox martial art with unknown parameters}} <includeonly>{{Sandbox other|| <!-- PLEASE ADD CATEGORIES BELOW THIS LINE, THANKS. --> [[Category:Martial arts infobox templates| ]] }}</includeonly> cws3yo1jzb20uaguk5t1n2iwg9ntvxy 796592 796591 2026-06-05T22:43:03Z SM7 3953 1 revision imported from [[:en:Template:Infobox_martial_art/doc]] 796591 wikitext text/x-wiki {{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE YOU CAN EDIT THE TEMPLATE DOCUMENTATION BELOW THIS COMMENT -->{{Infobox martial art | logo = Mediawiki-logo.png | logocaption = logocaption | logosize = 100px | image = Mediawiki-logo.png | imagecaption = imagecaption | imagesize = 100px | name = name | native_name = native_name | aka = aka | focus = focus | hardness = hardness | country = country | formation = formation | parenthood = parenthood | related arts = related arts | famous_pract = famous_pract | olympic = olympic | website = website | meaning = meaning | martialart = martial_art }} This is an [[WP:INFOBOX|infobox]] for use in articles about types of [[martial arts]]. == Usage == All fields are optional, but as many as possible should be filled in. <syntaxhighlight lang="wikitext">{{Infobox martial art | logo = | logocaption = | logosize = | image = | imagecaption = | imagesize = | name = | native_name = | native_name_lang= | aka = | focus = | hardness = | country = | creator = | formation = | famous pract = | parenthood = | ancestor arts = | descendant arts = | related arts = | olympic = | website = | meaning = | martialart = }}</syntaxhighlight> == Parameters == *'''logo''', a logo of the martial art. Should be placed using the syntax "imagename.ext"(e.g. ''logo=JKD.jpg''). *'''logocaption''', a caption to be used with the logo. *'''logosize''', the size of the logo. If no value is placed, the default value of 150px is used. *'''image''', a sample image of the martial art. This could be a famous practitioner or an image of someone practicing it. The syntax is the same as for the logo. *'''imagecaption''', a caption to be used with the image. *'''imagesize''', the size of the image. If no value is placed, the default value of 200px is used. *'''name''', name of the martial art. *'''native_name''', organization's name in its local language *'''native_name_lang''', required ISO 639-1 code of the above native language *'''aka''', alternative names for the martial art. *'''focus''', the main focus of the martial art. Using ''one'' of '''Striking''', '''Grappling''', '''Weapons''', '''Mixed''' or '''Hybrid''' these last two are for use where a main focus is not present, having a focus does not exclude other training, but does give a 'flavour' of the art. If a specific weapon (e.g. the katana in iaido) is use then this should be included in brackets. Links such as <nowiki>[[Hybrid martial arts|Hybrid]], [[Strike (attack)|Striking]], [[Grappling]]</nowiki> should be used. Exceptions may occur where a broad (i.e. including non-practitioners) consensus is formed on the talk page e.g. [[Wing Chun]] *'''hardness''', the degree of violence in duelling/sparring, e.g. [[contact sport|semi-contact]], full-contact, etc. *'''country''', the country of origin. The country's flag should precede the name using the template {{tl|flag icon}}. If the origin is ambiguous or mixed (e.g. boxing) flags should not be used and consider omitting the field entirely. *'''creator''', the creator of the martial art, ''if there is one''. *'''formation''', the date the martial art was formed, ''if there is one''. *'''parenthood''', the martial arts that inspired this one. *'''famous_pract''', famous practitioners of the martial art (should link own article or details in article) *'''ancestor arts''', The martial arts that inspired this one. *'''descendant arts''', The martial arts that were inspired this one. *'''related arts''', The martial arts that share the same ancestor as this one. *'''olympic''', if the martial art is an Olympic sport or not. Should be ''no'' if it is not, or ''Since year'' if it is, where ''year'' is the first year that the martial art appeared in the Olympic Games. *'''website''', the official website of the martial art if there is a single organisation, if multiple organisations leave out. == See also == *{{tl|infobox koryu}} *{{tl|infobox martial artist}} *{{tl|infobox martial art form}} *{{tl|infobox martial art school}} *{{tl|infobox Chinese}} == Tracking category == *{{clc|Pages using infobox martial art with unknown parameters}} <includeonly>{{Sandbox other|| <!-- PLEASE ADD CATEGORIES BELOW THIS LINE, THANKS. --> [[Category:Martial arts infobox templates| ]] }}</includeonly> cws3yo1jzb20uaguk5t1n2iwg9ntvxy टेम्पलेट:Tlit 10 100971 796593 2024-04-09T04:17:15Z en>Remsense 0 [[WP:AES|←]]Redirected page to [[Template:Transliteration]] 796593 wikitext text/x-wiki #REDIRECT [[Template:Transliteration]] tswa83ic58m5vjli51u6vk9irhcyt5c 796594 796593 2024-09-12T08:46:52Z en>Remsense 0 Modifying [[WP:RCAT|redirect categories]] using [[User:Wugapodes/Capricorn|Capricorn ♑]] 796594 wikitext text/x-wiki #REDIRECT [[Template:Transliteration]] {{Redirect category shell| {{R from shortcut}} {{R for convenience}} }} fger3pu7tlxni3t0bfu47owvpm33gq8 796595 796594 2024-09-12T08:48:04Z en>Remsense 0 Modifying [[WP:RCAT|redirect categories]] using [[User:Wugapodes/Capricorn|Capricorn ♑]] 796595 wikitext text/x-wiki #REDIRECT [[Template:Transliteration]] {{Redirect category shell| {{R from template shortcut}} }} kdbrfdczvbubbddegdah8qzjzutar8z 796596 796595 2024-09-12T08:48:31Z en>Remsense 0 Modifying [[WP:RCAT|redirect categories]] using [[User:Wugapodes/Capricorn|Capricorn ♑]] 796596 wikitext text/x-wiki #REDIRECT [[Template:Transliteration]] {{Redirect category shell| {{R from template shortcut}} {{R from letter–word combination}} }} rfjqr7bf8m5gp3h5bflhxh1auiwylcb 796597 796596 2024-11-30T18:00:33Z en>MusikBot II 0 Protected "[[Template:Tlit]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 251 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite)) 796596 wikitext text/x-wiki #REDIRECT [[Template:Transliteration]] {{Redirect category shell| {{R from template shortcut}} {{R from letter–word combination}} }} rfjqr7bf8m5gp3h5bflhxh1auiwylcb 796598 796597 2026-03-06T18:00:24Z en>MusikBot II 0 Changed protection settings for "[[Template:Tlit]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 2705 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite)) 796596 wikitext text/x-wiki #REDIRECT [[Template:Transliteration]] {{Redirect category shell| {{R from template shortcut}} {{R from letter–word combination}} }} rfjqr7bf8m5gp3h5bflhxh1auiwylcb 796599 796598 2026-06-05T22:51:07Z SM7 3953 6 revisions imported from [[:en:Template:Tlit]] 796596 wikitext text/x-wiki #REDIRECT [[Template:Transliteration]] {{Redirect category shell| {{R from template shortcut}} {{R from letter–word combination}} }} rfjqr7bf8m5gp3h5bflhxh1auiwylcb ताई ची 0 100972 796601 2026-06-05T22:53:03Z SM7 3953 पन्ना [[ताइ ची]] पर अनुप्रेषित कइल गइल 796601 wikitext text/x-wiki #REDIRECT [[ताइ ची]] a7yjloy8auunrasd4k58i4sjt1hfgqn 796602 796601 2026-06-05T22:53:20Z SM7 3953 Added {{[[:Template:R from alternative spelling|R from alternative spelling]]}} tag to redirect 796602 wikitext text/x-wiki #REDIRECT [[ताइ ची]] {{Redirect category shell| {{R from alternative spelling}} }} prj5p14ujetpi0kztt4hmuud1w4tkr5 रामनगर किला 0 100973 796603 2026-06-05T23:04:16Z SM7 3953 नया आधार लेख 796603 wikitext text/x-wiki '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> दसहरा से पहिले होखे वाली रामलीला एह किला के मुख्य आकर्षण हवे। {{clear}} == संदर्भ == {{Reflist|29em}} [[श्रेणी:बनारस]] tf5j8l7kst5b5mfclfhmyxpblgqtc23 796604 796603 2026-06-05T23:05:06Z SM7 3953 [[User:SM7/stubsorter|Stubsorter]] के मदद से {{Building-stub}} जोड़ल गइल। 796604 wikitext text/x-wiki '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> दसहरा से पहिले होखे वाली रामलीला एह किला के मुख्य आकर्षण हवे। {{clear}} == संदर्भ == {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] {{Building-stub}} mluweag7jmqkdzc260vj89oymgn1ag3 796605 796604 2026-06-05T23:12:28Z SM7 3953 ज्ञानसंदूक जोड़ल गइल, बिस्तार कइल गइल, संदर्भ जोड़ल/सुधारल गइल 796605 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> {{clear}} == संदर्भ == {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] {{Building-stub}} tg459niv2w71wf0gwrxwscdnudw3jvk 796607 796605 2026-06-06T00:25:33Z SM7 3953 बिस्तार कइल गइल 796607 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> == लोकेशन == बनारस में गंगा नदी दक्खिन से उत्तर मुँह बहे ली। ई किला नदी के पूरबी (दाहिना) तीरे पर एगो सुंदर जगह पर स्थित बा, जवन बनारस के घाटन के ठीक सामने बा। ई बनारस से लगभग {{Convert|14|km}} आ [[बनारस हिंदू यूनिवर्सिटी|बनारस हिंदू यूनिवर्सिटी (बीएचयू)]] से नवका [[रामनगर पुल]] के रास्ता से जाइल जाव त लगभग {{Convert|2|km}} दूर बा। पुल बन जाए के बाद बीएचयू से किला तक पहुँचे में मुश्किल से 10 मिनट लागेला। बनारस के [[दशाश्वमेध घाट]] से नाव द्वारा किला तक पहुँचे में लगभग एक घंटा के समय लागेला। किला के घाट पर घोड़ा के जुड़वाँ प्रतीक चिन्ह से सजल एगो रंग-बिरंग राज्यीय बजरा (बार्ज) बंधल देखल जा सकेला।<ref name=moor>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|title=Fort, Ramnagar [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=30 July 2022|archive-url=https://web.archive.org/web/20220730135523/http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|url-status=dead}}</ref> किला के भीतर एगो सुव्यवस्थित बगइचा भी बा, जवन महल तक जाए वाला रास्ता के हिस्सा हवे।<ref name=moor/><ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|title=Rambag (Ramnagar) [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 October 2022|archive-url=https://web.archive.org/web/20221005231804/https://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|url-status=dead}}</ref> {{clear}} == संदर्भ == {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] {{Building-stub}} 76ml2znsmu3aap1sczsdz3go486qywp 796612 796607 2026-06-06T00:41:07Z SM7 3953 अंग्रेजी विकिपीडिया से अनुबाद क के बिस्तार कइल गइल 796612 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> == लोकेशन == बनारस में गंगा नदी दक्खिन से उत्तर मुँह बहे ली। ई किला नदी के पूरबी (दाहिना) तीरे पर एगो सुंदर जगह पर स्थित बा, जवन बनारस के घाटन के ठीक सामने बा। ई बनारस से लगभग {{Convert|14|km}} आ [[बनारस हिंदू यूनिवर्सिटी|बनारस हिंदू यूनिवर्सिटी (बीएचयू)]] से नवका [[रामनगर पुल]] के रास्ता से जाइल जाव त लगभग {{Convert|2|km}} दूर बा। पुल बन जाए के बाद बीएचयू से किला तक पहुँचे में मुश्किल से 10 मिनट लागेला। बनारस के [[दशाश्वमेध घाट]] से नाव द्वारा किला तक पहुँचे में लगभग एक घंटा के समय लागेला। किला के घाट पर घोड़ा के जुड़वाँ प्रतीक चिन्ह से सजल एगो रंग-बिरंग राज्यीय बजरा (बार्ज) बंधल देखल जा सकेला।<ref name=moor>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|title=Fort, Ramnagar [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=30 July 2022|archive-url=https://web.archive.org/web/20220730135523/http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|url-status=dead}}</ref> किला के भीतर एगो सुव्यवस्थित बगइचा भी बा, जवन महल तक जाए वाला रास्ता के हिस्सा हवे।<ref name=moor/><ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|title=Rambag (Ramnagar) [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 October 2022|archive-url=https://web.archive.org/web/20221005231804/https://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|url-status=dead}}</ref> == इतिहास == रामनगर किला के निर्माण महाराजा बलवंत सिंह द्वारा 1750 में करावल गइल रहे। किला के बाहरी प्राचीर पर मिलल शिलालेखन के आधार पर एकर कुछ हिस्सा के इतिहास 17वीं सदी तक पहुँचेला। ==आर्किटेक्चर == ई इमारत हल्का पीयर रंग के चुनार बलुआ पत्थर से बनावल गइल बा। किला परिसर में वेद व्यास मंदिर, एगो म्यूजियम आ राजा के रिहायशी महल स्थित बा। एहिजा दक्षिण दिशा ओर मुँह कइले [[हनुमान]] जी के एगो दक्षिणमुखी मंदिरो बा। किला के ऊँच जगह पर बनावल गइल बा, जवन बाढ़ के समय के जलस्तर से ऊपर बा। एह ढाँचा में नक्काशीदार बालकनी, खुला आँगन आ मंडप मौजूद बाड़ें। किला के खाली कुछे हिस्सा ही आम लोग खातिर खुलल बा, जबकि बाकी हिस्सा [[काशी नरेश]] आ उनकर परिवार के निवास स्थान हवे। जब महाराजा अपना महल में मौजूद रहेलें, तब किला पर राजकीय ध्वज फहरावल जाला। किला के भीतर महल में दू गो सफेद मीनार बाड़ी स, जहाँ सीढ़ी के रास्ता से पहुँचल जाला। सीढ़ियन के आखिर में एगो मेहराबदार प्रवेश द्वार बा, जवना से कई गो आँगन होके सफेद मीनारन तक पहुँचल जाला। मीनार के एक ओर महाराजा के निजी निवास बा, जबकि दुसरे ओर दरबार हॉल आ स्वागत कक्ष स्थित बाड़ें। किला के दीवार पर मौजूद एगो शिलालेख में लिखल बा कि ई "बनारस के राजा के किलाबंद आवास, उनकर शाही नाव सहित" हवे। {{clear}} == संदर्भ == {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] {{Building-stub}} akx18a1e66ye6bzbjl1wi3te1dzh744 796613 796612 2026-06-06T00:44:12Z SM7 3953 अंग्रेजी विकिपीडिया से अनुबाद क के बिस्तार कइल गइल 796613 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> == लोकेशन == बनारस में गंगा नदी दक्खिन से उत्तर मुँह बहे ली। ई किला नदी के पूरबी (दाहिना) तीरे पर एगो सुंदर जगह पर स्थित बा, जवन बनारस के घाटन के ठीक सामने बा। ई बनारस से लगभग {{Convert|14|km}} आ [[बनारस हिंदू यूनिवर्सिटी|बनारस हिंदू यूनिवर्सिटी (बीएचयू)]] से नवका [[रामनगर पुल]] के रास्ता से जाइल जाव त लगभग {{Convert|2|km}} दूर बा। पुल बन जाए के बाद बीएचयू से किला तक पहुँचे में मुश्किल से 10 मिनट लागेला। बनारस के [[दशाश्वमेध घाट]] से नाव द्वारा किला तक पहुँचे में लगभग एक घंटा के समय लागेला। किला के घाट पर घोड़ा के जुड़वाँ प्रतीक चिन्ह से सजल एगो रंग-बिरंग राज्यीय बजरा (बार्ज) बंधल देखल जा सकेला।<ref name=moor>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|title=Fort, Ramnagar [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=30 July 2022|archive-url=https://web.archive.org/web/20220730135523/http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|url-status=dead}}</ref> किला के भीतर एगो सुव्यवस्थित बगइचा भी बा, जवन महल तक जाए वाला रास्ता के हिस्सा हवे।<ref name=moor/><ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|title=Rambag (Ramnagar) [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 October 2022|archive-url=https://web.archive.org/web/20221005231804/https://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|url-status=dead}}</ref> == इतिहास == रामनगर किला के निर्माण महाराजा बलवंत सिंह द्वारा 1750 में करावल गइल रहे। किला के बाहरी प्राचीर पर मिलल शिलालेखन के आधार पर एकर कुछ हिस्सा के इतिहास 17वीं सदी तक पहुँचेला। ==आर्किटेक्चर == ई इमारत हल्का पीयर रंग के चुनार बलुआ पत्थर से बनावल गइल बा। किला परिसर में वेद व्यास मंदिर, एगो म्यूजियम आ राजा के रिहायशी महल स्थित बा। एहिजा दक्षिण दिशा ओर मुँह कइले [[हनुमान]] जी के एगो दक्षिणमुखी मंदिरो बा। किला के ऊँच जगह पर बनावल गइल बा, जवन बाढ़ के समय के जलस्तर से ऊपर बा। एह ढाँचा में नक्काशीदार बालकनी, खुला आँगन आ मंडप मौजूद बाड़ें। किला के खाली कुछे हिस्सा ही आम लोग खातिर खुलल बा, जबकि बाकी हिस्सा [[काशी नरेश]] आ उनकर परिवार के निवास स्थान हवे। जब महाराजा अपना महल में मौजूद रहेलें, तब किला पर राजकीय ध्वज फहरावल जाला। किला के भीतर महल में दू गो सफेद मीनार बाड़ी स, जहाँ सीढ़ी के रास्ता से पहुँचल जाला। सीढ़ियन के आखिर में एगो मेहराबदार प्रवेश द्वार बा, जवना से कई गो आँगन होके सफेद मीनारन तक पहुँचल जाला। मीनार के एक ओर महाराजा के निजी निवास बा, जबकि दुसरे ओर दरबार हॉल आ स्वागत कक्ष स्थित बाड़ें। किला के दीवार पर मौजूद एगो शिलालेख में लिखल बा कि ई "बनारस के राजा के किलाबंद आवास, उनकर शाही नाव सहित" हवे। == म्यूजियम == किला के म्यूजियम सरस्वती भवन के नाम से जानल जाला। ई म्यूजियम ओह भवन में स्थित बा, जवन पहिले किला के दरबार हॉल भा सार्वजनिक सभा कक्ष के रूप में इस्तेमाल होखत रहे। ई अपना अनोखा आ दुर्लभ संग्रह खातिर प्रसिद्ध बा। एहिजा अमेरिकी पुरान मोटरगाड़ी (विंटेज कार), रत्न-जड़ित पालकीनुमा कुर्सी (सेडान चेयर), हाथीदाँत के कलाकृति, मध्यकालीन पोशाक आ सोना-चाँदी के जरीदार राजसी पालकी सभ सुरक्षित रखल गइल बाड़ी स। संग्रहालय में चाँदी से बनल हाथी के हौदा, गहना, किमख्वाब रेशम से बनल पोशाक, आ हथियारन के एगो प्रभावशाली कमरा भी बा, जहाँ तलवार; अफ्रीका, बर्मा आ जापान से आइल पुरान बंदूक सभ रखल गइल बाड़ी स। एहिजा पुरान माचलॉक बंदूक, सजावटी हुक्का, कटार, महाराजन के चित्र आ कई गो संगीत वाद्य भी मौजूद बाड़ें। कुछ काला रंग के वाद्य यंत्र रखरखाव के कमी के कारण समय के साथ सफेद पड़ गइल बाड़ें। संग्रहालय के सबसे दुर्लभ वस्तुन में एगो खगोलीय घड़ी भी शामिल बा। ई घड़ी खाली समये ना बतावेला, बल्कि साल, महीना, हफ्ता आ दिन के साथे-साथे सूर्य, चंद्रमा आ दोसर ग्रह सभ से जुड़ल खगोलीय जानकारी भी देखावेला। एह घड़ी के निर्माण 1852 में बनारस राजमहल के दरबारी खगोलशास्त्री द्वारा कइल गइल रहे। एह संग्रहालय में कई गो पांडुलिपि, खासकर धार्मिक ग्रंथ, सुरक्षित रखल गइल बाड़ी स। एकरे अलावा मुगल मिनियेचर शैली से सजल कई गो पुस्तक भी एह संग्रह के हिस्सा बाड़ी स। संग्रहालय में इस्लामी सांस्कृतिक परंपरा के दर्शावे वाली 535 चित्रांकन भी मौजूद बाड़ी स, जिनका चारों ओर फूल-पत्ती के सुंदर सजावटी किनारा आ अलंकरण बनावल गइल बा। {{clear}} == संदर्भ == {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] {{Building-stub}} h5qbrx1m3btj6fi10ii1ikqleiwmxp4 796614 796613 2026-06-06T01:06:34Z SM7 3953 अंग्रेजी विकिपीडिया से अनुबाद क के बिस्तार कइल गइल 796614 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> == लोकेशन == बनारस में गंगा नदी दक्खिन से उत्तर मुँह बहे ली। ई किला नदी के पूरबी (दाहिना) तीरे पर एगो सुंदर जगह पर स्थित बा, जवन बनारस के घाटन के ठीक सामने बा। ई बनारस से लगभग {{Convert|14|km}} आ [[बनारस हिंदू यूनिवर्सिटी|बनारस हिंदू यूनिवर्सिटी (बीएचयू)]] से नवका [[रामनगर पुल]] के रास्ता से जाइल जाव त लगभग {{Convert|2|km}} दूर बा। पुल बन जाए के बाद बीएचयू से किला तक पहुँचे में मुश्किल से 10 मिनट लागेला। बनारस के [[दशाश्वमेध घाट]] से नाव द्वारा किला तक पहुँचे में लगभग एक घंटा के समय लागेला। किला के घाट पर घोड़ा के जुड़वाँ प्रतीक चिन्ह से सजल एगो रंग-बिरंग राज्यीय बजरा (बार्ज) बंधल देखल जा सकेला।<ref name=moor>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|title=Fort, Ramnagar [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=30 July 2022|archive-url=https://web.archive.org/web/20220730135523/http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|url-status=dead}}</ref> किला के भीतर एगो सुव्यवस्थित बगइचा भी बा, जवन महल तक जाए वाला रास्ता के हिस्सा हवे।<ref name=moor/><ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|title=Rambag (Ramnagar) [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 October 2022|archive-url=https://web.archive.org/web/20221005231804/https://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|url-status=dead}}</ref> == इतिहास == रामनगर किला के निर्माण महाराजा बलवंत सिंह द्वारा 1750 में करावल गइल रहे। किला के बाहरी प्राचीर पर मिलल शिलालेखन के आधार पर एकर कुछ हिस्सा के इतिहास 17वीं सदी तक पहुँचेला। ==आर्किटेक्चर == ई इमारत हल्का पीयर रंग के चुनार बलुआ पत्थर से बनावल गइल बा। किला परिसर में वेद व्यास मंदिर, एगो म्यूजियम आ राजा के रिहायशी महल स्थित बा। एहिजा दक्षिण दिशा ओर मुँह कइले [[हनुमान]] जी के एगो दक्षिणमुखी मंदिरो बा। किला के ऊँच जगह पर बनावल गइल बा, जवन बाढ़ के समय के जलस्तर से ऊपर बा। एह ढाँचा में नक्काशीदार बालकनी, खुला आँगन आ मंडप मौजूद बाड़ें। किला के खाली कुछे हिस्सा ही आम लोग खातिर खुलल बा, जबकि बाकी हिस्सा [[काशी नरेश]] आ उनकर परिवार के निवास स्थान हवे। जब महाराजा अपना महल में मौजूद रहेलें, तब किला पर राजकीय ध्वज फहरावल जाला। किला के भीतर महल में दू गो सफेद मीनार बाड़ी स, जहाँ सीढ़ी के रास्ता से पहुँचल जाला। सीढ़ियन के आखिर में एगो मेहराबदार प्रवेश द्वार बा, जवना से कई गो आँगन होके सफेद मीनारन तक पहुँचल जाला। मीनार के एक ओर महाराजा के निजी निवास बा, जबकि दुसरे ओर दरबार हॉल आ स्वागत कक्ष स्थित बाड़ें। किला के दीवार पर मौजूद एगो शिलालेख में लिखल बा कि ई "बनारस के राजा के किलाबंद आवास, उनकर शाही नाव सहित" हवे। == म्यूजियम == किला के म्यूजियम सरस्वती भवन के नाम से जानल जाला। ई म्यूजियम ओह भवन में स्थित बा, जवन पहिले किला के दरबार हॉल भा सार्वजनिक सभा कक्ष के रूप में इस्तेमाल होखत रहे। ई अपना अनोखा आ दुर्लभ संग्रह खातिर प्रसिद्ध बा। एहिजा अमेरिकी पुरान मोटरगाड़ी (विंटेज कार), रत्न-जड़ित पालकीनुमा कुर्सी (सेडान चेयर), हाथीदाँत के कलाकृति, मध्यकालीन पोशाक आ सोना-चाँदी के जरीदार राजसी पालकी सभ सुरक्षित रखल गइल बाड़ी स। संग्रहालय में चाँदी से बनल हाथी के हौदा, गहना, किमख्वाब रेशम से बनल पोशाक, आ हथियारन के एगो प्रभावशाली कमरा भी बा, जहाँ तलवार; अफ्रीका, बर्मा आ जापान से आइल पुरान बंदूक सभ रखल गइल बाड़ी स। एहिजा पुरान माचलॉक बंदूक, सजावटी हुक्का, कटार, महाराजन के चित्र आ कई गो संगीत वाद्य भी मौजूद बाड़ें। कुछ काला रंग के वाद्य यंत्र रखरखाव के कमी के कारण समय के साथ सफेद पड़ गइल बाड़ें। संग्रहालय के सबसे दुर्लभ वस्तुन में एगो खगोलीय घड़ी भी शामिल बा। ई घड़ी खाली समये ना बतावेला, बल्कि साल, महीना, हफ्ता आ दिन के साथे-साथे सूर्य, चंद्रमा आ दोसर ग्रह सभ से जुड़ल खगोलीय जानकारी भी देखावेला। एह घड़ी के निर्माण 1852 में बनारस राजमहल के दरबारी खगोलशास्त्री द्वारा कइल गइल रहे। एह संग्रहालय में कई गो पांडुलिपि, खासकर धार्मिक ग्रंथ, सुरक्षित रखल गइल बाड़ी स। एकरे अलावा मुगल मिनियेचर शैली से सजल कई गो पुस्तक भी एह संग्रह के हिस्सा बाड़ी स। संग्रहालय में इस्लामी सांस्कृतिक परंपरा के दर्शावे वाली 535 चित्रांकन भी मौजूद बाड़ी स, जिनका चारों ओर फूल-पत्ती के सुंदर सजावटी किनारा आ अलंकरण बनावल गइल बा। == उत्सव तिहुआर == एक महीना तक चले वाली रामलीला के दौरान रामनगर किला आ महल के खास तौर पर सजावल जाला, जवना से ई बहुत रंग-बिरंग आ आकर्षक दिखाई देला। एह अवसर पर [[रामायण]] के अलग-अलग प्रसंगन के मंचन कइल जाला। [[ग्रेगोरियन कैलेंडर|अंग्रेजी कलेंडर]] के अनुसार अक्टूबर महीना में मनावल जाए वाला [[बिजयदसिमी|दशहरा उत्सव]] के हिस्सा के रूप में रामायण पर आधारित एगो भव्य झाँकी आ जलूस निकालल जाला। एह दौरान राक्षस राजा रावण, उनकर भाई-बंधु आ सहयोगियन के पुतला दहन कइल जाला, जवन बुराई पर अच्छाई के विजय के प्रतीक मानल जाला। उत्सव में राजपरिवार के पुरान आ बहुमूल्य वस्तुन के प्रदर्शनी आ झाँकी शामिल रहेला। काशी नरेश आजुओ अपना पारिवारिक परंपरा के निभावत बाड़ें। ऊ किला के पीछे के सड़कन पर आयोजित होखे वाला सालाना रामलीला महोत्सव में सजावल गइल हाथी पर सवार होके जुलूस के अगुवाई करेलन। पुरान समय में एह नाटक के मंचन स्थानीय सैनिक टुकड़ी द्वारा कइल जात रहे आ पूरा महीना तक चले वाला एह उत्सव में रामायण के कथा के पाठ भी कइल जात रहे। किला में दूसर धार्मिक आ सांस्कृतिक उत्सवो आयोजित होलें। [[माघ]] (जनवरी–फरवरी) महीना में वेद व्यास मंदिर के सामने मेला लागेला, जहाँ भारी संख्या में श्रद्धालु रामनगर आवेलन। [[फागुन]] (फरवरी–मार्च) महीना में राज मंगल नाम के उत्सव मनावल जाला। एह अवसर पर लोगन से भरल नावन के जलूस निकले ला, एह में गीत-संगीत आ नृत्य के कार्यक्रम होखेला। ई नाव यात्रा [[अस्सी घाट]] से शुरू होके गंगा नदी के रास्ता रामनगर किला के सोझा से गुजरे ला। {{clear}} == संदर्भ == {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] {{Building-stub}} k2s5heowrpg5ntgq4yxwlisc3bk61ie 796615 796614 2026-06-06T01:10:26Z SM7 3953 अंग्रेजी विकिपीडिया से अनुबाद क के बिस्तार कइल गइल 796615 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> == लोकेशन == बनारस में गंगा नदी दक्खिन से उत्तर मुँह बहे ली। ई किला नदी के पूरबी (दाहिना) तीरे पर एगो सुंदर जगह पर स्थित बा, जवन बनारस के घाटन के ठीक सामने बा। ई बनारस से लगभग {{Convert|14|km}} आ [[बनारस हिंदू यूनिवर्सिटी|बनारस हिंदू यूनिवर्सिटी (बीएचयू)]] से नवका [[रामनगर पुल]] के रास्ता से जाइल जाव त लगभग {{Convert|2|km}} दूर बा। पुल बन जाए के बाद बीएचयू से किला तक पहुँचे में मुश्किल से 10 मिनट लागेला। बनारस के [[दशाश्वमेध घाट]] से नाव द्वारा किला तक पहुँचे में लगभग एक घंटा के समय लागेला। किला के घाट पर घोड़ा के जुड़वाँ प्रतीक चिन्ह से सजल एगो रंग-बिरंग राज्यीय बजरा (बार्ज) बंधल देखल जा सकेला।<ref name=moor>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|title=Fort, Ramnagar [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=30 July 2022|archive-url=https://web.archive.org/web/20220730135523/http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|url-status=dead}}</ref> किला के भीतर एगो सुव्यवस्थित बगइचा भी बा, जवन महल तक जाए वाला रास्ता के हिस्सा हवे।<ref name=moor/><ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|title=Rambag (Ramnagar) [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 October 2022|archive-url=https://web.archive.org/web/20221005231804/https://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|url-status=dead}}</ref> == इतिहास == रामनगर किला के निर्माण महाराजा बलवंत सिंह द्वारा 1750 में करावल गइल रहे। किला के बाहरी प्राचीर पर मिलल शिलालेखन के आधार पर एकर कुछ हिस्सा के इतिहास 17वीं सदी तक पहुँचेला। ==आर्किटेक्चर == ई इमारत हल्का पीयर रंग के चुनार बलुआ पत्थर से बनावल गइल बा। किला परिसर में वेद व्यास मंदिर, एगो म्यूजियम आ राजा के रिहायशी महल स्थित बा। एहिजा दक्षिण दिशा ओर मुँह कइले [[हनुमान]] जी के एगो दक्षिणमुखी मंदिरो बा। किला के ऊँच जगह पर बनावल गइल बा, जवन बाढ़ के समय के जलस्तर से ऊपर बा। एह ढाँचा में नक्काशीदार बालकनी, खुला आँगन आ मंडप मौजूद बाड़ें। किला के खाली कुछे हिस्सा ही आम लोग खातिर खुलल बा, जबकि बाकी हिस्सा [[काशी नरेश]] आ उनकर परिवार के निवास स्थान हवे। जब महाराजा अपना महल में मौजूद रहेलें, तब किला पर राजकीय ध्वज फहरावल जाला। किला के भीतर महल में दू गो सफेद मीनार बाड़ी स, जहाँ सीढ़ी के रास्ता से पहुँचल जाला। सीढ़ियन के आखिर में एगो मेहराबदार प्रवेश द्वार बा, जवना से कई गो आँगन होके सफेद मीनारन तक पहुँचल जाला। मीनार के एक ओर महाराजा के निजी निवास बा, जबकि दुसरे ओर दरबार हॉल आ स्वागत कक्ष स्थित बाड़ें। किला के दीवार पर मौजूद एगो शिलालेख में लिखल बा कि ई "बनारस के राजा के किलाबंद आवास, उनकर शाही नाव सहित" हवे। == म्यूजियम == किला के म्यूजियम सरस्वती भवन के नाम से जानल जाला। ई म्यूजियम ओह भवन में स्थित बा, जवन पहिले किला के दरबार हॉल भा सार्वजनिक सभा कक्ष के रूप में इस्तेमाल होखत रहे। ई अपना अनोखा आ दुर्लभ संग्रह खातिर प्रसिद्ध बा। एहिजा अमेरिकी पुरान मोटरगाड़ी (विंटेज कार), रत्न-जड़ित पालकीनुमा कुर्सी (सेडान चेयर), हाथीदाँत के कलाकृति, मध्यकालीन पोशाक आ सोना-चाँदी के जरीदार राजसी पालकी सभ सुरक्षित रखल गइल बाड़ी स। संग्रहालय में चाँदी से बनल हाथी के हौदा, गहना, किमख्वाब रेशम से बनल पोशाक, आ हथियारन के एगो प्रभावशाली कमरा भी बा, जहाँ तलवार; अफ्रीका, बर्मा आ जापान से आइल पुरान बंदूक सभ रखल गइल बाड़ी स। एहिजा पुरान माचलॉक बंदूक, सजावटी हुक्का, कटार, महाराजन के चित्र आ कई गो संगीत वाद्य भी मौजूद बाड़ें। कुछ काला रंग के वाद्य यंत्र रखरखाव के कमी के कारण समय के साथ सफेद पड़ गइल बाड़ें। संग्रहालय के सबसे दुर्लभ वस्तुन में एगो खगोलीय घड़ी भी शामिल बा। ई घड़ी खाली समये ना बतावेला, बल्कि साल, महीना, हफ्ता आ दिन के साथे-साथे सूर्य, चंद्रमा आ दोसर ग्रह सभ से जुड़ल खगोलीय जानकारी भी देखावेला। एह घड़ी के निर्माण 1852 में बनारस राजमहल के दरबारी खगोलशास्त्री द्वारा कइल गइल रहे। एह संग्रहालय में कई गो पांडुलिपि, खासकर धार्मिक ग्रंथ, सुरक्षित रखल गइल बाड़ी स। एकरे अलावा मुगल मिनियेचर शैली से सजल कई गो पुस्तक भी एह संग्रह के हिस्सा बाड़ी स। संग्रहालय में इस्लामी सांस्कृतिक परंपरा के दर्शावे वाली 535 चित्रांकन भी मौजूद बाड़ी स, जिनका चारों ओर फूल-पत्ती के सुंदर सजावटी किनारा आ अलंकरण बनावल गइल बा। == उत्सव तिहुआर == एक महीना तक चले वाली रामलीला के दौरान रामनगर किला आ महल के खास तौर पर सजावल जाला, जवना से ई बहुत रंग-बिरंग आ आकर्षक दिखाई देला। एह अवसर पर [[रामायण]] के अलग-अलग प्रसंगन के मंचन कइल जाला। [[ग्रेगोरियन कैलेंडर|अंग्रेजी कलेंडर]] के अनुसार अक्टूबर महीना में मनावल जाए वाला [[बिजयदसिमी|दशहरा उत्सव]] के हिस्सा के रूप में रामायण पर आधारित एगो भव्य झाँकी आ जलूस निकालल जाला। एह दौरान राक्षस राजा रावण, उनकर भाई-बंधु आ सहयोगियन के पुतला दहन कइल जाला, जवन बुराई पर अच्छाई के विजय के प्रतीक मानल जाला। उत्सव में राजपरिवार के पुरान आ बहुमूल्य वस्तुन के प्रदर्शनी आ झाँकी शामिल रहेला। काशी नरेश आजुओ अपना पारिवारिक परंपरा के निभावत बाड़ें। ऊ किला के पीछे के सड़कन पर आयोजित होखे वाला सालाना रामलीला महोत्सव में सजावल गइल हाथी पर सवार होके जुलूस के अगुवाई करेलन। पुरान समय में एह नाटक के मंचन स्थानीय सैनिक टुकड़ी द्वारा कइल जात रहे आ पूरा महीना तक चले वाला एह उत्सव में रामायण के कथा के पाठ भी कइल जात रहे। किला में दूसर धार्मिक आ सांस्कृतिक उत्सवो आयोजित होलें। [[माघ]] (जनवरी–फरवरी) महीना में वेद व्यास मंदिर के सामने मेला लागेला, जहाँ भारी संख्या में श्रद्धालु रामनगर आवेलन। [[फागुन]] (फरवरी–मार्च) महीना में राज मंगल नाम के उत्सव मनावल जाला। एह अवसर पर लोगन से भरल नावन के जलूस निकले ला, एह में गीत-संगीत आ नृत्य के कार्यक्रम होखेला। ई नाव यात्रा [[अस्सी घाट]] से शुरू होके गंगा नदी के रास्ता रामनगर किला के सोझा से गुजरे ला। == पॉपुलर संस्कृति में == गंगा नदी के किनारा पर स्थित सुंदर स्थान के कारण रामनगर किला आ महल के फिल्मन के बाहरी शूटिंग लोकेशन के रूप में अक्सर इस्तेमाल कइल गइल बा। ''[[बनारस]]'' एहिजा शूट कइल गइल लोकप्रिय फिल्मन में से एगो हवे। एह जगह के इस्तेमाल रियलिटी टेलीविजन कार्यक्रम ''द अमेजिंग रेस 18'' के सातवाँ पड़ाव (पिट स्टॉप) के रूप में भी कइल गइल रहे। {{clear}} == संदर्भ == {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] {{Building-stub}} mqpw7ggmaebw54hpl05c4rkbtsx45h6 796616 796615 2026-06-06T01:26:28Z SM7 3953 संदर्भ जोड़ल/सुधारल गइल 796616 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> == लोकेशन == बनारस में गंगा नदी दक्खिन से उत्तर मुँह बहे ली। ई किला नदी के पूरबी (दाहिना) तीरे पर एगो सुंदर जगह पर स्थित बा, जवन बनारस के घाटन के ठीक सामने बा। ई बनारस से लगभग {{Convert|14|km}} आ [[बनारस हिंदू यूनिवर्सिटी|बनारस हिंदू यूनिवर्सिटी (बीएचयू)]] से नवका [[रामनगर पुल]] के रास्ता से जाइल जाव त लगभग {{Convert|2|km}} दूर बा। पुल बन जाए के बाद बीएचयू से किला तक पहुँचे में मुश्किल से 10 मिनट लागेला। बनारस के [[दशाश्वमेध घाट]] से नाव द्वारा किला तक पहुँचे में लगभग एक घंटा के समय लागेला। किला के घाट पर घोड़ा के जुड़वाँ प्रतीक चिन्ह से सजल एगो रंग-बिरंग राज्यीय बजरा (बार्ज) बंधल देखल जा सकेला।<ref name=moor>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|title=Fort, Ramnagar [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=30 July 2022|archive-url=https://web.archive.org/web/20220730135523/http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|url-status=dead}}</ref> किला के भीतर एगो सुव्यवस्थित बगइचा भी बा, जवन महल तक जाए वाला रास्ता के हिस्सा हवे।<ref name=moor/><ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|title=Rambag (Ramnagar) [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 October 2022|archive-url=https://web.archive.org/web/20221005231804/https://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|url-status=dead}}</ref> == इतिहास == रामनगर किला के निर्माण महाराजा बलवंत सिंह द्वारा 1750 में करावल गइल रहे। किला के बाहरी प्राचीर पर मिलल शिलालेखन के आधार पर एकर कुछ हिस्सा के इतिहास 17वीं सदी तक पहुँचेला।<ref name=moor/> ==आर्किटेक्चर == {{multiple image | align = left | image1 = The Maharaja's Fort, Front view -Benares-.jpg | width1 = 175 | alt1 = | caption1 = | image2 = Laldaruaza (Ramnagar) -Benares-..jpg | width2 = 175 | alt2 = | caption2 = | footer = बायें: महाराजा के किला के साम्हने से व्यू 1869. दाहिनी ओर: मेन दरवाजा, 1905. }} ई इमारत हल्का पीयर रंग के चुनार बलुआ पत्थर से बनावल गइल बा। किला परिसर में वेद व्यास मंदिर, एगो म्यूजियम आ राजा के रिहायशी महल स्थित बा।<ref name=Fort>{{Cite web|url=http://easternuptourism.com/Ramnagar-Fort.jsp|title=Ramnagar Fort & Museum|access-date=7 November 2012|publisher=Official Website of Eastern UP Tourism|url-status=dead|archive-url=https://web.archive.org/web/20131130011021/http://www.easternuptourism.com/Ramnagar-Fort.jsp|archive-date=30 November 2013|df=dmy-all}}</ref> एहिजा दक्षिण दिशा ओर मुँह कइले [[हनुमान]] जी के एगो दक्षिणमुखी मंदिरो बा।<ref name=NIC>{{Cite web|url=http://varanasi.nic.in/history/ramnagar.html|title=Ramnagar|access-date=7 November 2012|publisher=National Informatics Centre}}</ref> किला के ऊँच जगह पर बनावल गइल बा, जवन बाढ़ के समय के जलस्तर से ऊपर बा।<ref name= "Fodor's 2004">{{cite book|title= Fodor's India, 5th Edition|url=https://books.google.com/books?id=eM-wM2K5mgYC&pg=PA168|publisher= Random House Digital, Inc |year=2004|page=168| isbn=978-1-4000-1312-8 }}</ref> एह ढाँचा में नक्काशीदार बालकनी, खुला आँगन आ मंडप मौजूद बाड़ें। किला के खाली कुछे हिस्सा ही आम लोग खातिर खुलल बा, जबकि बाकी हिस्सा [[काशी नरेश]] आ उनकर परिवार के निवास स्थान हवे। जब महाराजा अपना महल में मौजूद रहेलें, तब किला पर राजकीय ध्वज फहरावल जाला। किला के भीतर महल में दू गो सफेद मीनार बाड़ी स, जहाँ सीढ़ी के रास्ता से पहुँचल जाला। सीढ़ियन के आखिर में एगो मेहराबदार प्रवेश द्वार बा, जवना से कई गो आँगन होके सफेद मीनारन तक पहुँचल जाला।<ref name=moor/> मीनार के एक ओर महाराजा के निजी निवास बा, जबकि दुसरे ओर दरबार हॉल आ स्वागत कक्ष स्थित बाड़ें। किला के दीवार पर मौजूद एगो शिलालेख में लिखल बा कि ई "बनारस के राजा के किलाबंद आवास, उनकर शाही नाव सहित" हवे।<ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/addorimss/t/019addor0004728u00000000.html|title=The Raja of Benares's palace at Ramnagar from the river, with the Raja's state boat|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=28 November 2022|archive-url=https://web.archive.org/web/20221128113823/https://www.bl.uk/onlinegallery/onlineex/apac/addorimss/t/019addor0004728u00000000.html|url-status=dead}}</ref> == म्यूजियम == [[File:Ramnagar fort.JPG|thumb|किला के भीतर मौजूद [[म्यूजियम]]]] किला के [[म्यूजियम]] सरस्वती भवन के नाम से जानल जाला। ई म्यूजियम ओह भवन में स्थित बा, जवन पहिले किला के दरबार हॉल भा सार्वजनिक सभा कक्ष के रूप में इस्तेमाल होखत रहे। ई अपना अनोखा आ दुर्लभ संग्रह खातिर प्रसिद्ध बा। एहिजा अमेरिकी पुरान मोटरगाड़ी ([[विंटेज कार]]), रत्न-जड़ित पालकीनुमा कुर्सी (सेडान चेयर), हाथीदाँत के कलाकृति, मध्यकालीन पोशाक आ सोना-चाँदी के जरीदार राजसी पालकी सभ सुरक्षित रखल गइल बाड़ी स। संग्रहालय में चाँदी से बनल हाथी के हौदा, गहना, किमख्वाब रेशम से बनल पोशाक, आ हथियारन के एगो प्रभावशाली कमरा भी बा, जहाँ तलवार; अफ्रीका, बर्मा आ जापान से आइल पुरान बंदूक सभ रखल गइल बाड़ी स।<ref>{{cite book|title=The Top Ten Temple Towns of India|publisher=Mark Age Publication|first=S.C.|last=Karkar|location=Kolkota|isbn=978-81-87952-12-1|year=2009|page=13}}</ref> एहिजा पुरान माचलॉक बंदूक, सजावटी हुक्का, कटार, महाराजन के चित्र आ कई गो संगीत वाद्य भी मौजूद बाड़ें। कुछ काला रंग के वाद्य यंत्र रखरखाव के कमी के कारण समय के साथ सफेद पड़ गइल बाड़ें। संग्रहालय के सबसे दुर्लभ वस्तुन में एगो खगोलीय घड़ी भी शामिल बा।<ref name= Ram/> ई घड़ी खाली समये ना बतावेला, बल्कि साल, महीना, हफ्ता आ दिन के साथे-साथे सूर्य, चंद्रमा आ दोसर ग्रह सभ से जुड़ल खगोलीय जानकारी भी देखावेला। एह घड़ी के निर्माण 1852 में बनारस राजमहल के दरबारी खगोलशास्त्री द्वारा कइल गइल रहे। एह संग्रहालय में कई गो पांडुलिपि, खासकर धार्मिक ग्रंथ, सुरक्षित रखल गइल बाड़ी स। एकरे अलावा मुगल मिनियेचर शैली से सजल कई गो पुस्तक भी एह संग्रह के हिस्सा बाड़ी स।<ref name="Mitra 2002"/><ref name= Ram/><ref name= "Fodor's 2004"/> संग्रहालय में इस्लामी सांस्कृतिक परंपरा के दर्शावे वाली 535 चित्रांकन भी मौजूद बाड़ी स, जिनका चारों ओर फूल-पत्ती के सुंदर सजावटी किनारा आ अलंकरण बनावल गइल बा।<ref name= "Bäumer 2006">{{cite book|title= Sāmarasya: studies in Indian art, philosophy, and interreligious dialogue : in honour of Bettina Bäumer |url=https://books.google.com/books?id=MZ3WAAAAMAAJ|publisher= D.K. Printworld|access-date=7 November 2012|year=2006|isbn=9788124603383|page=193}}</ref><ref name="Limited2003">{{cite book|last= Limited |first= Eicher Goodearth |title= Good Earth Varanasi City Guide |url=https://books.google.com/books?id=NviJaunGDJMC|publisher= Eicher Goodearth Limited |year=2003|isbn= 9788187780045 |pages=124–127}}</ref> == उत्सव तिहुआर == {{see also|रामनगर के रामलीला}} [[File:Ram Leela Mela As Performed before at Ram Nugur before the Raja of Benares by James Prinsep 1834.jpg|right|thumb|राजा बनारस के सोझा रामलीला के मंचन, 1834 (जेम्स प्रिंसेप)]] एक महीना तक चले वाली रामलीला के दौरान रामनगर किला आ महल के खास तौर पर सजावल जाला, जवना से ई बहुत रंग-बिरंग आ आकर्षक दिखाई देला। एह अवसर पर [[रामायण]] के अलग-अलग प्रसंगन के मंचन कइल जाला। [[ग्रेगोरियन कैलेंडर|अंग्रेजी कलेंडर]] के अनुसार अक्टूबर महीना में मनावल जाए वाला [[बिजयदसिमी|दशहरा उत्सव]] के हिस्सा के रूप में रामायण पर आधारित एगो भव्य झाँकी आ जलूस निकालल जाला। एह दौरान राक्षस राजा रावण, उनकर भाई-बंधु आ सहयोगियन के पुतला दहन कइल जाला, जवन बुराई पर अच्छाई के विजय के प्रतीक मानल जाला। उत्सव में राजपरिवार के पुरान आ बहुमूल्य वस्तुन के प्रदर्शनी आ झाँकी शामिल रहेला।<ref name=Fort/> काशी नरेश आजुओ अपना पारिवारिक परंपरा के निभावत बाड़ें। ऊ किला के पीछे के सड़कन पर आयोजित होखे वाला सालाना रामलीला महोत्सव में सजावल गइल हाथी पर सवार होके जुलूस के अगुवाई करेलन।<ref name="Limited2003"/> पुरान समय में एह नाटक के मंचन स्थानीय सैनिक टुकड़ी द्वारा कइल जात रहे आ पूरा महीना तक चले वाला एह उत्सव में रामायण के कथा के पाठ भी कइल जाव।<ref name= "Heitzman2004">{{cite book|last= Heitzman |first= James |title= The City in South Asia|url=https://books.google.com/books?id=c2p0kqUqfQ4C&pg=PA54|publisher= Psychology Press |year=2008|isbn=9780415343558|page=54}}</ref><ref name= Dance/> किला में दूसर धार्मिक आ सांस्कृतिक उत्सवो आयोजित होलें। [[माघ]] (जनवरी–फरवरी) महीना में वेद व्यास मंदिर के सामने मेला लागेला, जहाँ भारी संख्या में श्रद्धालु रामनगर आवेलन। [[फागुन]] (फरवरी–मार्च) महीना में राज मंगल नाम के उत्सव मनावल जाला। एह अवसर पर लोगन से भरल नावन के जलूस निकले ला, एह में गीत-संगीत आ नृत्य के कार्यक्रम होखेला। ई नाव यात्रा [[अस्सी घाट]] से शुरू होके गंगा नदी के रास्ता रामनगर किला के सोझा से गुजरे ला।<ref name= Dance>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/other/019xzz000007513u00004000.html|title=Ram Leela Mela. As performed before at Ram Nugur before the Raja of Benares.|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 March 2016|archive-url=https://web.archive.org/web/20160305013402/http://www.bl.uk/onlinegallery/onlineex/apac/other/019xzz000007513u00004000.html|url-status=dead}}</ref> == पॉपुलर संस्कृति में == गंगा नदी के किनारा पर स्थित सुंदर स्थान के कारण रामनगर किला आ महल के फिल्मन के बाहरी शूटिंग लोकेशन के रूप में अक्सर इस्तेमाल कइल गइल बा। ''[[बनारस]]'' एहिजा शूट कइल गइल लोकप्रिय फिल्मन में से एगो हवे।<ref name="Mitra 2002"/><ref name= Ram/> एह जगह के इस्तेमाल रियलिटी टेलीविजन कार्यक्रम ''द अमेजिंग रेस 18'' के सातवाँ पड़ाव (पिट स्टॉप) के रूप में भी कइल गइल रहे। {{clear}} == संदर्भ == {{Commons category|Ramnagar Fort}} {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] aprwdtfkhb0cg6o2nlwjou0kc2njv0g 796617 796616 2026-06-06T01:27:12Z SM7 3953 [[विकिपीडिया:हॉट-कैट|हॉट-कैट]] द्वारा [[श्रेणी:भारत के किला]] जोड़ल गइल 796617 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> == लोकेशन == बनारस में गंगा नदी दक्खिन से उत्तर मुँह बहे ली। ई किला नदी के पूरबी (दाहिना) तीरे पर एगो सुंदर जगह पर स्थित बा, जवन बनारस के घाटन के ठीक सामने बा। ई बनारस से लगभग {{Convert|14|km}} आ [[बनारस हिंदू यूनिवर्सिटी|बनारस हिंदू यूनिवर्सिटी (बीएचयू)]] से नवका [[रामनगर पुल]] के रास्ता से जाइल जाव त लगभग {{Convert|2|km}} दूर बा। पुल बन जाए के बाद बीएचयू से किला तक पहुँचे में मुश्किल से 10 मिनट लागेला। बनारस के [[दशाश्वमेध घाट]] से नाव द्वारा किला तक पहुँचे में लगभग एक घंटा के समय लागेला। किला के घाट पर घोड़ा के जुड़वाँ प्रतीक चिन्ह से सजल एगो रंग-बिरंग राज्यीय बजरा (बार्ज) बंधल देखल जा सकेला।<ref name=moor>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|title=Fort, Ramnagar [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=30 July 2022|archive-url=https://web.archive.org/web/20220730135523/http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|url-status=dead}}</ref> किला के भीतर एगो सुव्यवस्थित बगइचा भी बा, जवन महल तक जाए वाला रास्ता के हिस्सा हवे।<ref name=moor/><ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|title=Rambag (Ramnagar) [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 October 2022|archive-url=https://web.archive.org/web/20221005231804/https://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|url-status=dead}}</ref> == इतिहास == रामनगर किला के निर्माण महाराजा बलवंत सिंह द्वारा 1750 में करावल गइल रहे। किला के बाहरी प्राचीर पर मिलल शिलालेखन के आधार पर एकर कुछ हिस्सा के इतिहास 17वीं सदी तक पहुँचेला।<ref name=moor/> ==आर्किटेक्चर == {{multiple image | align = left | image1 = The Maharaja's Fort, Front view -Benares-.jpg | width1 = 175 | alt1 = | caption1 = | image2 = Laldaruaza (Ramnagar) -Benares-..jpg | width2 = 175 | alt2 = | caption2 = | footer = बायें: महाराजा के किला के साम्हने से व्यू 1869. दाहिनी ओर: मेन दरवाजा, 1905. }} ई इमारत हल्का पीयर रंग के चुनार बलुआ पत्थर से बनावल गइल बा। किला परिसर में वेद व्यास मंदिर, एगो म्यूजियम आ राजा के रिहायशी महल स्थित बा।<ref name=Fort>{{Cite web|url=http://easternuptourism.com/Ramnagar-Fort.jsp|title=Ramnagar Fort & Museum|access-date=7 November 2012|publisher=Official Website of Eastern UP Tourism|url-status=dead|archive-url=https://web.archive.org/web/20131130011021/http://www.easternuptourism.com/Ramnagar-Fort.jsp|archive-date=30 November 2013|df=dmy-all}}</ref> एहिजा दक्षिण दिशा ओर मुँह कइले [[हनुमान]] जी के एगो दक्षिणमुखी मंदिरो बा।<ref name=NIC>{{Cite web|url=http://varanasi.nic.in/history/ramnagar.html|title=Ramnagar|access-date=7 November 2012|publisher=National Informatics Centre}}</ref> किला के ऊँच जगह पर बनावल गइल बा, जवन बाढ़ के समय के जलस्तर से ऊपर बा।<ref name= "Fodor's 2004">{{cite book|title= Fodor's India, 5th Edition|url=https://books.google.com/books?id=eM-wM2K5mgYC&pg=PA168|publisher= Random House Digital, Inc |year=2004|page=168| isbn=978-1-4000-1312-8 }}</ref> एह ढाँचा में नक्काशीदार बालकनी, खुला आँगन आ मंडप मौजूद बाड़ें। किला के खाली कुछे हिस्सा ही आम लोग खातिर खुलल बा, जबकि बाकी हिस्सा [[काशी नरेश]] आ उनकर परिवार के निवास स्थान हवे। जब महाराजा अपना महल में मौजूद रहेलें, तब किला पर राजकीय ध्वज फहरावल जाला। किला के भीतर महल में दू गो सफेद मीनार बाड़ी स, जहाँ सीढ़ी के रास्ता से पहुँचल जाला। सीढ़ियन के आखिर में एगो मेहराबदार प्रवेश द्वार बा, जवना से कई गो आँगन होके सफेद मीनारन तक पहुँचल जाला।<ref name=moor/> मीनार के एक ओर महाराजा के निजी निवास बा, जबकि दुसरे ओर दरबार हॉल आ स्वागत कक्ष स्थित बाड़ें। किला के दीवार पर मौजूद एगो शिलालेख में लिखल बा कि ई "बनारस के राजा के किलाबंद आवास, उनकर शाही नाव सहित" हवे।<ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/addorimss/t/019addor0004728u00000000.html|title=The Raja of Benares's palace at Ramnagar from the river, with the Raja's state boat|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=28 November 2022|archive-url=https://web.archive.org/web/20221128113823/https://www.bl.uk/onlinegallery/onlineex/apac/addorimss/t/019addor0004728u00000000.html|url-status=dead}}</ref> == म्यूजियम == [[File:Ramnagar fort.JPG|thumb|किला के भीतर मौजूद [[म्यूजियम]]]] किला के [[म्यूजियम]] सरस्वती भवन के नाम से जानल जाला। ई म्यूजियम ओह भवन में स्थित बा, जवन पहिले किला के दरबार हॉल भा सार्वजनिक सभा कक्ष के रूप में इस्तेमाल होखत रहे। ई अपना अनोखा आ दुर्लभ संग्रह खातिर प्रसिद्ध बा। एहिजा अमेरिकी पुरान मोटरगाड़ी ([[विंटेज कार]]), रत्न-जड़ित पालकीनुमा कुर्सी (सेडान चेयर), हाथीदाँत के कलाकृति, मध्यकालीन पोशाक आ सोना-चाँदी के जरीदार राजसी पालकी सभ सुरक्षित रखल गइल बाड़ी स। संग्रहालय में चाँदी से बनल हाथी के हौदा, गहना, किमख्वाब रेशम से बनल पोशाक, आ हथियारन के एगो प्रभावशाली कमरा भी बा, जहाँ तलवार; अफ्रीका, बर्मा आ जापान से आइल पुरान बंदूक सभ रखल गइल बाड़ी स।<ref>{{cite book|title=The Top Ten Temple Towns of India|publisher=Mark Age Publication|first=S.C.|last=Karkar|location=Kolkota|isbn=978-81-87952-12-1|year=2009|page=13}}</ref> एहिजा पुरान माचलॉक बंदूक, सजावटी हुक्का, कटार, महाराजन के चित्र आ कई गो संगीत वाद्य भी मौजूद बाड़ें। कुछ काला रंग के वाद्य यंत्र रखरखाव के कमी के कारण समय के साथ सफेद पड़ गइल बाड़ें। संग्रहालय के सबसे दुर्लभ वस्तुन में एगो खगोलीय घड़ी भी शामिल बा।<ref name= Ram/> ई घड़ी खाली समये ना बतावेला, बल्कि साल, महीना, हफ्ता आ दिन के साथे-साथे सूर्य, चंद्रमा आ दोसर ग्रह सभ से जुड़ल खगोलीय जानकारी भी देखावेला। एह घड़ी के निर्माण 1852 में बनारस राजमहल के दरबारी खगोलशास्त्री द्वारा कइल गइल रहे। एह संग्रहालय में कई गो पांडुलिपि, खासकर धार्मिक ग्रंथ, सुरक्षित रखल गइल बाड़ी स। एकरे अलावा मुगल मिनियेचर शैली से सजल कई गो पुस्तक भी एह संग्रह के हिस्सा बाड़ी स।<ref name="Mitra 2002"/><ref name= Ram/><ref name= "Fodor's 2004"/> संग्रहालय में इस्लामी सांस्कृतिक परंपरा के दर्शावे वाली 535 चित्रांकन भी मौजूद बाड़ी स, जिनका चारों ओर फूल-पत्ती के सुंदर सजावटी किनारा आ अलंकरण बनावल गइल बा।<ref name= "Bäumer 2006">{{cite book|title= Sāmarasya: studies in Indian art, philosophy, and interreligious dialogue : in honour of Bettina Bäumer |url=https://books.google.com/books?id=MZ3WAAAAMAAJ|publisher= D.K. Printworld|access-date=7 November 2012|year=2006|isbn=9788124603383|page=193}}</ref><ref name="Limited2003">{{cite book|last= Limited |first= Eicher Goodearth |title= Good Earth Varanasi City Guide |url=https://books.google.com/books?id=NviJaunGDJMC|publisher= Eicher Goodearth Limited |year=2003|isbn= 9788187780045 |pages=124–127}}</ref> == उत्सव तिहुआर == {{see also|रामनगर के रामलीला}} [[File:Ram Leela Mela As Performed before at Ram Nugur before the Raja of Benares by James Prinsep 1834.jpg|right|thumb|राजा बनारस के सोझा रामलीला के मंचन, 1834 (जेम्स प्रिंसेप)]] एक महीना तक चले वाली रामलीला के दौरान रामनगर किला आ महल के खास तौर पर सजावल जाला, जवना से ई बहुत रंग-बिरंग आ आकर्षक दिखाई देला। एह अवसर पर [[रामायण]] के अलग-अलग प्रसंगन के मंचन कइल जाला। [[ग्रेगोरियन कैलेंडर|अंग्रेजी कलेंडर]] के अनुसार अक्टूबर महीना में मनावल जाए वाला [[बिजयदसिमी|दशहरा उत्सव]] के हिस्सा के रूप में रामायण पर आधारित एगो भव्य झाँकी आ जलूस निकालल जाला। एह दौरान राक्षस राजा रावण, उनकर भाई-बंधु आ सहयोगियन के पुतला दहन कइल जाला, जवन बुराई पर अच्छाई के विजय के प्रतीक मानल जाला। उत्सव में राजपरिवार के पुरान आ बहुमूल्य वस्तुन के प्रदर्शनी आ झाँकी शामिल रहेला।<ref name=Fort/> काशी नरेश आजुओ अपना पारिवारिक परंपरा के निभावत बाड़ें। ऊ किला के पीछे के सड़कन पर आयोजित होखे वाला सालाना रामलीला महोत्सव में सजावल गइल हाथी पर सवार होके जुलूस के अगुवाई करेलन।<ref name="Limited2003"/> पुरान समय में एह नाटक के मंचन स्थानीय सैनिक टुकड़ी द्वारा कइल जात रहे आ पूरा महीना तक चले वाला एह उत्सव में रामायण के कथा के पाठ भी कइल जाव।<ref name= "Heitzman2004">{{cite book|last= Heitzman |first= James |title= The City in South Asia|url=https://books.google.com/books?id=c2p0kqUqfQ4C&pg=PA54|publisher= Psychology Press |year=2008|isbn=9780415343558|page=54}}</ref><ref name= Dance/> किला में दूसर धार्मिक आ सांस्कृतिक उत्सवो आयोजित होलें। [[माघ]] (जनवरी–फरवरी) महीना में वेद व्यास मंदिर के सामने मेला लागेला, जहाँ भारी संख्या में श्रद्धालु रामनगर आवेलन। [[फागुन]] (फरवरी–मार्च) महीना में राज मंगल नाम के उत्सव मनावल जाला। एह अवसर पर लोगन से भरल नावन के जलूस निकले ला, एह में गीत-संगीत आ नृत्य के कार्यक्रम होखेला। ई नाव यात्रा [[अस्सी घाट]] से शुरू होके गंगा नदी के रास्ता रामनगर किला के सोझा से गुजरे ला।<ref name= Dance>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/other/019xzz000007513u00004000.html|title=Ram Leela Mela. As performed before at Ram Nugur before the Raja of Benares.|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 March 2016|archive-url=https://web.archive.org/web/20160305013402/http://www.bl.uk/onlinegallery/onlineex/apac/other/019xzz000007513u00004000.html|url-status=dead}}</ref> == पॉपुलर संस्कृति में == गंगा नदी के किनारा पर स्थित सुंदर स्थान के कारण रामनगर किला आ महल के फिल्मन के बाहरी शूटिंग लोकेशन के रूप में अक्सर इस्तेमाल कइल गइल बा। ''[[बनारस]]'' एहिजा शूट कइल गइल लोकप्रिय फिल्मन में से एगो हवे।<ref name="Mitra 2002"/><ref name= Ram/> एह जगह के इस्तेमाल रियलिटी टेलीविजन कार्यक्रम ''द अमेजिंग रेस 18'' के सातवाँ पड़ाव (पिट स्टॉप) के रूप में भी कइल गइल रहे। {{clear}} == संदर्भ == {{Commons category|Ramnagar Fort}} {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] [[श्रेणी:भारत के किला]] 0isxrit23rogidjpwcm3waqe5zkmss4 796619 796617 2026-06-06T01:34:33Z SM7 3953 सफाई कइल गइल 796619 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> == लोकेशन == बनारस में गंगा नदी दक्खिन से उत्तर मुँह बहे ली। ई किला नदी के पूरबी (दाहिना) तीरे पर एगो सुंदर जगह पर स्थित बा, जवन बनारस के घाटन के ठीक सामने बा। ई बनारस से लगभग {{Convert|14|km}} आ [[बनारस हिंदू यूनिवर्सिटी|बनारस हिंदू यूनिवर्सिटी (बीएचयू)]] से नवका [[रामनगर पुल]] के रास्ता से जाइल जाव त लगभग {{Convert|2|km}} दूर बा। पुल बन जाए के बाद बीएचयू से किला तक पहुँचे में मुश्किल से 10 मिनट लागेला। बनारस के [[दशाश्वमेध घाट]] से नाव द्वारा किला तक पहुँचे में लगभग एक घंटा के समय लागेला। किला के घाट पर घोड़ा के जुड़वाँ प्रतीक चिन्ह से सजल एगो रंग-बिरंग राज्यीय बजरा (बार्ज) बंधल देखल जा सकेला।<ref name=moor>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|title=Fort, Ramnagar [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=30 July 2022|archive-url=https://web.archive.org/web/20220730135523/http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|url-status=dead}}</ref> किला के भीतर एगो सुव्यवस्थित बगइचा भी बा, जवन महल तक जाए वाला रास्ता के हिस्सा हवे।<ref name=moor/><ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|title=Rambag (Ramnagar) [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 October 2022|archive-url=https://web.archive.org/web/20221005231804/https://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|url-status=dead}}</ref> == इतिहास == रामनगर किला के निर्माण महाराजा बलवंत सिंह द्वारा 1750 में करावल गइल रहे। किला के बाहरी प्राचीर पर मिलल शिलालेखन के आधार पर एकर कुछ हिस्सा के इतिहास 17वीं सदी तक पहुँचेला।<ref name=moor/> ==आर्किटेक्चर == {{multiple image | align = left | image1 = The Maharaja's Fort, Front view -Benares-.jpg | width1 = 175 | alt1 = | caption1 = | image2 = Laldaruaza (Ramnagar) -Benares-..jpg | width2 = 175 | alt2 = | caption2 = | footer = बायें: महाराजा के किला के साम्हने से व्यू 1869. दाहिनी ओर: मेन दरवाजा, 1905. }} ई इमारत हल्का पीयर रंग के चुनार बलुआ पत्थर से बनावल गइल बा। किला परिसर में वेद व्यास मंदिर, एगो म्यूजियम आ राजा के रिहायशी महल स्थित बा।<ref name=Fort>{{Cite web|url=http://easternuptourism.com/Ramnagar-Fort.jsp|title=Ramnagar Fort & Museum|access-date=7 November 2012|publisher=Official Website of Eastern UP Tourism|url-status=dead|archive-url=https://web.archive.org/web/20131130011021/http://www.easternuptourism.com/Ramnagar-Fort.jsp|archive-date=30 November 2013|df=dmy-all}}</ref> एहिजा दक्षिण दिशा ओर मुँह कइले [[हनुमान]] जी के एगो दक्षिणमुखी मंदिरो बा।<ref name=NIC>{{Cite web|url=http://varanasi.nic.in/history/ramnagar.html|title=Ramnagar|access-date=7 November 2012|publisher=National Informatics Centre}}</ref> किला के ऊँच जगह पर बनावल गइल बा, जवन बाढ़ के समय के जलस्तर से ऊपर बा।<ref name= "Fodor's 2004">{{cite book|title= Fodor's India, 5th Edition|url=https://books.google.com/books?id=eM-wM2K5mgYC&pg=PA168|publisher= Random House Digital, Inc |year=2004|page=168| isbn=978-1-4000-1312-8 }}</ref> एह ढाँचा में नक्काशीदार बालकनी, खुला आँगन आ मंडप मौजूद बाड़ें। किला के खाली कुछे हिस्सा ही आम लोग खातिर खुलल बा, जबकि बाकी हिस्सा [[काशी नरेश]] आ उनकर परिवार के निवास स्थान हवे। जब महाराजा अपना महल में मौजूद रहेलें, तब किला पर राजकीय ध्वज फहरावल जाला। किला के भीतर महल में दू गो सफेद मीनार बाड़ी स, जहाँ सीढ़ी के रास्ता से पहुँचल जाला। सीढ़ियन के आखिर में एगो मेहराबदार प्रवेश द्वार बा, जवना से कई गो आँगन होके सफेद मीनारन तक पहुँचल जाला।<ref name=moor/> मीनार के एक ओर महाराजा के निजी निवास बा, जबकि दुसरे ओर दरबार हॉल आ स्वागत कक्ष स्थित बाड़ें। किला के दीवार पर मौजूद एगो शिलालेख में लिखल बा कि ई "बनारस के राजा के किलाबंद आवास, उनकर शाही नाव सहित" हवे।<ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/addorimss/t/019addor0004728u00000000.html|title=The Raja of Benares's palace at Ramnagar from the river, with the Raja's state boat|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=28 November 2022|archive-url=https://web.archive.org/web/20221128113823/https://www.bl.uk/onlinegallery/onlineex/apac/addorimss/t/019addor0004728u00000000.html|url-status=dead}}</ref> == म्यूजियम == [[File:Ramnagar fort.JPG|thumb|किला के भीतर मौजूद [[म्यूजियम]]]] किला के [[म्यूजियम]] सरस्वती भवन के नाम से जानल जाला। ई म्यूजियम ओह भवन में स्थित बा, जवन पहिले किला के दरबार हॉल भा सार्वजनिक सभा कक्ष के रूप में इस्तेमाल होखत रहे। ई अपना अनोखा आ दुर्लभ संग्रह खातिर प्रसिद्ध बा। एहिजा अमेरिकी पुरान मोटरगाड़ी ([[विंटेज कार]]), रत्न-जड़ित पालकीनुमा कुर्सी (सेडान चेयर), हाथीदाँत के कलाकृति, मध्यकालीन पोशाक आ सोना-चाँदी के जरीदार राजसी पालकी सभ सुरक्षित रखल गइल बाड़ी स। संग्रहालय में चाँदी से बनल हाथी के हौदा, गहना, किमख्वाब रेशम से बनल पोशाक, आ हथियारन के एगो प्रभावशाली कमरा भी बा, जहाँ तलवार; अफ्रीका, बर्मा आ जापान से आइल पुरान बंदूक सभ रखल गइल बाड़ी स।<ref>{{cite book|title=The Top Ten Temple Towns of India|publisher=Mark Age Publication|first=S.C.|last=Karkar|location=Kolkota|isbn=978-81-87952-12-1|year=2009|page=13}}</ref> एहिजा पुरान माचलॉक बंदूक, सजावटी हुक्का, कटार, महाराजन के चित्र आ कई गो संगीत वाद्य भी मौजूद बाड़ें। कुछ काला रंग के वाद्य यंत्र रखरखाव के कमी के कारण समय के साथ सफेद पड़ गइल बाड़ें। संग्रहालय के सबसे दुर्लभ वस्तुन में एगो खगोलीय घड़ी भी शामिल बा।<ref name= Ram/> ई घड़ी खाली समये ना बतावेला, बल्कि साल, महीना, हफ्ता आ दिन के साथे-साथे सूर्य, चंद्रमा आ दोसर ग्रह सभ से जुड़ल खगोलीय जानकारी भी देखावेला। एह घड़ी के निर्माण 1852 में बनारस राजमहल के दरबारी खगोलशास्त्री द्वारा कइल गइल रहे। एह संग्रहालय में कई गो पांडुलिपि, खासकर धार्मिक ग्रंथ, सुरक्षित रखल गइल बाड़ी स। एकरे अलावा मुगल मिनियेचर शैली से सजल कई गो पुस्तक भी एह संग्रह के हिस्सा बाड़ी स।<ref name="Mitra 2002"/><ref name= Ram/><ref name= "Fodor's 2004"/> संग्रहालय में इस्लामी सांस्कृतिक परंपरा के दर्शावे वाली 535 चित्रांकन भी मौजूद बाड़ी स, जिनका चारों ओर फूल-पत्ती के सुंदर सजावटी किनारा आ अलंकरण बनावल गइल बा।<ref name= "Bäumer 2006">{{cite book|title= Sāmarasya: studies in Indian art, philosophy, and interreligious dialogue : in honour of Bettina Bäumer |url=https://books.google.com/books?id=MZ3WAAAAMAAJ|publisher= D.K. Printworld|access-date=7 November 2012|year=2006|isbn=9788124603383|page=193}}</ref><ref name="Limited2003">{{cite book|last= |first= |title= Good Earth Varanasi City Guide |url=https://books.google.com/books?id=NviJaunGDJMC|publisher= Eicher Goodearth Limited |year=2003|isbn= 9788187780045 |pages=124–127}}</ref> == उत्सव तिहुआर == {{see also|रामनगर के रामलीला}} [[File:Ram Leela Mela As Performed before at Ram Nugur before the Raja of Benares by James Prinsep 1834.jpg|right|thumb|राजा बनारस के सोझा रामलीला के मंचन, 1834 (जेम्स प्रिंसेप)]] एक महीना तक चले वाली रामलीला के दौरान रामनगर किला आ महल के खास तौर पर सजावल जाला, जवना से ई बहुत रंग-बिरंग आ आकर्षक दिखाई देला। एह अवसर पर [[रामायण]] के अलग-अलग प्रसंगन के मंचन कइल जाला। [[ग्रेगोरियन कैलेंडर|अंग्रेजी कलेंडर]] के अनुसार अक्टूबर महीना में मनावल जाए वाला [[बिजयदसिमी|दशहरा उत्सव]] के हिस्सा के रूप में रामायण पर आधारित एगो भव्य झाँकी आ जलूस निकालल जाला। एह दौरान राक्षस राजा रावण, उनकर भाई-बंधु आ सहयोगियन के पुतला दहन कइल जाला, जवन बुराई पर अच्छाई के विजय के प्रतीक मानल जाला। उत्सव में राजपरिवार के पुरान आ बहुमूल्य वस्तुन के प्रदर्शनी आ झाँकी शामिल रहेला।<ref name=Fort/> काशी नरेश आजुओ अपना पारिवारिक परंपरा के निभावत बाड़ें। ऊ किला के पीछे के सड़कन पर आयोजित होखे वाला सालाना रामलीला महोत्सव में सजावल गइल हाथी पर सवार होके जुलूस के अगुवाई करेलन।<ref name="Limited2003"/> पुरान समय में एह नाटक के मंचन स्थानीय सैनिक टुकड़ी द्वारा कइल जात रहे आ पूरा महीना तक चले वाला एह उत्सव में रामायण के कथा के पाठ भी कइल जाव।<ref name= "Heitzman2004">{{cite book|last= Heitzman |first= James |title= The City in South Asia|url=https://books.google.com/books?id=c2p0kqUqfQ4C&pg=PA54|publisher= Psychology Press |year=2008|isbn=9780415343558|page=54}}</ref><ref name= Dance/> किला में दूसर धार्मिक आ सांस्कृतिक उत्सवो आयोजित होलें। [[माघ]] (जनवरी–फरवरी) महीना में वेद व्यास मंदिर के सामने मेला लागेला, जहाँ भारी संख्या में श्रद्धालु रामनगर आवेलन। [[फागुन]] (फरवरी–मार्च) महीना में राज मंगल नाम के उत्सव मनावल जाला। एह अवसर पर लोगन से भरल नावन के जलूस निकले ला, एह में गीत-संगीत आ नृत्य के कार्यक्रम होखेला। ई नाव यात्रा [[अस्सी घाट]] से शुरू होके गंगा नदी के रास्ता रामनगर किला के सोझा से गुजरे ला।<ref name= Dance>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/other/019xzz000007513u00004000.html|title=Ram Leela Mela. As performed before at Ram Nugur before the Raja of Benares.|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 March 2016|archive-url=https://web.archive.org/web/20160305013402/http://www.bl.uk/onlinegallery/onlineex/apac/other/019xzz000007513u00004000.html|url-status=dead}}</ref> == पॉपुलर संस्कृति में == गंगा नदी के किनारा पर स्थित सुंदर स्थान के कारण रामनगर किला आ महल के फिल्मन के बाहरी शूटिंग लोकेशन के रूप में अक्सर इस्तेमाल कइल गइल बा। ''[[बनारस]]'' एहिजा शूट कइल गइल लोकप्रिय फिल्मन में से एगो हवे।<ref name="Mitra 2002"/><ref name= Ram/> एह जगह के इस्तेमाल रियलिटी टेलीविजन कार्यक्रम ''द अमेजिंग रेस 18'' के सातवाँ पड़ाव (पिट स्टॉप) के रूप में भी कइल गइल रहे। {{clear}} == संदर्भ == {{Commons category|Ramnagar Fort}} {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] [[श्रेणी:भारत के किला]] d1847pqffw6qs595ghdmh28c7vhzwr0 796620 796619 2026-06-06T01:38:22Z SM7 3953 संदर्भ जोड़ल/सुधारल गइल 796620 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="y889">{{cite web |title=Ramlila, the traditional performance of the Ramayana - UNESCO Intangible Cultural Heritage |website=ich.unesco.org |url=https://ich.unesco.org/en/RL/ramlila-the-traditional-performance-of-the-ramayana-00110 |access-date=6 June 2026}}</ref><ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> == लोकेशन == बनारस में गंगा नदी दक्खिन से उत्तर मुँह बहे ली। ई किला नदी के पूरबी (दाहिना) तीरे पर एगो सुंदर जगह पर स्थित बा, जवन बनारस के घाटन के ठीक सामने बा। ई बनारस से लगभग {{Convert|14|km}} आ [[बनारस हिंदू यूनिवर्सिटी|बनारस हिंदू यूनिवर्सिटी (बीएचयू)]] से नवका [[रामनगर पुल]] के रास्ता से जाइल जाव त लगभग {{Convert|2|km}} दूर बा। पुल बन जाए के बाद बीएचयू से किला तक पहुँचे में मुश्किल से 10 मिनट लागेला। बनारस के [[दशाश्वमेध घाट]] से नाव द्वारा किला तक पहुँचे में लगभग एक घंटा के समय लागेला। किला के घाट पर घोड़ा के जुड़वाँ प्रतीक चिन्ह से सजल एगो रंग-बिरंग राज्यीय बजरा (बार्ज) बंधल देखल जा सकेला।<ref name=moor>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|title=Fort, Ramnagar [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=30 July 2022|archive-url=https://web.archive.org/web/20220730135523/http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|url-status=dead}}</ref> किला के भीतर एगो सुव्यवस्थित बगइचा भी बा, जवन महल तक जाए वाला रास्ता के हिस्सा हवे।<ref name=moor/><ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|title=Rambag (Ramnagar) [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 October 2022|archive-url=https://web.archive.org/web/20221005231804/https://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|url-status=dead}}</ref> == इतिहास == रामनगर किला के निर्माण महाराजा बलवंत सिंह द्वारा 1750 में करावल गइल रहे। किला के बाहरी प्राचीर पर मिलल शिलालेखन के आधार पर एकर कुछ हिस्सा के इतिहास 17वीं सदी तक पहुँचेला।<ref name=moor/> ==आर्किटेक्चर == {{multiple image | align = left | image1 = The Maharaja's Fort, Front view -Benares-.jpg | width1 = 175 | alt1 = | caption1 = | image2 = Laldaruaza (Ramnagar) -Benares-..jpg | width2 = 175 | alt2 = | caption2 = | footer = बायें: महाराजा के किला के साम्हने से व्यू 1869. दाहिनी ओर: मेन दरवाजा, 1905. }} ई इमारत हल्का पीयर रंग के चुनार बलुआ पत्थर से बनावल गइल बा। किला परिसर में वेद व्यास मंदिर, एगो म्यूजियम आ राजा के रिहायशी महल स्थित बा।<ref name=Fort>{{Cite web|url=http://easternuptourism.com/Ramnagar-Fort.jsp|title=Ramnagar Fort & Museum|access-date=7 November 2012|publisher=Official Website of Eastern UP Tourism|url-status=dead|archive-url=https://web.archive.org/web/20131130011021/http://www.easternuptourism.com/Ramnagar-Fort.jsp|archive-date=30 November 2013|df=dmy-all}}</ref> एहिजा दक्षिण दिशा ओर मुँह कइले [[हनुमान]] जी के एगो दक्षिणमुखी मंदिरो बा।<ref name=NIC>{{Cite web|url=http://varanasi.nic.in/history/ramnagar.html|title=Ramnagar|access-date=7 November 2012|publisher=National Informatics Centre}}</ref> किला के ऊँच जगह पर बनावल गइल बा, जवन बाढ़ के समय के जलस्तर से ऊपर बा।<ref name= "Fodor's 2004">{{cite book|title= Fodor's India, 5th Edition|url=https://books.google.com/books?id=eM-wM2K5mgYC&pg=PA168|publisher= Random House Digital, Inc |year=2004|page=168| isbn=978-1-4000-1312-8 }}</ref> एह ढाँचा में नक्काशीदार बालकनी, खुला आँगन आ मंडप मौजूद बाड़ें। किला के खाली कुछे हिस्सा ही आम लोग खातिर खुलल बा, जबकि बाकी हिस्सा [[काशी नरेश]] आ उनकर परिवार के निवास स्थान हवे। जब महाराजा अपना महल में मौजूद रहेलें, तब किला पर राजकीय ध्वज फहरावल जाला। किला के भीतर महल में दू गो सफेद मीनार बाड़ी स, जहाँ सीढ़ी के रास्ता से पहुँचल जाला। सीढ़ियन के आखिर में एगो मेहराबदार प्रवेश द्वार बा, जवना से कई गो आँगन होके सफेद मीनारन तक पहुँचल जाला।<ref name=moor/> मीनार के एक ओर महाराजा के निजी निवास बा, जबकि दुसरे ओर दरबार हॉल आ स्वागत कक्ष स्थित बाड़ें। किला के दीवार पर मौजूद एगो शिलालेख में लिखल बा कि ई "बनारस के राजा के किलाबंद आवास, उनकर शाही नाव सहित" हवे।<ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/addorimss/t/019addor0004728u00000000.html|title=The Raja of Benares's palace at Ramnagar from the river, with the Raja's state boat|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=28 November 2022|archive-url=https://web.archive.org/web/20221128113823/https://www.bl.uk/onlinegallery/onlineex/apac/addorimss/t/019addor0004728u00000000.html|url-status=dead}}</ref> == म्यूजियम == [[File:Ramnagar fort.JPG|thumb|किला के भीतर मौजूद [[म्यूजियम]]]] किला के [[म्यूजियम]] सरस्वती भवन के नाम से जानल जाला। ई म्यूजियम ओह भवन में स्थित बा, जवन पहिले किला के दरबार हॉल भा सार्वजनिक सभा कक्ष के रूप में इस्तेमाल होखत रहे। ई अपना अनोखा आ दुर्लभ संग्रह खातिर प्रसिद्ध बा। एहिजा अमेरिकी पुरान मोटरगाड़ी ([[विंटेज कार]]), रत्न-जड़ित पालकीनुमा कुर्सी (सेडान चेयर), हाथीदाँत के कलाकृति, मध्यकालीन पोशाक आ सोना-चाँदी के जरीदार राजसी पालकी सभ सुरक्षित रखल गइल बाड़ी स। संग्रहालय में चाँदी से बनल हाथी के हौदा, गहना, किमख्वाब रेशम से बनल पोशाक, आ हथियारन के एगो प्रभावशाली कमरा भी बा, जहाँ तलवार; अफ्रीका, बर्मा आ जापान से आइल पुरान बंदूक सभ रखल गइल बाड़ी स।<ref>{{cite book|title=The Top Ten Temple Towns of India|publisher=Mark Age Publication|first=S.C.|last=Karkar|location=Kolkota|isbn=978-81-87952-12-1|year=2009|page=13}}</ref> एहिजा पुरान माचलॉक बंदूक, सजावटी हुक्का, कटार, महाराजन के चित्र आ कई गो संगीत वाद्य भी मौजूद बाड़ें। कुछ काला रंग के वाद्य यंत्र रखरखाव के कमी के कारण समय के साथ सफेद पड़ गइल बाड़ें। संग्रहालय के सबसे दुर्लभ वस्तुन में एगो खगोलीय घड़ी भी शामिल बा।<ref name= Ram/> ई घड़ी खाली समये ना बतावेला, बल्कि साल, महीना, हफ्ता आ दिन के साथे-साथे सूर्य, चंद्रमा आ दोसर ग्रह सभ से जुड़ल खगोलीय जानकारी भी देखावेला। एह घड़ी के निर्माण 1852 में बनारस राजमहल के दरबारी खगोलशास्त्री द्वारा कइल गइल रहे। एह संग्रहालय में कई गो पांडुलिपि, खासकर धार्मिक ग्रंथ, सुरक्षित रखल गइल बाड़ी स। एकरे अलावा मुगल मिनियेचर शैली से सजल कई गो पुस्तक भी एह संग्रह के हिस्सा बाड़ी स।<ref name="Mitra 2002"/><ref name= Ram/><ref name= "Fodor's 2004"/> संग्रहालय में इस्लामी सांस्कृतिक परंपरा के दर्शावे वाली 535 चित्रांकन भी मौजूद बाड़ी स, जिनका चारों ओर फूल-पत्ती के सुंदर सजावटी किनारा आ अलंकरण बनावल गइल बा।<ref name= "Bäumer 2006">{{cite book|title= Sāmarasya: studies in Indian art, philosophy, and interreligious dialogue : in honour of Bettina Bäumer |url=https://books.google.com/books?id=MZ3WAAAAMAAJ|publisher= D.K. Printworld|access-date=7 November 2012|year=2006|isbn=9788124603383|page=193}}</ref><ref name="Limited2003">{{cite book|last= |first= |title= Good Earth Varanasi City Guide |url=https://books.google.com/books?id=NviJaunGDJMC|publisher= Eicher Goodearth Limited |year=2003|isbn= 9788187780045 |pages=124–127}}</ref> == उत्सव तिहुआर == {{see also|रामनगर के रामलीला}} [[File:Ram Leela Mela As Performed before at Ram Nugur before the Raja of Benares by James Prinsep 1834.jpg|right|thumb|राजा बनारस के सोझा रामलीला के मंचन, 1834 (जेम्स प्रिंसेप)]] एक महीना तक चले वाली रामलीला के दौरान रामनगर किला आ महल के खास तौर पर सजावल जाला, जवना से ई बहुत रंग-बिरंग आ आकर्षक दिखाई देला। एह अवसर पर [[रामायण]] के अलग-अलग प्रसंगन के मंचन कइल जाला। [[ग्रेगोरियन कैलेंडर|अंग्रेजी कलेंडर]] के अनुसार अक्टूबर महीना में मनावल जाए वाला [[बिजयदसिमी|दशहरा उत्सव]] के हिस्सा के रूप में रामायण पर आधारित एगो भव्य झाँकी आ जलूस निकालल जाला। एह दौरान राक्षस राजा रावण, उनकर भाई-बंधु आ सहयोगियन के पुतला दहन कइल जाला, जवन बुराई पर अच्छाई के विजय के प्रतीक मानल जाला। उत्सव में राजपरिवार के पुरान आ बहुमूल्य वस्तुन के प्रदर्शनी आ झाँकी शामिल रहेला।<ref name=Fort/> काशी नरेश आजुओ अपना पारिवारिक परंपरा के निभावत बाड़ें। ऊ किला के पीछे के सड़कन पर आयोजित होखे वाला सालाना रामलीला महोत्सव में सजावल गइल हाथी पर सवार होके जुलूस के अगुवाई करेलन।<ref name="Limited2003"/> पुरान समय में एह नाटक के मंचन स्थानीय सैनिक टुकड़ी द्वारा कइल जात रहे आ पूरा महीना तक चले वाला एह उत्सव में रामायण के कथा के पाठ भी कइल जाव।<ref name= "Heitzman2004">{{cite book|last= Heitzman |first= James |title= The City in South Asia|url=https://books.google.com/books?id=c2p0kqUqfQ4C&pg=PA54|publisher= Psychology Press |year=2008|isbn=9780415343558|page=54}}</ref><ref name= Dance/> किला में दूसर धार्मिक आ सांस्कृतिक उत्सवो आयोजित होलें। [[माघ]] (जनवरी–फरवरी) महीना में वेद व्यास मंदिर के सामने मेला लागेला, जहाँ भारी संख्या में श्रद्धालु रामनगर आवेलन। [[फागुन]] (फरवरी–मार्च) महीना में राज मंगल नाम के उत्सव मनावल जाला। एह अवसर पर लोगन से भरल नावन के जलूस निकले ला, एह में गीत-संगीत आ नृत्य के कार्यक्रम होखेला। ई नाव यात्रा [[अस्सी घाट]] से शुरू होके गंगा नदी के रास्ता रामनगर किला के सोझा से गुजरे ला।<ref name= Dance>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/other/019xzz000007513u00004000.html|title=Ram Leela Mela. As performed before at Ram Nugur before the Raja of Benares.|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 March 2016|archive-url=https://web.archive.org/web/20160305013402/http://www.bl.uk/onlinegallery/onlineex/apac/other/019xzz000007513u00004000.html|url-status=dead}}</ref> == पॉपुलर संस्कृति में == गंगा नदी के किनारा पर स्थित सुंदर स्थान के कारण रामनगर किला आ महल के फिल्मन के बाहरी शूटिंग लोकेशन के रूप में अक्सर इस्तेमाल कइल गइल बा। ''[[बनारस]]'' एहिजा शूट कइल गइल लोकप्रिय फिल्मन में से एगो हवे।<ref name="Mitra 2002"/><ref name= Ram/> एह जगह के इस्तेमाल रियलिटी टेलीविजन कार्यक्रम ''द अमेजिंग रेस 18'' के सातवाँ पड़ाव (पिट स्टॉप) के रूप में भी कइल गइल रहे। {{clear}} == संदर्भ == {{Commons category|Ramnagar Fort}} {{Reflist|29em}} {{बनारस}} [[श्रेणी:बनारस]] [[श्रेणी:भारत के किला]] 0lhxy53i7aheknbxgjpwja7j3man8rs 796621 796620 2026-06-06T01:42:20Z SM7 3953 सुधार कइल गइल, बाहरी कड़ी जोड़ल गइल 796621 wikitext text/x-wiki {{Infobox military installation | name = रामनगर किला | partof = [[रामनगर, बनारस]] | location = [[उत्तर प्रदेश]], [[भारत]] | image = Entrance area of Ramnagar Fort.jpg | caption = किला के मुख्य दरवाजा | map_type = Uttar_Pradesh | map_size = 300 | map_caption = | type = [[किला]] | coordinates = {{coord|25.28|83.03|type:landmark|display=inline}} | code = | built = 1750 | builder = बलवंत सिंह | materials = ''चुनार'' [[बलुआ पत्थर]] | height = | used = | demolished = | condition = | open_to_public = | controlledby = | garrison = | current_commander = | commanders = | occupants = अनंत नारायण सिंह | battles = | events = [[रामलीला]] }} '''रामनगर किला''' भारत के रामनगर, [[बनारस]] में स्थित एगो किला बाटे। ई [[गंगा नदी]] के पूरबी तीरे पर, तुलसी घाट के सोझा स्थित बा। चुनार के [[बलुआ पत्थर]] से बनल एह किला के निर्माण 1750 में महाराजा बलवंत सिंह द्वारा करावल गइल रहे। किला के वर्तमान निवासी अनंत नारायण सिंह बाड़ें। ऊ बनारस के महाराजा के रूप में भी जानल जालें, हालाँकि ई शाही उपाधि 1971 से आधिकारिक रूप से समाप्त क दिहल गइल।<ref name="Mitra 2002">{{cite book|last=Mitra| first = Swati| title = Good Earth Varanasi city guide| url=https://books.google.com/books?id=NviJaunGDJMC&pg=PA124|publisher = Eicher Goodearth Limited| access-date=6 November 2012|year = 2002| isbn = 9788187780045| pages = 124–127}}</ref><ref name= Ram>{{cite web|url=http://www.lonelyplanet.com/india/uttar-pradesh/varanasi/sights/museum/ramnagar-fort-museum|title=Lonely Planet review for Ramnagar Fort & Museum |access-date=6 November 2012|publisher=Lonely Planet}}</ref> [[दसहरा]] से पहिले होखे वाली [[रामनगर के रामलीला|रामलीला]] एह किला के मुख्य आकर्षण हवे। ई रामलीला 31 चले ले आ एकरा महत्व के देख के एकरा के यूनेस्को के अमूर्त धरोहर सभ के लिस्ट में 2008 में सामिल कइल गइल।<ref name="y889">{{cite web |title=Ramlila, the traditional performance of the Ramayana - UNESCO Intangible Cultural Heritage |website=ich.unesco.org |url=https://ich.unesco.org/en/RL/ramlila-the-traditional-performance-of-the-ramayana-00110 |access-date=6 June 2026}}</ref><ref name="l558">{{cite web |last=Chakravarty |first=Saurabh |title=beginning of ramlila of ramnagar in varanasi in list of UNESCO world heritage is considered to be from beginning of nineteenth centuryJagranSpecial |website=Jagran |date=2 September 2022 |url=https://www.jagran.com/uttar-pradesh/varanasi-city-beginning-of-ramlila-of-ramnagar-in-varanasi-in-list-of-unesco-world-heritage-is-considered-to-be-from-beginning-of-nineteenth-centuryjagranspecial-23037054.html |language=hi |access-date=5 June 2026}}</ref> == लोकेशन == बनारस में गंगा नदी दक्खिन से उत्तर मुँह बहे ली। ई किला नदी के पूरबी (दाहिना) तीरे पर एगो सुंदर जगह पर स्थित बा, जवन बनारस के घाटन के ठीक सामने बा। ई बनारस से लगभग {{Convert|14|km}} आ [[बनारस हिंदू यूनिवर्सिटी|बनारस हिंदू यूनिवर्सिटी (बीएचयू)]] से नवका [[रामनगर पुल]] के रास्ता से जाइल जाव त लगभग {{Convert|2|km}} दूर बा। पुल बन जाए के बाद बीएचयू से किला तक पहुँचे में मुश्किल से 10 मिनट लागेला। बनारस के [[दशाश्वमेध घाट]] से नाव द्वारा किला तक पहुँचे में लगभग एक घंटा के समय लागेला। किला के घाट पर घोड़ा के जुड़वाँ प्रतीक चिन्ह से सजल एगो रंग-बिरंग राज्यीय बजरा (बार्ज) बंधल देखल जा सकेला।<ref name=moor>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|title=Fort, Ramnagar [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=30 July 2022|archive-url=https://web.archive.org/web/20220730135523/http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/f/019pho0000017s3u00001000.html|url-status=dead}}</ref> किला के भीतर एगो सुव्यवस्थित बगइचा भी बा, जवन महल तक जाए वाला रास्ता के हिस्सा हवे।<ref name=moor/><ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|title=Rambag (Ramnagar) [Benares]|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 October 2022|archive-url=https://web.archive.org/web/20221005231804/https://www.bl.uk/onlinegallery/onlineex/apac/photocoll/r/019pho0000017s3u00031000.html|url-status=dead}}</ref> == इतिहास == रामनगर किला के निर्माण महाराजा बलवंत सिंह द्वारा 1750 में करावल गइल रहे। किला के बाहरी प्राचीर पर मिलल शिलालेखन के आधार पर एकर कुछ हिस्सा के इतिहास 17वीं सदी तक पहुँचेला।<ref name=moor/> ==आर्किटेक्चर == {{multiple image | align = left | image1 = The Maharaja's Fort, Front view -Benares-.jpg | width1 = 175 | alt1 = | caption1 = | image2 = Laldaruaza (Ramnagar) -Benares-..jpg | width2 = 175 | alt2 = | caption2 = | footer = बायें: महाराजा के किला के साम्हने से व्यू 1869. दाहिनी ओर: मेन दरवाजा, 1905. }} ई इमारत हल्का पीयर रंग के चुनार बलुआ पत्थर से बनावल गइल बा। किला परिसर में वेद व्यास मंदिर, एगो म्यूजियम आ राजा के रिहायशी महल स्थित बा।<ref name=Fort>{{Cite web|url=http://easternuptourism.com/Ramnagar-Fort.jsp|title=Ramnagar Fort & Museum|access-date=7 November 2012|publisher=Official Website of Eastern UP Tourism|url-status=dead|archive-url=https://web.archive.org/web/20131130011021/http://www.easternuptourism.com/Ramnagar-Fort.jsp|archive-date=30 November 2013|df=dmy-all}}</ref> एहिजा दक्षिण दिशा ओर मुँह कइले [[हनुमान]] जी के एगो दक्षिणमुखी मंदिरो बा।<ref name=NIC>{{Cite web|url=http://varanasi.nic.in/history/ramnagar.html|title=Ramnagar|access-date=7 November 2012|publisher=National Informatics Centre}}</ref> किला के ऊँच जगह पर बनावल गइल बा, जवन बाढ़ के समय के जलस्तर से ऊपर बा।<ref name= "Fodor's 2004">{{cite book|title= Fodor's India, 5th Edition|url=https://books.google.com/books?id=eM-wM2K5mgYC&pg=PA168|publisher= Random House Digital, Inc |year=2004|page=168| isbn=978-1-4000-1312-8 }}</ref> एह ढाँचा में नक्काशीदार बालकनी, खुला आँगन आ मंडप मौजूद बाड़ें। किला के खाली कुछे हिस्सा ही आम लोग खातिर खुलल बा, जबकि बाकी हिस्सा [[काशी नरेश]] आ उनकर परिवार के निवास स्थान हवे। जब महाराजा अपना महल में मौजूद रहेलें, तब किला पर राजकीय ध्वज फहरावल जाला। किला के भीतर महल में दू गो सफेद मीनार बाड़ी स, जहाँ सीढ़ी के रास्ता से पहुँचल जाला। सीढ़ियन के आखिर में एगो मेहराबदार प्रवेश द्वार बा, जवना से कई गो आँगन होके सफेद मीनारन तक पहुँचल जाला।<ref name=moor/> मीनार के एक ओर महाराजा के निजी निवास बा, जबकि दुसरे ओर दरबार हॉल आ स्वागत कक्ष स्थित बाड़ें। किला के दीवार पर मौजूद एगो शिलालेख में लिखल बा कि ई "बनारस के राजा के किलाबंद आवास, उनकर शाही नाव सहित" हवे।<ref>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/addorimss/t/019addor0004728u00000000.html|title=The Raja of Benares's palace at Ramnagar from the river, with the Raja's state boat|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=28 November 2022|archive-url=https://web.archive.org/web/20221128113823/https://www.bl.uk/onlinegallery/onlineex/apac/addorimss/t/019addor0004728u00000000.html|url-status=dead}}</ref> == म्यूजियम == [[File:Ramnagar fort.JPG|thumb|किला के भीतर मौजूद [[म्यूजियम]]]] किला के [[म्यूजियम]] सरस्वती भवन के नाम से जानल जाला। ई म्यूजियम ओह भवन में स्थित बा, जवन पहिले किला के दरबार हॉल भा सार्वजनिक सभा कक्ष के रूप में इस्तेमाल होखत रहे। ई अपना अनोखा आ दुर्लभ संग्रह खातिर प्रसिद्ध बा। एहिजा अमेरिकी पुरान मोटरगाड़ी ([[विंटेज कार]]), रत्न-जड़ित पालकीनुमा कुर्सी (सेडान चेयर), हाथीदाँत के कलाकृति, मध्यकालीन पोशाक आ सोना-चाँदी के जरीदार राजसी पालकी सभ सुरक्षित रखल गइल बाड़ी स। संग्रहालय में चाँदी से बनल हाथी के हौदा, गहना, किमख्वाब रेशम से बनल पोशाक, आ हथियारन के एगो प्रभावशाली कमरा भी बा, जहाँ तलवार; अफ्रीका, बर्मा आ जापान से आइल पुरान बंदूक सभ रखल गइल बाड़ी स।<ref>{{cite book|title=The Top Ten Temple Towns of India|publisher=Mark Age Publication|first=S.C.|last=Karkar|location=Kolkota|isbn=978-81-87952-12-1|year=2009|page=13}}</ref> एहिजा पुरान माचलॉक बंदूक, सजावटी हुक्का, कटार, महाराजन के चित्र आ कई गो संगीत वाद्य भी मौजूद बाड़ें। कुछ काला रंग के वाद्य यंत्र रखरखाव के कमी के कारण समय के साथ सफेद पड़ गइल बाड़ें। संग्रहालय के सबसे दुर्लभ वस्तुन में एगो खगोलीय घड़ी भी शामिल बा।<ref name= Ram/> ई घड़ी खाली समये ना बतावेला, बल्कि साल, महीना, हफ्ता आ दिन के साथे-साथे सूर्य, चंद्रमा आ दोसर ग्रह सभ से जुड़ल खगोलीय जानकारी भी देखावेला। एह घड़ी के निर्माण 1852 में बनारस राजमहल के दरबारी खगोलशास्त्री द्वारा कइल गइल रहे। एह संग्रहालय में कई गो पांडुलिपि, खासकर धार्मिक ग्रंथ, सुरक्षित रखल गइल बाड़ी स। एकरे अलावा मुगल मिनियेचर शैली से सजल कई गो पुस्तक भी एह संग्रह के हिस्सा बाड़ी स।<ref name="Mitra 2002"/><ref name= Ram/><ref name= "Fodor's 2004"/> संग्रहालय में इस्लामी सांस्कृतिक परंपरा के दर्शावे वाली 535 चित्रांकन भी मौजूद बाड़ी स, जिनका चारों ओर फूल-पत्ती के सुंदर सजावटी किनारा आ अलंकरण बनावल गइल बा।<ref name= "Bäumer 2006">{{cite book|title= Sāmarasya: studies in Indian art, philosophy, and interreligious dialogue : in honour of Bettina Bäumer |url=https://books.google.com/books?id=MZ3WAAAAMAAJ|publisher= D.K. Printworld|access-date=7 November 2012|year=2006|isbn=9788124603383|page=193}}</ref><ref name="Limited2003">{{cite book|last= |first= |title= Good Earth Varanasi City Guide |url=https://books.google.com/books?id=NviJaunGDJMC|publisher= Eicher Goodearth Limited |year=2003|isbn= 9788187780045 |pages=124–127}}</ref> == उत्सव तिहुआर == {{see also|रामनगर के रामलीला}} [[File:Ram Leela Mela As Performed before at Ram Nugur before the Raja of Benares by James Prinsep 1834.jpg|right|thumb|राजा बनारस के सोझा रामलीला के मंचन, 1834 (जेम्स प्रिंसेप)]] एक महीना तक चले वाली रामलीला के दौरान रामनगर किला आ महल के खास तौर पर सजावल जाला, जवना से ई बहुत रंग-बिरंग आ आकर्षक दिखाई देला। एह अवसर पर [[रामायण]] के अलग-अलग प्रसंगन के मंचन कइल जाला। [[ग्रेगोरियन कैलेंडर|अंग्रेजी कलेंडर]] के अनुसार अक्टूबर महीना में मनावल जाए वाला [[बिजयदसिमी|दशहरा उत्सव]] के हिस्सा के रूप में रामायण पर आधारित एगो भव्य झाँकी आ जलूस निकालल जाला। एह दौरान राक्षस राजा रावण, उनकर भाई-बंधु आ सहयोगियन के पुतला दहन कइल जाला, जवन बुराई पर अच्छाई के विजय के प्रतीक मानल जाला। उत्सव में राजपरिवार के पुरान आ बहुमूल्य वस्तुन के प्रदर्शनी आ झाँकी शामिल रहेला।<ref name=Fort/> काशी नरेश आजुओ अपना पारिवारिक परंपरा के निभावत बाड़ें। ऊ किला के पीछे के सड़कन पर आयोजित होखे वाला सालाना रामलीला महोत्सव में सजावल गइल हाथी पर सवार होके जुलूस के अगुवाई करेलन।<ref name="Limited2003"/> पुरान समय में एह नाटक के मंचन स्थानीय सैनिक टुकड़ी द्वारा कइल जात रहे आ पूरा महीना तक चले वाला एह उत्सव में रामायण के कथा के पाठ भी कइल जाव।<ref name= "Heitzman2004">{{cite book|last= Heitzman |first= James |title= The City in South Asia|url=https://books.google.com/books?id=c2p0kqUqfQ4C&pg=PA54|publisher= Psychology Press |year=2008|isbn=9780415343558|page=54}}</ref><ref name= Dance/> किला में दूसर धार्मिक आ सांस्कृतिक उत्सवो आयोजित होलें। [[माघ]] (जनवरी–फरवरी) महीना में वेद व्यास मंदिर के सामने मेला लागेला, जहाँ भारी संख्या में श्रद्धालु रामनगर आवेलन। [[फागुन]] (फरवरी–मार्च) महीना में राज मंगल नाम के उत्सव मनावल जाला। एह अवसर पर लोगन से भरल नावन के जलूस निकले ला, एह में गीत-संगीत आ नृत्य के कार्यक्रम होखेला। ई नाव यात्रा [[अस्सी घाट]] से शुरू होके गंगा नदी के रास्ता रामनगर किला के सोझा से गुजरे ला।<ref name= Dance>{{Cite web|url=http://www.bl.uk/onlinegallery/onlineex/apac/other/019xzz000007513u00004000.html|title=Ram Leela Mela. As performed before at Ram Nugur before the Raja of Benares.|access-date=7 November 2012|publisher=Online Gallery of British Library|archive-date=5 March 2016|archive-url=https://web.archive.org/web/20160305013402/http://www.bl.uk/onlinegallery/onlineex/apac/other/019xzz000007513u00004000.html|url-status=dead}}</ref> == पॉपुलर संस्कृति में == गंगा नदी के किनारा पर स्थित सुंदर स्थान के कारण रामनगर किला आ महल के फिल्मन के बाहरी शूटिंग लोकेशन के रूप में अक्सर इस्तेमाल कइल गइल बा। ''[[बनारस]]'' एहिजा शूट कइल गइल लोकप्रिय फिल्मन में से एगो हवे।<ref name="Mitra 2002"/><ref name= Ram/> एह जगह के इस्तेमाल रियलिटी टेलीविजन कार्यक्रम ''द अमेजिंग रेस 18'' के सातवाँ पड़ाव (पिट स्टॉप) के रूप में भी कइल गइल रहे। == संदर्भ == {{Reflist|29em}} == बाहरी कड़ी == {{Commons category|Ramnagar Fort}} *[https://ich.unesco.org/en/RL/ramlila-the-traditional-performance-of-the-ramayana-00110 Ramlila, the traditional performance of the Ramayana - UNESCO Intangible Cultural Heritage] *[https://www.bbc.com/hindi/india-37601049 अलग है रामनगर की 233 साल पुरानी रामलीला - BBC Hindi] {{बनारस}} [[श्रेणी:बनारस]] [[श्रेणी:भारत के किला]] qa5mgbattgqk7xu1e55i332yltqtg0h डोपामाइन 0 100974 796606 2026-06-06T00:18:08Z SM7 3953 नया आधार लेख 796606 wikitext text/x-wiki '''डोपामाइन''' (DA) एगो [[न्यूरोमॉड्यूलेटरी]] [[मॉलिक्यूल]] हवे, जे [[कोशिका]] सभ में कई महत्त्वपूर्ण भूमिका निभावेला। ई कैटेकोलामाइन आ फेनेथाइलामाइन परिवार के एगो [[कार्बनिक रसायन]] हवे। डोपामाइन के निर्माण एकर पूर्ववर्ती रसायन एल-डोपा (L-DOPA) से होला, जवना से एगो कार्बोक्सिल समूह हट जाये पर ई बने ला। एल-डोपा के निर्माण मुख्य रूप से [[दिमाग]] आ [[किडनी]] में होखेला। मनुष्य के अलावे, डोपामाइन के निर्माण पेड़-पौधा सभ में आ अधिकतर जानवरन में भी होखे ला। दिमाग में डोपामाइन एगो [[न्यूरोट्रांसमीटर]] के रूप में काम करेला। ई अइसन रासायनिक पदार्थ हवे जे न्यूरॉन (तंत्रिका कोशिका) द्वारा छोड़ल जाला ताकि दूसर तंत्रिका कोशिकन तक संकेत पहुँचा सकल जाव। दिमाग में डोपामाइन से जुड़ल कई अलग-अलग मार्ग (पाथवे) मौजूद बाड़ें। एहमें से एगो मार्ग इनाम भा पुरस्कार से प्रेरित व्यवहार (रिवॉर्ड-मोटिवेटेड बिहेवियर) के प्रेरणा वाला हिस्सा में महत्त्वपूर्ण भूमिका निभावेला। अधिकतर तरह के इनाम के उम्मीद दिमाग में डोपामाइन के लेवल बढ़ा देला, आ कई नशा पैदा करे वाली दवाई सभ डोपामाइन के स्राव बढ़ा देलीं भा एकरा के छोड़ला के बाद न्यूरॉन में वापस जाए (रीअपटेक) के प्रक्रिया के रोक देलीं। डोपामाइन से जुड़ल दूसर पाथवे शरीर के भौतिक गतिविधि ([[मोटर कंट्रोल]]) के नियंत्रित करे आ कई तरह के [[हार्मोनन]] के स्राव के कंट्रोल करे में भूमिका निभावे ला। एह तरह डोपामाइन से जुड़ल पाथवे आ कोशिका समूह मिल के एगो डोपामाइन सिस्टम बनावेलें, जवन न्यूरोमॉड्यूलेटरी काम करेला। पॉपुलर कल्चर आ मीडिया में डोपामाइन के अक्सर आनंद भा खुशी देवे वाला मुख्य रसायन के रूप में देखावल जाला। हालाँकि, [[फार्माकोलॉजी]] में वर्तमान समझ एहसे कुछ अलग बा। अब मानल जाला कि डोपामाइन के मुख्य काम सीधे आनंद पैदा कइल ना, बल्कि प्रेरणात्मक महत्त्व (मोटिवेशनल सैलियन्स) प्रदान कइल बा। दूसर शब्दन में, डोपामाइन कवनो परिणाम भा घटना के महत्त्व, आकर्षण भा अप्रियता के संकेत देला। ई बतावेला कि कवनो चीज कतना वांछनीय भा अवांछनीय बा। एह संकेत के आधार पर जीव के व्यवहार प्रभावित होखेला, आ ऊ ओह परिणाम के हासिल करे खातिर ओकरा ओर बढ़ेला, भा ओकरा से बचे खातिर दूर हटेला। एह तरह डोपामाइन के संबंध केवल सुख के अनुभूति से ना, बल्कि प्रेरणा, इच्छा आ लक्ष्य के ओर बढ़े वाला बेहवार से भी जुड़ल बा। j3q93f92x9nfc5awk4xvmavmvfrt1i3 बनारस हिंदू यूनिवर्सिटी 0 100975 796608 2026-06-06T00:26:26Z SM7 3953 पन्ना [[बनारस हिंदू विश्वविद्यालय]] पर अनुप्रेषित कइल गइल 796608 wikitext text/x-wiki #REDIRECT [[बनारस हिंदू विश्वविद्यालय]] cm6gxz4gg38mvjmnoasyr0fde2z42ft 796609 796608 2026-06-06T00:26:41Z SM7 3953 Added {{[[:Template:R from alternative name|R from alternative name]]}} tag to redirect 796609 wikitext text/x-wiki #REDIRECT [[बनारस हिंदू विश्वविद्यालय]] {{Redirect category shell| {{R from alternative name}} }} d86ceal68enj86zwc4ji5cdn73tn8y0 बीएचयू 0 100976 796610 2026-06-06T00:35:06Z SM7 3953 पन्ना [[बनारस हिंदू विश्वविद्यालय]] पर अनुप्रेषित कइल गइल 796610 wikitext text/x-wiki #REDIRECT [[बनारस हिंदू विश्वविद्यालय]] cm6gxz4gg38mvjmnoasyr0fde2z42ft 796611 796610 2026-06-06T00:35:46Z SM7 3953 Added {{[[:Template:R from initialism|R from initialism]]}} tag to redirect 796611 wikitext text/x-wiki #REDIRECT [[बनारस हिंदू विश्वविद्यालय]] {{Redirect category shell| {{R from initialism}} }} t0tc65mhxhrwvj694emawfhoo1lbrie श्रेणी:CS1 errors: generic name 14 100977 796618 2026-06-06T01:32:07Z SM7 3953 पन्ना बनावल गइल "{{polluted category}} {{Tracking category}} {{empty category}} [[श्रेणी:CS1 खराबी|G]]" के साथ 796618 wikitext text/x-wiki {{polluted category}} {{Tracking category}} {{empty category}} [[श्रेणी:CS1 खराबी|G]] 5ei6dgifqv033sa5xxbfqoxx1llhvey टेम्पलेट:In lang/doc 10 100978 796624 2019-08-06T13:54:36Z en>Trappist the monk 0 create; 796624 wikitext text/x-wiki {{Documentation subpage}} {{lua|module:lang|module:lang/utilities}} This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|xx}}>) plus several named parameters: :<code><nowiki>{{in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|...|link=|cap=}}</nowiki></code> ===Parameters=== *<code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: **<code><nowiki>{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}}</nowiki></code> → ***{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}} *<code>link</code> – accepts the single value <code>yes</code>; creates link to language article **{{tld|in lang|nv|link=yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} *<code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: **{{tld|in lang|pt-BR|cap=yes}} → {{in lang|pt-BR|cap=yes}} ===Categories=== Transclusions in mainspace articles will add the article to 'Category:Articles with &lt;{{var|language name}}>-language sources' where &lt;{{var|language name}}> is the name of the language used in the rendering. This differs from the categories added by the {{tld|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> oddreretktngk85ls5fuza2so6wwrdn 796625 796624 2019-08-15T18:08:31Z 50.53.21.2 /* Usage */ 796625 wikitext text/x-wiki {{Documentation subpage}} {{lua|module:lang|module:lang/utilities}} This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|xx}}>) plus several named parameters: :<code><nowiki>{{in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|...|link=|cap=}}</nowiki></code> :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== *<code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: **<code><nowiki>{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}}</nowiki></code> → ***{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}} *<code>link</code> – accepts the single value <code>yes</code>; creates link to language article **{{tlc|in lang|nv|link=yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} *<code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: **{{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Categories=== Transclusions in mainspace articles will add the article to 'Category:Articles with &lt;{{var|language name}}>-language sources' where &lt;{{var|language name}}> is the name of the language used in the rendering. This differs from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> fuf54n65rrcsu54fpiuceofsf46wtby 796626 796625 2019-08-15T18:10:12Z 50.53.21.2 /* Usage */ 796626 wikitext text/x-wiki {{Documentation subpage}} {{lua|module:lang|module:lang/utilities}} This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|xx}}>) plus several named parameters: :<code><nowiki>{{in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|...|link=|cap=}}</nowiki></code> :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== *<code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: **<code><nowiki>{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}}</nowiki></code> → ***{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}} *<code>link</code> – accepts the single value <code>yes</code>; creates link to language article **{{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} *<code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: **{{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Categories=== Transclusions in mainspace articles will add the article to 'Category:Articles with &lt;{{var|language name}}>-language sources' where &lt;{{var|language name}}> is the name of the language used in the rendering. This differs from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> bpeaqo24ga4vezl7crmo8u0h6lke7s3 796627 796626 2019-08-15T18:13:54Z 50.53.21.2 /* See also */ 796627 wikitext text/x-wiki {{Documentation subpage}} {{lua|module:lang|module:lang/utilities}} This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|xx}}>) plus several named parameters: :<code><nowiki>{{in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|...|link=|cap=}}</nowiki></code> :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== *<code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: **<code><nowiki>{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}}</nowiki></code> → ***{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}} *<code>link</code> – accepts the single value <code>yes</code>; creates link to language article **{{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} *<code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: **{{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Categories=== Transclusions in mainspace articles will add the article to 'Category:Articles with &lt;{{var|language name}}>-language sources' where &lt;{{var|language name}}> is the name of the language used in the rendering. This differs from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ===See also=== *{{tl|Link language}} <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> do55a50jahsktxeapi4exudmpla17bf 796628 796627 2019-08-15T18:18:41Z 50.53.21.2 /* Usage */ 796628 wikitext text/x-wiki {{Documentation subpage}} {{lua|module:lang|module:lang/utilities}} This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|xx}}>) plus several named parameters: :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== *<code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: **<code><nowiki>{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}}</nowiki></code> → ***{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}} *<code>link</code> – accepts the single value <code>yes</code>; creates link to language article **{{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} *<code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: **{{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Categories=== Transclusions in mainspace articles will add the article to 'Category:Articles with &lt;{{var|language name}}>-language sources' where &lt;{{var|language name}}> is the name of the language used in the rendering. This differs from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ===See also=== *{{tl|Link language}} <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> orflq3ruhzqsa87ml297yynnnf5adue 796629 796628 2019-12-05T12:54:03Z en>Trappist the monk 0 /* Categories */ ce; 796629 wikitext text/x-wiki {{Documentation subpage}} {{lua|module:lang|module:lang/utilities}} This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|xx}}>) plus several named parameters: :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== *<code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: **<code><nowiki>{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}}</nowiki></code> → ***{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}} *<code>link</code> – accepts the single value <code>yes</code>; creates link to language article **{{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} *<code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: **{{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. These categories differ from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ==References== {{reflist}} ===See also=== *{{tl|Link language}} <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> hqbea427ihu7808gads3067uof5fcwf 796630 796629 2019-12-05T12:56:06Z en>Trappist the monk 0 ce; 796630 wikitext text/x-wiki {{Documentation subpage}} {{lua|module:lang|module:lang/utilities}} This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|xx}}>) plus several named parameters: :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== *<code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: **<code><nowiki>{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}}</nowiki></code> → ***{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}} *<code>link</code> – accepts the single value <code>yes</code>; creates link to language article **{{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} *<code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: **{{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. These categories differ from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ==See also== *{{tl|Link language}} ==References== {{reflist}} <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> a5nqa3ky6d7iyzmzt9b40o6iq9o8e0g 796631 796630 2019-12-05T13:46:53Z en>Trappist the monk 0 ce; 796631 wikitext text/x-wiki {{Documentation subpage}} {{lua|module:lang|module:lang/utilities}} This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|xx}}>) plus several named parameters: :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== *<code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: **<code><nowiki>{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}}</nowiki></code> → ***{{in lang|cs|en|de|fr|es|it|pl|ru|ja|zh}} *<code>link</code> – accepts the single value <code>yes</code>; creates link to language article **{{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} *<code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: **{{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{</nowiki>in lang}} missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. These categories differ from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ==See also== *{{tl|Link language}} ==References== {{reflist}} <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> 9og4csz9lihn4xcgto79lqldfg42uwh 796632 796631 2019-12-05T20:05:25Z en>Trappist the monk 0 /* Usage */ ce; 796632 wikitext text/x-wiki {{Documentation subpage}} {{lua|module:lang|module:lang/utilities}} This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== *<code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: **<code><nowiki>{{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → ***{{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} *<code>link</code> – accepts the single value <code>yes</code>; creates link to language article **{{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} *<code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: **{{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{</nowiki>in lang}} missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. These categories differ from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ==See also== *{{tl|Link language}} ==References== {{reflist}} <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> cwvw1l3g7zw2pbyn15n1y43pkac36x1 796633 796632 2019-12-29T14:55:07Z en>Gonnym 0 796633 wikitext text/x-wiki {{Documentation subpage}} {{lua|Module:Lang|Module:Lang/utilities}} This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== *<code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: **<code><nowiki>{{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → ***{{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} *<code>link</code> – accepts the single value <code>yes</code>; creates link to language article **{{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} *<code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: **{{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{</nowiki>in lang}} missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. These categories differ from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ==See also== *{{tl|Link language}} ==References== {{reflist}} <includeonly>{{sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> johrchim6onijwt1evz3v59bfuv2nxu 796634 796633 2020-01-19T16:41:15Z en>Gonnym 0 copied text about the citation templates and lang from [[Template:Link language]] 796634 wikitext text/x-wiki {{Documentation subpage}} {{lua|Module:Lang|Module:Lang/utilities}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations, the {{Para|language}} parameter of the various citation templates ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.) should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. This template replaces the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} == Usage == The template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== * <code>&lt;{{var|code}}></code> – required where <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: ** <code><nowiki>{{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → *** {{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes first letter in the rendering: ** {{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{</nowiki>in lang}} missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. These categories differ from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ==See also== * {{tl|Link language}} ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> hru971m4jx0217h6b2q53uztwlbtjac 796635 796634 2020-01-24T06:44:22Z en>A876 0 minor wordings. split some paragraphs. 796635 wikitext text/x-wiki {{Documentation subpage}} {{lua|Module:Lang|Module:Lang/utilities}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. This template ''replaces'' the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} ==Usage== This template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== * <code>&lt;{{var|code}}></code> – required; <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: ** <code><nowiki>{{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → ::: {{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{in lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. These categories differ from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ==See also== * {{tl|Link language}} ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> 4gpsecsj53cb3dx01mll5egq9br13yl 796636 796635 2020-01-31T11:24:04Z en>Gonnym 0 796636 wikitext text/x-wiki {{Documentation subpage}} {{Lua|Module:Lang/utilities}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. This template ''replaces'' the many {{tld|&lt;{{var|xx}}> icon}} templates with a single parameterized template as a result of this [[Wikipedia:Templates for discussion/Log/2019 July 5#Link language wrappers|TfD]]; cf.: :{{tlx|de icon}} → {{de icon}} :{{tld|in lang|de}} → {{in lang|de}} ==Usage== This template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: :{{tlc|in lang|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} ===Parameters=== * <code>&lt;{{var|code}}></code> – required; <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: ** <code><nowiki>{{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → ::: {{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{in lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. These categories differ from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ==See also== * {{tl|Link language}} ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly> q5tjs6um82pj16d7el4y8hvm4dze8s1 796637 796636 2020-03-09T19:14:07Z en>Gonnym 0 removed being deleted templates; added category and moved example to usage section 796637 wikitext text/x-wiki {{Documentation subpage}} {{Lua|Module:Lang/utilities}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. ==Usage== This template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: * Code: {{Tlx|{{BASEPAGENAME}}|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} * Produces: {{tld|{{BASEPAGENAME}}|de}} → {{In lang|de}} ===Parameters=== * <code>&lt;{{var|code}}></code> – required; <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: ** <code><nowiki>{{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → ::: {{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{in lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. These categories differ from the categories added by the {{tlc|&lt;{{var|xx}}> icon}} templates because not all uses of this template will be related to external links. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] }}</includeonly> ct61nzm9zz9lg6vaggc6rwla43d3n6o 796638 796637 2020-05-03T23:16:35Z en>Gonnym 0 /* Categories */No more xx-icon templates. 796638 wikitext text/x-wiki {{Documentation subpage}} {{Lua|Module:Lang/utilities}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. ==Usage== This template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: * Code: {{Tlx|{{BASEPAGENAME}}|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} * Produces: {{tld|{{BASEPAGENAME}}|de}} → {{In lang|de}} ===Parameters=== * <code>&lt;{{var|code}}></code> – required; <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: ** <code><nowiki>{{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → ::: {{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{in lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] }}</includeonly> ryhdwnsmhg5ed9ovgs82d8gc4srjj50 796639 796638 2020-07-13T23:38:24Z en>Funandtrvl 0 add category 796639 wikitext text/x-wiki {{Documentation subpage}} {{Lua|Module:Lang/utilities}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. ==Usage== This template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: * Code: {{Tlx|{{BASEPAGENAME}}|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} * Produces: {{tld|{{BASEPAGENAME}}|de}} → {{In lang|de}} ===Parameters=== * <code>&lt;{{var|code}}></code> – required; <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: ** <code><nowiki>{{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → ::: {{in lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|in lang|nv|link{{=}}yes}} → {{code |lang=moin|{{in lang|nv|link=yes}}}} → {{in lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|in lang|pt-BR|cap{{=}}yes}} → {{in lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{in lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] }}</includeonly> spab5iq9xjaoaymr8iufsw8zyg3xyih 796640 796639 2020-09-19T16:48:05Z en>Gonnym 0 lua usage fix 796640 wikitext text/x-wiki {{Documentation subpage}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. ==Usage== This template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: * Code: {{Tlx|{{BASEPAGENAME}}|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} * Produces: {{tld|{{BASEPAGENAME}}|de}} → {{In lang|de}} ===Parameters=== * <code>&lt;{{var|code}}></code> – required; <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: ** <code><nowiki>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → ::: {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=moin|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] }}</includeonly> idnvbyltt86w2139jr563naazqnjdx8 796641 796640 2020-10-03T16:32:11Z en>Gonnym 0 added {{High-use}} 796641 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. ==Usage== This template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: * Code: {{Tlx|{{BASEPAGENAME}}|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} * Produces: {{tld|{{BASEPAGENAME}}|de}} → {{In lang|de}} ===Parameters=== * <code>&lt;{{var|code}}></code> – required; <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: ** <code><nowiki>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → ::: {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=moin|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] }}</includeonly> blbkr2b4ou7oe3vc0walatar8p5j457 796642 796641 2020-10-28T20:12:47Z en>DePiep 0 796642 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. ==Usage== This template accepts one or more positional language-code parameters (&lt;{{var|code}}>) and two named parameters: * Code: {{Tlx|{{BASEPAGENAME}}|&lt;{{var|code}}>|&lt;{{var|code2}}>|{{var|...}}|link{{=}}|cap{{=}}}} * Produces: {{tld|{{BASEPAGENAME}}|de}} → {{In lang|de}} ===Parameters=== * <code>&lt;{{var|code}}></code> – required; <code>&lt;{{var|code}}></code> is a valid [[ISO-639]] language code or a valid [[IETF language tag]]; more than one language code supported: ** <code><nowiki>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → ::: {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=moin|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="font-size:100%; font-style:normal;" class="error">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language code or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|code}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|code}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|code}}> is the ISO 639 code or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] [[Category:Language tag handling templates]] }}</includeonly> nj1ebfe7xwqeklguyxuv7ytz3xy7atv 796643 796642 2022-10-29T13:57:45Z en>Trappist the monk 0 /* Usage */ ce; 796643 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. ==Usage== Typical use of this template is inside {{tag|ref}} tags where the reference is not templated and the referenced source is non-English: :<code><nowiki><ref>[https://www.example.com "Non English Journal Article"]. ''Non-English Journal''. '''12'''(3): 231–241 {{in lang|xx}}</ref></nowiki></code> Also finds use in External links sections to mark non-English link-targets: :<code><nowiki>[https://www.example.com Non English external link] {{in lang|xx}}</nowiki></code> This template does not markup non-English text. For that, use {{tlx|lang}} or an appropriate {{tld|lang-??}} template. ===Parameters=== This template accepts one or more positional language-tag parameters (<code>&lt;{{var|tag}}></code>) and two named parameters: *{{tld|In lang|&lt;{{var|tag}}>|&lt;{{var|tag2}}>|{{var|...}}|link{{=}}|cap{{=}}}} Most common use is a single language: *{{tld|In lang|de}} → {{In lang|de}} The positional parameters * <code>&lt;{{var|tag}}></code> – required; <code>&lt;{{var|tag}}></code> is a valid [[ISO-639]] language tag or a valid [[IETF language tag]]; more than one language tag supported: ** <code><nowiki>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → *** {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} The named parameters are: * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=moin|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="color:#d33">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language tag or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|tag}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with &lt;{{var|collective name}}> languages-collective sources (&lt;{{var|tag}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|tag}}> is the ISO 639 tag or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] [[Category:Language tag handling templates]] }}</includeonly> 4tthr8e05nodjeq0fdzwmmq8tecvllv 796644 796643 2022-10-29T15:30:59Z en>Trappist the monk 0 /* Categories */ ce; 796644 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. ==Usage== Typical use of this template is inside {{tag|ref}} tags where the reference is not templated and the referenced source is non-English: :<code><nowiki><ref>[https://www.example.com "Non English Journal Article"]. ''Non-English Journal''. '''12'''(3): 231–241 {{in lang|xx}}</ref></nowiki></code> Also finds use in External links sections to mark non-English link-targets: :<code><nowiki>[https://www.example.com Non English external link] {{in lang|xx}}</nowiki></code> This template does not markup non-English text. For that, use {{tlx|lang}} or an appropriate {{tld|lang-??}} template. ===Parameters=== This template accepts one or more positional language-tag parameters (<code>&lt;{{var|tag}}></code>) and two named parameters: *{{tld|In lang|&lt;{{var|tag}}>|&lt;{{var|tag2}}>|{{var|...}}|link{{=}}|cap{{=}}}} Most common use is a single language: *{{tld|In lang|de}} → {{In lang|de}} The positional parameters * <code>&lt;{{var|tag}}></code> – required; <code>&lt;{{var|tag}}></code> is a valid [[ISO-639]] language tag or a valid [[IETF language tag]]; more than one language tag supported: ** <code><nowiki>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → *** {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} The named parameters are: * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=moin|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="color:#d33">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language tag or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|tag}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with sources in &lt;{{var|collective name}}> languages (&lt;{{var|tag}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|tag}}> is the ISO 639 tag or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] [[Category:Language tag handling templates]] }}</includeonly> 29tvqy2w9llhl78xde0naie4ff3y69m 796645 796644 2023-03-27T02:09:16Z en>SWinxy 0 add templatedata 796645 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. ==Usage== Typical use of this template is inside {{tag|ref}} tags where the reference is not templated and the referenced source is non-English: :<code><nowiki><ref>[https://www.example.com "Non English Journal Article"]. ''Non-English Journal''. '''12'''(3): 231–241 {{in lang|xx}}</ref></nowiki></code> Also finds use in External links sections to mark non-English link-targets: :<code><nowiki>[https://www.example.com Non English external link] {{in lang|xx}}</nowiki></code> This template does not markup non-English text. For that, use {{tlx|lang}} or an appropriate {{tld|lang-??}} template. ===Parameters=== This template accepts one or more positional language-tag parameters (<code>&lt;{{var|tag}}></code>) and two named parameters: *{{tld|In lang|&lt;{{var|tag}}>|&lt;{{var|tag2}}>|{{var|...}}|link{{=}}|cap{{=}}}} Most common use is a single language: *{{tld|In lang|de}} → {{In lang|de}} The positional parameters * <code>&lt;{{var|tag}}></code> – required; <code>&lt;{{var|tag}}></code> is a valid [[ISO-639]] language tag or a valid [[IETF language tag]]; more than one language tag supported: ** <code><nowiki>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → *** {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} The named parameters are: * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=moin|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="color:#d33">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language tag or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ==TemplateData== {{TemplateData header}} <templatedata>{ "params": { "1": {}, "2": {}, "3": {}, "4": {} }, "description": "Produces the phrase \"(in LANGUAGE)\" with language codes.", "format": "inline" }</templatedata> ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|tag}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with sources in &lt;{{var|collective name}}> languages (&lt;{{var|tag}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|tag}}> is the ISO 639 tag or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] [[Category:Language tag handling templates]] }}</includeonly> g8jsqnst1qppl88uhzqap6avu0nqqtf 796646 796645 2023-06-26T10:55:47Z en>DocWatson42 0 Added a period. 796646 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template ({{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or one of the {{tld|[[:Category:Lang-x templates|lang-x]]}} templates ({{tlx|lang-fr}}, {{tlx|lang-ast}}, etc.) should be used instead. ==Usage== Typical use of this template is inside {{tag|ref}} tags where the reference is not templated and the referenced source is non-English: :<code><nowiki><ref>[https://www.example.com "Non English Journal Article"]. ''Non-English Journal''. '''12'''(3): 231–241 {{in lang|xx}}.</ref></nowiki></code> Also finds use in External links sections to mark non-English link-targets: :<code><nowiki>[https://www.example.com Non English external link] {{in lang|xx}}</nowiki></code> This template does not markup non-English text. For that, use {{tlx|lang}} or an appropriate {{tld|lang-??}} template. ===Parameters=== This template accepts one or more positional language-tag parameters (<code>&lt;{{var|tag}}></code>) and two named parameters: *{{tld|In lang|&lt;{{var|tag}}>|&lt;{{var|tag2}}>|{{var|...}}|link{{=}}|cap{{=}}}} Most common use is a single language: *{{tld|In lang|de}} → {{In lang|de}} The positional parameters * <code>&lt;{{var|tag}}></code> – required; <code>&lt;{{var|tag}}></code> is a valid [[ISO-639]] language tag or a valid [[IETF language tag]]; more than one language tag supported: ** <code><nowiki>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → *** {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} The named parameters are: * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=moin|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="color:#d33">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language tag or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ==TemplateData== {{TemplateData header}} <templatedata>{ "params": { "1": {}, "2": {}, "3": {}, "4": {} }, "description": "Produces the phrase \"(in LANGUAGE)\" with language codes.", "format": "inline" }</templatedata> ===Categories=== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|tag}}>) – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :Category:Articles with sources in &lt;{{var|collective name}}> languages (&lt;{{var|tag}}>) – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|tag}}> is the ISO 639 tag or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] [[Category:Language tag handling templates]] }}</includeonly> p7iwqokmahfjtbl7yfachsm6snqj5f0 796647 796646 2024-11-10T19:46:46Z en>Gonnym 0 cleanup 796647 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template (such as {{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or {{tlx|langx}}, should be used instead. ==Usage== Typical use of this template is inside {{tag|ref}} tags where the reference is not templated and the referenced source is non-English: :<code><nowiki><ref>[https://www.example.com "Non English Journal Article"]. ''Non-English Journal''. '''12'''(3): 231–241 {{in lang|xx}}.</ref></nowiki></code> Also finds use in External links sections to mark non-English link-targets: :<code><nowiki>[https://www.example.com Non English external link] {{in lang|xx}}</nowiki></code> This template does not markup non-English text. For that, use {{tlx|lang}} or an appropriate {{tld|lang-??}} template. ===Parameters=== This template accepts one or more positional language-tag parameters (<code>&lt;{{var|tag}}></code>) and two named parameters: *{{tld|In lang|&lt;{{var|tag}}>|&lt;{{var|tag2}}>|{{var|...}}|link{{=}}|cap{{=}}}} Most common use is a single language: *{{tld|In lang|de}} → {{In lang|de}} The positional parameters * <code>&lt;{{var|tag}}></code> – required; <code>&lt;{{var|tag}}></code> is a valid [[ISO-639]] language tag or a valid [[IETF language tag]]; more than one language tag supported: ** <code><nowiki>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</nowiki></code> → *** {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} The named parameters are: * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=moin|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="color:#d33">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language tag or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ==TemplateData== {{TemplateData header}} <templatedata>{ "params": { "1": {}, "2": {}, "3": {}, "4": {} }, "description": "Produces the phrase \"(in LANGUAGE)\" with language codes.", "format": "inline" }</templatedata> ==Tracking categories== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :<code>Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|tag}}>)</code> – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :<code>Category:Articles with sources in &lt;{{var|collective name}}> languages (&lt;{{var|tag}}>)</code> – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|tag}}> is the ISO 639 tag or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] [[Category:Language tag handling templates]] }}</includeonly> bvxj53vliklfpany9gwl29yvla2dw2s 796648 796647 2025-02-04T01:19:23Z en>Cedar101 0 /* Usage */ syntaxhighlight 796648 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template (such as {{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or {{tlx|langx}}, should be used instead. ==Usage== Typical use of this template is inside {{tag|ref}} tags where the reference is not templated and the referenced source is non-English: :<syntaxhighlight lang="wikitext" inline><ref>[https://www.example.com "Non English Journal Article"]. ''Non-English Journal''. '''12'''(3): 231–241 {{in lang|xx}}.</ref></syntaxhighlight> Also finds use in External links sections to mark non-English link-targets: :<syntaxhighlight lang="wikitext" inline>[https://www.example.com Non English external link] {{in lang|xx}}</syntaxhighlight> This template does not markup non-English text. For that, use {{tlx|lang}} or an appropriate {{tld|lang-??}} template. ===Parameters=== This template accepts one or more positional language-tag parameters (<code>&lt;{{var|tag}}></code>) and two named parameters: *{{tld|In lang|&lt;{{var|tag}}>|&lt;{{var|tag2}}>|{{var|...}}|link{{=}}|cap{{=}}}} Most common use is a single language: *{{tld|In lang|de}} → {{In lang|de}} The positional parameters * <code>&lt;{{var|tag}}></code> – required; <code>&lt;{{var|tag}}></code> is a valid [[ISO-639]] language tag or a valid [[IETF language tag]]; more than one language tag supported: ** <syntaxhighlight lang="wikitext" inline>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</syntaxhighlight> → *** {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} The named parameters are: * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=wikitext|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="color:#d33">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language tag or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ==TemplateData== {{TemplateData header}} <templatedata>{ "params": { "1": {}, "2": {}, "3": {}, "4": {} }, "description": "Produces the phrase \"(in LANGUAGE)\" with language codes.", "format": "inline" }</templatedata> ==Tracking categories== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :<code>Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|tag}}>)</code> – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :<code>Category:Articles with sources in &lt;{{var|collective name}}> languages (&lt;{{var|tag}}>)</code> – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|tag}}> is the ISO 639 tag or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] [[Category:Language tag handling templates]] }}</includeonly> 6nzy6m9wp6omin719qvxdcxz7espt9h 796649 796648 2025-02-04T02:27:21Z en>MJL 0 /* Usage */ {{langx}} now 796649 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template (such as {{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or {{tlx|langx}}, should be used instead. ==Usage== Typical use of this template is inside {{tag|ref}} tags where the reference is not templated and the referenced source is non-English: :<syntaxhighlight lang="wikitext" inline><ref>[https://www.example.com "Non English Journal Article"]. ''Non-English Journal''. '''12'''(3): 231–241 {{in lang|xx}}.</ref></syntaxhighlight> Also finds use in External links sections to mark non-English link-targets: :<syntaxhighlight lang="wikitext" inline>[https://www.example.com Non English external link] {{in lang|xx}}</syntaxhighlight> This template does not markup non-English text. For that, use {{tlx|lang}} or {{tlx|langx}} templates. ===Parameters=== This template accepts one or more positional language-tag parameters (<code>&lt;{{var|tag}}></code>) and two named parameters: *{{tld|In lang|&lt;{{var|tag}}>|&lt;{{var|tag2}}>|{{var|...}}|link{{=}}|cap{{=}}}} Most common use is a single language: *{{tld|In lang|de}} → {{In lang|de}} The positional parameters * <code>&lt;{{var|tag}}></code> – required; <code>&lt;{{var|tag}}></code> is a valid [[ISO-639]] language tag or a valid [[IETF language tag]]; more than one language tag supported: ** <syntaxhighlight lang="wikitext" inline>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</syntaxhighlight> → *** {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} The named parameters are: * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=wikitext|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="color:#d33">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 language tag or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ==TemplateData== {{TemplateData header}} <templatedata>{ "params": { "1": {}, "2": {}, "3": {}, "4": {} }, "description": "Produces the phrase \"(in LANGUAGE)\" with language codes.", "format": "inline" }</templatedata> ==Tracking categories== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :<code>Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|tag}}>)</code> – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :<code>Category:Articles with sources in &lt;{{var|collective name}}> languages (&lt;{{var|tag}}>)</code> – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|tag}}> is the ISO 639 tag or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] [[Category:Language tag handling templates]] }}</includeonly> olhe7xba3288r1xlhh2tuvp039yt5t6 796650 796649 2025-09-14T20:16:16Z en>DocWatson42 0 Made two minor corrections. 796650 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template (such as {{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or {{tlx|langx}}, should be used instead. ==Usage== Typical use of this template is inside {{tag|ref}} tags where the reference is not templated and the referenced source is non-English: :<syntaxhighlight lang="wikitext" inline><ref>[https://www.example.com "Non English Journal Article"]. ''Non-English Journal''. '''12'''(3): 231–241 {{in lang|xx}}.</ref></syntaxhighlight> Also finds use in External links sections to mark non-English link-targets: :<syntaxhighlight lang="wikitext" inline>[https://www.example.com Non English external link] {{in lang|xx}}</syntaxhighlight> This template does not markup non-English text. For that, use {{tlx|lang}} or {{tlx|langx}} templates. ===Parameters=== This template accepts one or more positional language-tag parameters (<code>&lt;{{var|tag}}></code>) and two named parameters: *{{tld|In lang|&lt;{{var|tag}}>|&lt;{{var|tag2}}>|{{var|...}}|link{{=}}|cap{{=}}}} Most common use is a single language: *{{tld|In lang|de}} → {{In lang|de}} The positional parameters * <code>&lt;{{var|tag}}></code> – required; <code>&lt;{{var|tag}}></code> is a valid [[ISO-639]] language tag or a valid [[IETF language tag]]; more than one language tag supported: ** <syntaxhighlight lang="wikitext" inline>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</syntaxhighlight> → *** {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} The named parameters are: * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=wikitext|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="color:#d33">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ==TemplateData== {{TemplateData header}} <templatedata>{ "params": { "1": {}, "2": {}, "3": {}, "4": {} }, "description": "Produces the phrase \"(in LANGUAGE)\" with language codes.", "format": "inline" }</templatedata> ==Tracking categories== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :<code>Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|tag}}>)</code> – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :<code>Category:Articles with sources in &lt;{{var|collective name}}> languages (&lt;{{var|tag}}>)</code> – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|tag}}> is the ISO 639 tag or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] [[Category:Language tag handling templates]] }}</includeonly> 5ate08zb1mwxdscjq48r1jd8wv44u8g 796651 796650 2026-06-06T02:18:42Z SM7 3953 27 revisions imported from [[:en:Template:In_lang/doc]] 796650 wikitext text/x-wiki {{Documentation subpage}} {{High-use}} {{Lua|Module:In lang}} '''Template:In lang''' is used to denote that a text source is written in a specific language. For citations using a citation template (such as {{tlx|cite web}}, {{tlx|cite news}}, {{tlx|cite journal}}, etc.), that template's {{Para|language}} parameter should be used instead. To note a span of text in a different language, {{tlx|lang}} or {{tlx|langx}}, should be used instead. ==Usage== Typical use of this template is inside {{tag|ref}} tags where the reference is not templated and the referenced source is non-English: :<syntaxhighlight lang="wikitext" inline><ref>[https://www.example.com "Non English Journal Article"]. ''Non-English Journal''. '''12'''(3): 231–241 {{in lang|xx}}.</ref></syntaxhighlight> Also finds use in External links sections to mark non-English link-targets: :<syntaxhighlight lang="wikitext" inline>[https://www.example.com Non English external link] {{in lang|xx}}</syntaxhighlight> This template does not markup non-English text. For that, use {{tlx|lang}} or {{tlx|langx}} templates. ===Parameters=== This template accepts one or more positional language-tag parameters (<code>&lt;{{var|tag}}></code>) and two named parameters: *{{tld|In lang|&lt;{{var|tag}}>|&lt;{{var|tag2}}>|{{var|...}}|link{{=}}|cap{{=}}}} Most common use is a single language: *{{tld|In lang|de}} → {{In lang|de}} The positional parameters * <code>&lt;{{var|tag}}></code> – required; <code>&lt;{{var|tag}}></code> is a valid [[ISO-639]] language tag or a valid [[IETF language tag]]; more than one language tag supported: ** <syntaxhighlight lang="wikitext" inline>{{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}</syntaxhighlight> → *** {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}} The named parameters are: * <code>link</code> – accepts the single value <code>yes</code>; creates link to language article ** {{tlc|In lang|nv|link{{=}}yes}} → {{code |lang=wikitext|{{In lang|nv|link=yes}}}} → {{In lang|nv|link=yes}} * <code>cap</code> – accepts the single value <code>yes</code>; capitalizes the first letter of "In": ** {{tlc|In lang|pt-BR|cap{{=}}yes}} → {{In lang|pt-BR|cap=yes}} ===Error messages=== This template has one error message of its own: :<span style="color:#d33">error: <nowiki>{{In lang}}</nowiki> missing language tag</span> – displayed when the template is transcluded without an ISO 639 or IETF language tag. All other error messages related to the use of this template are emitted by [[Module:Lang]] and are documented at {{cl|Lang and lang-xx template errors}}. ==TemplateData== {{TemplateData header}} <templatedata>{ "params": { "1": {}, "2": {}, "3": {}, "4": {} }, "description": "Produces the phrase \"(in LANGUAGE)\" with language codes.", "format": "inline" }</templatedata> ==Tracking categories== Transclusions in mainspace articles will add the article to the appropriate subcategory of {{cl|Articles with non-English-language sources}}. There are two forms of these subcategories: :<code>Category:Articles with &lt;{{var|language name}}>-language sources (&lt;{{var|tag}}>)</code> – for individual languages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Individual%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Individual languages |website=SIL International |access-date=5 December 2019}}</ref> and for macrolanguages<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Macrolanguages |title=ISO 639-3: Scope of denotation for language identifiers: Macrolanguages |website=SIL International |access-date=5 December 2019}}</ref> :<code>Category:Articles with sources in &lt;{{var|collective name}}> languages (&lt;{{var|tag}}>)</code> – for language collectives<ref>{{cite web |url=https://iso639-3.sil.org/about/scope#Collections%20of%20languages |title=ISO 639-3: Scope of denotation for language identifiers: Collections of languages |website=SIL International |access-date=5 December 2019}}</ref> where &lt;{{var|language name}}> and &lt;{{var|collective name}}> is the name used in the template's rendering and &lt;{{var|tag}}> is the ISO 639 tag or IETF language tag. ==References== {{Reflist}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Language templates]] [[Category:Wikipedia multilingual support templates]] [[Category:Language tag handling templates]] }}</includeonly> 5ate08zb1mwxdscjq48r1jd8wv44u8g श्रेणी:लेख जिनहन में अंग्रेजी-भाषा के स्रोत बाटे (en) 14 100979 796665 2026-06-06T02:36:42Z SM7 3953 पन्ना बनावल गइल "{{Non-English-language sources category}}" के साथ 796665 wikitext text/x-wiki {{Non-English-language sources category}} fgrfzsaviwuxts1vkpki5kkum3k33o3 796666 796665 2026-06-06T02:37:09Z SM7 3953 796666 wikitext text/x-wiki {{Non-Bhojpuri-language sources category}} 6co26q4quk3s6kll374dcojr2uyd9v0 टेम्पलेट:Automatic category TOC 10 100980 796731 2019-03-06T20:11:24Z en>BrownHairedGirl 0 [[WP:AES|←]]Created page with '<includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TO...' 796731 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->|<!-- # < 100, so no TOC -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} </noinclude> pydm0j0k2cegz7679s1iyreij7yrscn 796732 796731 2019-03-06T20:55:18Z en>BrownHairedGirl 0 + tracking 796732 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoToc generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoToc generates standard category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoToc generates no TOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} </noinclude> adr208ebx829qsydv0wci5xwqdxfeco 796733 796732 2019-03-06T21:01:30Z en>BrownHairedGirl 0 tweak 796733 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoToc generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoToc generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoToc generates no TOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} </noinclude> l6kg6vdnwry7onoj8jjym0jwxznsklk 796734 796733 2019-03-06T23:32:50Z en>BrownHairedGirl 0 namespace checking 796734 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoToc generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoToc generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoToc generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<-- -->[[Category:Templates using CatAutoToc]] --></includeonly><noinclude> {{Documentation}} </noinclude> ndxpg5gkpn5y6jfm3gr0c8okp8c83qi 796735 796734 2019-03-06T23:33:17Z en>BrownHairedGirl 0 }} 796735 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoToc generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoToc generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoToc generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<-- -->[[Category:Templates using CatAutoToc]] -->}}</includeonly><noinclude> {{Documentation}} </noinclude> hfxq0sjlnsf1fdny17zmfwqsxpm03ji 796736 796735 2019-03-06T23:35:59Z en>BrownHairedGirl 0 fix comments 796736 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoToc generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoToc generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoToc generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->[[Category:Templates using CatAutoToc]]<!-- -->}}</includeonly><noinclude> {{Documentation}} </noinclude> 2hzyn7czoh1chqlyp150f5yxhrj4yak 796737 796736 2019-03-06T23:42:41Z en>BrownHairedGirl 0 [[Category:Wikipedia CatAutoToc]] 796737 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoToc generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoToc generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoToc generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->[[Category:Templates using CatAutoToc]]<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoToc]] </noinclude> 1gr2wsoaawg7ici1gd4qzq2r3f982yn 796738 796737 2019-03-07T18:00:42Z en>MusikBot II 0 Protected "[[Template:CatAutoToc]]": [[Wikipedia:High-risk templates|High-risk template or module]] ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)) 796737 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoToc generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoToc generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoToc generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->[[Category:Templates using CatAutoToc]]<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoToc]] </noinclude> 1gr2wsoaawg7ici1gd4qzq2r3f982yn 796739 796738 2019-03-31T11:40:11Z en>BrownHairedGirl 0 BrownHairedGirl moved page [[Template:CatAutoToc]] to [[Template:CatAutoTOC]] 796737 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoToc generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoToc generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoToc generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->[[Category:Templates using CatAutoToc]]<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoToc]] </noinclude> 1gr2wsoaawg7ici1gd4qzq2r3f982yn 796740 796739 2019-03-31T11:47:26Z en>BrownHairedGirl 0 Moving from [[Category:Wikipedia CatAutoToc]] to [[Category:Wikipedia CatAutoTOC]] using [[c:Help:Cat-a-lot|Cat-a-lot]] 796740 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoToc generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoToc generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoToc generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->[[Category:Templates using CatAutoToc]]<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> bpteesuu1wftji6oohiwk0k0aqvqxiy 796741 796740 2019-03-31T11:51:05Z en>BrownHairedGirl 0 update 796741 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoTOC generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->[[Category:Templates using CatAutoTOC]]<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> o4gijjqp7gnkigq8i9lp4aznteuhz91 796742 796741 2019-10-01T11:55:11Z en>BrownHairedGirl 0 indent 796742 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoTOC generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->[[Category:Templates using CatAutoTOC]]<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> p9hgjblbu3xnlrdjiba6d8mgb902bnm 796743 796742 2019-10-01T13:27:03Z en>BrownHairedGirl 0 blank line above the TOC template, if one used 796743 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC --> <!-- -->{{Large category TOC}}<!-- -->[[Category:CatAutoTOC generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC --> <!-- -->{{Category TOC}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->[[Category:Templates using CatAutoTOC]]<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> tgqpogr5eb05xsldlqpdxc0e4y38qej 796744 796743 2019-10-01T13:30:49Z en>BrownHairedGirl 0 Undid revision 919031377 by [[Special:Contributions/BrownHairedGirl|BrownHairedGirl]] ([[User talk:BrownHairedGirl|talk]]) 796744 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoTOC generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->[[Category:Templates using CatAutoTOC]]<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> p9hgjblbu3xnlrdjiba6d8mgb902bnm 796745 796744 2020-03-14T16:16:29Z en>BrownHairedGirl 0 Don't categorise /doc pages 796745 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoTOC generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}<!-- -->|<!-- ### Don't categorise /doc pages -->|<!-- ### Not a /doc page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 39ehw7r7y4tf8kx26uf9z94t28phxjk 796746 796745 2020-03-14T16:21:56Z en>BrownHairedGirl 0 Don't categorise /doc, /testcases or /sandbox pages 796746 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoTOC generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{PAGESINCATEGORY|{{PAGENAME}}|R}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->}}<!-- -->{{Template other|<!-- -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> kih1hnbz2naossfdymyhbeq1ecropss 796747 796746 2020-03-15T14:34:45Z en>BrownHairedGirl 0 As tested in [[Template:CatAutoTOC/sandbox]]: use a sub-template [[Template:CatAutoTOC/core]], so that we never have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} 796747 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY|{{PAGENAME}}|R}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> ditiiqlc9e9neugc3tnu1tanebqtxb3 796748 796747 2020-03-19T16:17:37Z en>BrownHairedGirl 0 The TOC templates don't help navigate subcats, so count only pages, not subcats: pagecount={{PAGESINCATEGORY:{{PAGENAME}}|pages|R}} 796748 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{PAGENAME}}|pages|R}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 08o6p9kfmdbtu2nnk6cb11lktce6dkx 796749 796748 2020-03-19T16:53:29Z en>BrownHairedGirl 0 Undid revision 946346835 by [[Special:Contributions/BrownHairedGirl|BrownHairedGirl]] ([[User talk:BrownHairedGirl|talk]]) -- Ooops! Large Cat TOC does work on cats 796749 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY|{{PAGENAME}}|R}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> ditiiqlc9e9neugc3tnu1tanebqtxb3 796750 796749 2020-04-07T02:48:23Z en>BrownHairedGirl 0 <= 100 pages = no TOC 796750 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages = no TOC # 101–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY|{{PAGENAME}}|R}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 4d1kyydmh4e7bx7smo7zgz9n52zd7xd 796751 796750 2020-04-07T02:54:47Z en>BrownHairedGirl 0 update thresholds 796751 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY|{{PAGENAME}}|R}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> asmc1xjiqlk4oiy3jhy3htfr9n0uxbl 796752 796751 2020-04-14T16:34:01Z en>BrownHairedGirl 0 pass through the parameters for CatAutoTOC 796752 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY|{{PAGENAME}}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> huc0vqynbmp4scz06ctapw54soc7www 796753 796752 2020-04-19T11:19:13Z en>WOSlinker 0 remove HTML encored text from PAGENAME 796753 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY|{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> j8qxmfk9rk04hvesm5nrvl6usf9felt 796754 796753 2020-04-19T16:13:48Z en>WOSlinker 0 magic word for PAGESINCATEGORY rather than template 796754 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> to6tg86k0y2xm30shk1ulz4uxrz8fnn 796755 796754 2020-09-30T22:54:51Z en>Jonesey95 0 wrap in a div so that there is always a new line after this template 796755 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} --><div>{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</div></includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 1uinetfcxxqjs0fvfo0q4x8xa2vq38s 796756 796755 2020-09-30T22:57:45Z en>Jonesey95 0 Undid revision 981208874 by [[Special:Contributions/Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]). did not work 796756 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> to6tg86k0y2xm30shk1ulz4uxrz8fnn 796757 796756 2023-03-06T09:58:35Z en>Mclay1 0 Mclay1 moved page [[Template:CatAutoTOC]] to [[Template:Auto category TOC]]: clearer name in line with other TOC templates 796756 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> to6tg86k0y2xm30shk1ulz4uxrz8fnn 796758 796757 2023-03-06T10:02:49Z en>Mclay1 0 updating for name change 796758 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:Auto category TOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> ctmfkc1ed4b577a09qvzcfbnqep7wf2 796759 796758 2023-03-14T21:01:33Z en>Gonnym 0 bypass redirect 796759 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:Auto category TOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{Auto category TOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> gvkapwa0yyt89fjpt3q051ll7ovenbp 796760 796759 2023-06-03T16:13:24Z en>BrownHairedGirl 0 BrownHairedGirl moved page [[Template:Auto category TOC]] to [[Template:CatAutoTOC]] over redirect: revert undiscussed [[WP:BOLD]] move. The brief name is easier to use, and distinguishes this meta-template from the templates which do the actual work of generating a TOC. Feel free to open a [[WP:Requested moves]] discussion 796759 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:Auto category TOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{Auto category TOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> gvkapwa0yyt89fjpt3q051ll7ovenbp 796761 796760 2023-06-03T16:22:44Z en>BrownHairedGirl 0 bypass redirect to /core 796761 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> to6tg86k0y2xm30shk1ulz4uxrz8fnn 796762 796761 2023-12-07T16:57:04Z en>Xaosflux 0 Removed protection from "[[Template:CatAutoTOC]]": 500MM+ uses now 796761 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> to6tg86k0y2xm30shk1ulz4uxrz8fnn 796763 796762 2023-12-07T21:19:33Z en>Xaosflux 0 Protected "[[Template:CatAutoTOC]]": [[WP:High-risk templates|High-risk template or module]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite)) 796761 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> to6tg86k0y2xm30shk1ulz4uxrz8fnn 796764 796763 2024-05-06T20:06:46Z en>Robertsky 0 Robertsky moved page [[Template:CatAutoTOC]] to [[Template:Automatic category TOC]] 796761 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia CatAutoTOC]] </noinclude> to6tg86k0y2xm30shk1ulz4uxrz8fnn 796765 796764 2024-05-08T21:48:05Z en>JJMC89 bot III 0 Moving [[:Category:Wikipedia CatAutoTOC]] to [[:Category:Wikipedia Automatic category TOC]] per [[Wikipedia:Categories for discussion/Speedy]] 796765 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ################################################################################# #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:CatAutoTOC/core]], so that we never have #### #### more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ################################################################################# -->{{CatAutoTOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ################################################################################# #### This page is a template, so categorise it #### #### in [[Category:Templates using CatAutoTOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the same template #### ################################################################################# -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using CatAutoTOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia Automatic category TOC]] </noinclude> 2ki9r73f2nhc1qmfuztwgp4rcca8s8s 796766 796765 2024-05-09T21:23:49Z en>MSGJ 0 updates after move, some whitespace tweaks 796766 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ####################################################################### #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:Automatic category TOC/core]], #### #### so that we never have more than one call to the #### #### [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ####################################################################### -->{{Automatic category TOC/core/sandbox<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ####################################################################### #### This page is a template, so categorise it #### #### in [[Category:Templates using Automatic category TOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the #### #### same template #### ####################################################################### -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using Automatic category TOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia Automatic category TOC]] </noinclude> e7almr07m0a6ondeahgke0t7cab5twq 796767 796766 2024-05-12T05:07:09Z en>Pppery 0 Per request 796767 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ####################################################################### #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:Automatic category TOC/core]], #### #### so that we never have more than one call to the #### #### [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ####################################################################### -->{{Automatic category TOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ####################################################################### #### This page is a template, so categorise it #### #### in [[Category:Templates using Automatic category TOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the #### #### same template #### ####################################################################### -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using Automatic category TOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia Automatic category TOC]] </noinclude> fu28obs3bcc3b5jr8a9o17mhaah7p58 796768 796767 2026-06-06T02:43:31Z SM7 3953 37 revisions imported from [[:en:Template:Automatic_category_TOC]] 796767 wikitext text/x-wiki <includeonly><!-- # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} -->{{Category other|<!-- ####################################################################### #### This is a category page, so generate a TOC if needed. #### #### #### #### Use a sub-template [[Template:Automatic category TOC/core]], #### #### so that we never have more than one call to the #### #### [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} #### ####################################################################### -->{{Automatic category TOC/core<!-- -->|pagecount={{PAGESINCATEGORY:{{#invoke:HTMLDecode | HTMLDecode | text={{PAGENAME}} }}|R}}<!-- -->|align = {{{align|}}}<!-- -->|top = {{{top|}}}<!-- -->|numerals = {{{numerals|}}}<!-- -->|uppercase = {{{uppercase|}}}<!-- -->|lowercase = {{{lowercase|}}}<!-- -->}}<!-- -->}}<!-- -->{{Template other<!-- -->|<!-- ####################################################################### #### This page is a template, so categorise it #### #### in [[Category:Templates using Automatic category TOC]] ... #### #### #### #### ... unless it is a /doc, /testcases or /sandbox #### #### #### #### There is no point categorising every sub-page of the #### #### same template #### ####################################################################### -->{{#if: {{Str endswith|{{PAGENAME}}|/doc}}{{Str endswith|{{PAGENAME}}|/testcases}}{{Str endswith|{{PAGENAME}}|/sandbox}}<!-- -->|<!-- ### Don't categorise /doc, /testcases or /sandbox pages -->|<!-- ### Not a /doc, /testcases or /sandbox page, so categorise it -->[[Category:Templates using Automatic category TOC]]<!-- -->}}<!-- -->}}</includeonly><noinclude> {{Documentation}} [[Category:Wikipedia Automatic category TOC]] </noinclude> fu28obs3bcc3b5jr8a9o17mhaah7p58 टेम्पलेट:Automatic category TOC/core 10 100981 796769 2020-03-15T14:17:17Z en>BrownHairedGirl 0 use this sub-template [[Template:CatAutoTOC/core]], so that we never have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} 796769 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoTOC generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} >= 100<!-- -->|<!-- # >= 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC]]<!-- -->}}<!-- -->}}<!-- --></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 2vqao3le2wk9bf69p9g7jkz26mso2ud 796770 796769 2020-03-15T17:59:40Z en>MusikBot II 0 Protected "[[Template:CatAutoTOC/core]]": [[Wikipedia:High-risk templates|High-risk template or module]] ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)) 796769 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC}}<!-- -->[[Category:CatAutoTOC generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} >= 100<!-- -->|<!-- # >= 100, so std TOC -->{{Category TOC}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC]]<!-- -->}}<!-- -->}}<!-- --></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 2vqao3le2wk9bf69p9g7jkz26mso2ud 796771 796770 2020-03-30T20:56:36Z en>BrownHairedGirl 0 add TOC templates as "{{Large category TOC|CatAutoTOC=yes}}" or "{{Category TOC|CatAutoTOC=yes}}" to allow tracking of {{CatAutoTOC}} usage 796771 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} >= 100<!-- -->|<!-- # >= 100, so std TOC -->{{Category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC]]<!-- -->}}<!-- -->}}<!-- --></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> p9mzd13y6f6i8045kofrvxorckgfjj0 796772 796771 2020-04-01T14:50:51Z en>BrownHairedGirl 0 track to [[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero]] 796772 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates Large category TOC]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} >= 100<!-- -->|<!-- # >= 100, so std TOC -->{{Category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero]]<!-- -->}}<!-- --></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> prqdz15nbdcu9q7356zy30mo5xzl8p1 796773 796772 2020-04-06T15:18:08Z en>BrownHairedGirl 0 add the sort key {{PAGENAME}} to all the tracking categories, to override any {{DEFAULTSORT}} used in the category 796773 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # < 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} >= 100<!-- -->|<!-- # >= 100, so std TOC -->{{Category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- --></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 6f52q9n8l2fxn1xs499fqxri4zu0kap 796774 796773 2020-04-07T02:49:32Z en>BrownHairedGirl 0 tweak thresholds: >100, and >1200 796774 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages = no TOC # 100–1200 pages = {{Category TOC}} # > 1200 pages = {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- --></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> ag4tpuj8n5anyjrdkdtzke9cags0l20 796775 796774 2020-04-07T02:55:29Z en>BrownHairedGirl 0 update thresholds 796775 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- --></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> kb3lkmucxlzyijzomvskdv5yuw17gxz 796776 796775 2020-04-14T16:36:12Z en>BrownHairedGirl 0 pass through the parameters for [[Template:Category TOC]] 796776 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC<!-- -->|align = {{#if: {{{align|}}} | {{{align}}} |left}}<!-- -->|top = {{#if: {{{top|}}} | {{{top}}} |yes}}<!-- -->|numerals = {{#if: {{{numerals|}}} | {{{numerals}}} |group}}<!-- -->|uppercase = {{#if: {{{uppercase|}}} | {{{uppercase}}} |yes}}<!-- -->|lowercase = {{#if: {{{lowercase|}}} | {{{lowercase}}} |no}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- --></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 8ncopywyqrzmgjr6wu8l7i3fif7qkl9 796777 796776 2020-04-15T09:49:11Z en>BrownHairedGirl 0 oops! restore "CatAutoTOC=yes" parameter for calls to [[Template:Category TOC]] 796777 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC|CatAutoTOC=yes}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC<!-- -->|CatAutoTOC=yes<!-- -->|align = {{#if: {{{align|}}} | {{{align}}} |left}}<!-- -->|top = {{#if: {{{top|}}} | {{{top}}} |yes}}<!-- -->|numerals = {{#if: {{{numerals|}}} | {{{numerals}}} |group}}<!-- -->|uppercase = {{#if: {{{uppercase|}}} | {{{uppercase}}} |yes}}<!-- -->|lowercase = {{#if: {{{lowercase|}}} | {{{lowercase}}} |no}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- --></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> sip54gh745jk024f72lx77nvkyk6p14 796778 796777 2020-04-19T17:05:45Z en>BrownHairedGirl 0 pass {{{pagecount}}} through to [[Template:Category TOC]] and [[Template:Large category TOC]], to save them making another call to that expensive parser function 796778 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC<!-- -->|CatAutoTOC=yes<!-- -->|pagecount={{{pagecount}}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC<!-- -->|pagecount={{{pagecount}}}<!-- -->|CatAutoTOC=yes<!-- -->|align = {{#if: {{{align|}}} | {{{align}}} |left}}<!-- -->|top = {{#if: {{{top|}}} | {{{top}}} |yes}}<!-- -->|numerals = {{#if: {{{numerals|}}} | {{{numerals}}} |group}}<!-- -->|uppercase = {{#if: {{{uppercase|}}} | {{{uppercase}}} |yes}}<!-- -->|lowercase = {{#if: {{{lowercase|}}} | {{{lowercase}}} |no}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- --></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> jnmzzzt0m4hyjl786x3cwu9te3c25zi 796779 796778 2020-09-30T23:00:04Z en>Jonesey95 0 div tags to force a new line after this template 796779 wikitext text/x-wiki <includeonly><div style="display:block; margin-top: 1em; padding-right: 2em"><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC<!-- -->|CatAutoTOC=yes<!-- -->|pagecount={{{pagecount}}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC<!-- -->|pagecount={{{pagecount}}}<!-- -->|CatAutoTOC=yes<!-- -->|align = {{#if: {{{align|}}} | {{{align}}} |left}}<!-- -->|top = {{#if: {{{top|}}} | {{{top}}} |yes}}<!-- -->|numerals = {{#if: {{{numerals|}}} | {{{numerals}}} |group}}<!-- -->|uppercase = {{#if: {{{uppercase|}}} | {{{uppercase}}} |yes}}<!-- -->|lowercase = {{#if: {{{lowercase|}}} | {{{lowercase}}} |no}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- --></div></includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> nso5m6337d8vqpy6d1tfby7s3f5smdv 796780 796779 2020-09-30T23:01:50Z en>Jonesey95 0 Undid revision 981209527 by [[Special:Contributions/Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]). Maybe this? My last experiment. 796780 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC<!-- -->|CatAutoTOC=yes<!-- -->|pagecount={{{pagecount}}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC<!-- -->|pagecount={{{pagecount}}}<!-- -->|CatAutoTOC=yes<!-- -->|align = {{#if: {{{align|}}} | {{{align}}} |left}}<!-- -->|top = {{#if: {{{top|}}} | {{{top}}} |yes}}<!-- -->|numerals = {{#if: {{{numerals|}}} | {{{numerals}}} |group}}<!-- -->|uppercase = {{#if: {{{uppercase|}}} | {{{uppercase}}} |yes}}<!-- -->|lowercase = {{#if: {{{lowercase|}}} | {{{lowercase}}} |no}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- -->{{clear}}</includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 55co32fyyxpbj7yoc5gi76namrt8efi 796781 796780 2023-03-06T10:01:15Z en>Mclay1 0 Mclay1 moved page [[Template:CatAutoTOC/core]] to [[Template:Auto category TOC/core]]: match parent 796780 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC<!-- -->|CatAutoTOC=yes<!-- -->|pagecount={{{pagecount}}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC<!-- -->|pagecount={{{pagecount}}}<!-- -->|CatAutoTOC=yes<!-- -->|align = {{#if: {{{align|}}} | {{{align}}} |left}}<!-- -->|top = {{#if: {{{top|}}} | {{{top}}} |yes}}<!-- -->|numerals = {{#if: {{{numerals|}}} | {{{numerals}}} |group}}<!-- -->|uppercase = {{#if: {{{uppercase|}}} | {{{uppercase}}} |yes}}<!-- -->|lowercase = {{#if: {{{lowercase|}}} | {{{lowercase}}} |no}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- -->{{clear}}</includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 55co32fyyxpbj7yoc5gi76namrt8efi 796782 796781 2023-06-03T16:13:24Z en>BrownHairedGirl 0 BrownHairedGirl moved page [[Template:Auto category TOC/core]] to [[Template:CatAutoTOC/core]] over redirect: revert undiscussed [[WP:BOLD]] move. The brief name is easier to use, and distinguishes this meta-template from the templates which do the actual work of generating a TOC. Feel free to open a [[WP:Requested moves]] discussion 796780 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC<!-- -->|CatAutoTOC=yes<!-- -->|pagecount={{{pagecount}}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC<!-- -->|pagecount={{{pagecount}}}<!-- -->|CatAutoTOC=yes<!-- -->|align = {{#if: {{{align|}}} | {{{align}}} |left}}<!-- -->|top = {{#if: {{{top|}}} | {{{top}}} |yes}}<!-- -->|numerals = {{#if: {{{numerals|}}} | {{{numerals}}} |group}}<!-- -->|uppercase = {{#if: {{{uppercase|}}} | {{{uppercase}}} |yes}}<!-- -->|lowercase = {{#if: {{{lowercase|}}} | {{{lowercase}}} |no}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- -->{{clear}}</includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 55co32fyyxpbj7yoc5gi76namrt8efi 796783 796782 2024-02-22T04:13:14Z en>Pppery 0 Changed protection settings for "[[Template:CatAutoTOC/core]]": Per Xaosflux's full protection of parent ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite)) 796780 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC<!-- -->|CatAutoTOC=yes<!-- -->|pagecount={{{pagecount}}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC<!-- -->|pagecount={{{pagecount}}}<!-- -->|CatAutoTOC=yes<!-- -->|align = {{#if: {{{align|}}} | {{{align}}} |left}}<!-- -->|top = {{#if: {{{top|}}} | {{{top}}} |yes}}<!-- -->|numerals = {{#if: {{{numerals|}}} | {{{numerals}}} |group}}<!-- -->|uppercase = {{#if: {{{uppercase|}}} | {{{uppercase}}} |yes}}<!-- -->|lowercase = {{#if: {{{lowercase|}}} | {{{lowercase}}} |no}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- -->{{clear}}</includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 55co32fyyxpbj7yoc5gi76namrt8efi 796784 796783 2024-05-06T20:06:47Z en>Robertsky 0 Robertsky moved page [[Template:CatAutoTOC/core]] to [[Template:Automatic category TOC/core]] 796780 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC<!-- -->|CatAutoTOC=yes<!-- -->|pagecount={{{pagecount}}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC<!-- -->|pagecount={{{pagecount}}}<!-- -->|CatAutoTOC=yes<!-- -->|align = {{#if: {{{align|}}} | {{{align}}} |left}}<!-- -->|top = {{#if: {{{top|}}} | {{{top}}} |yes}}<!-- -->|numerals = {{#if: {{{numerals|}}} | {{{numerals}}} |group}}<!-- -->|uppercase = {{#if: {{{uppercase|}}} | {{{uppercase}}} |yes}}<!-- -->|lowercase = {{#if: {{{lowercase|}}} | {{{lowercase}}} |no}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- -->{{clear}}</includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia CatAutoTOC]] </noinclude> 55co32fyyxpbj7yoc5gi76namrt8efi 796785 796784 2024-05-08T21:48:09Z en>JJMC89 bot III 0 Moving [[:Category:Wikipedia CatAutoTOC]] to [[:Category:Wikipedia Automatic category TOC]] per [[Wikipedia:Categories for discussion/Speedy]] 796785 wikitext text/x-wiki <includeonly><!-- # Using a sub-template, so that we never have have more than one call to the [[WP:EXPENSIVE]] function {{PAGESINCATEGORY}} # # TOC, depending on category size # <= 100 pages → no TOC # 101–1200 pages → {{Category TOC}} # > 1200 pages → {{Large category TOC}} ########################################################################### # NOTE: The sort key {{PAGENAME}} is used on all the tracking categories # # to override any {{DEFAULTSORT}} used in the category # ########################################################################### -->{{#ifexpr: {{{pagecount}}} > 1200 <!-- -->|<!-- # > 1200, so large TOC -->{{Large category TOC<!-- -->|CatAutoTOC=yes<!-- -->|pagecount={{{pagecount}}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates Large category TOC|{{PAGENAME}}]]<!-- -->|<!-- # < 1200, so check again -->{{#ifexpr: {{{pagecount}}} > 100<!-- -->|<!-- # > 100, so std TOC -->{{Category TOC<!-- -->|pagecount={{{pagecount}}}<!-- -->|CatAutoTOC=yes<!-- -->|align = {{#if: {{{align|}}} | {{{align}}} |left}}<!-- -->|top = {{#if: {{{top|}}} | {{{top}}} |yes}}<!-- -->|numerals = {{#if: {{{numerals|}}} | {{{numerals}}} |group}}<!-- -->|uppercase = {{#if: {{{uppercase|}}} | {{{uppercase}}} |yes}}<!-- -->|lowercase = {{#if: {{{lowercase|}}} | {{{lowercase}}} |no}}<!-- -->}}<!-- -->[[Category:CatAutoTOC generates standard Category TOC|{{PAGENAME}}]]<!-- -->|<!-- # <= 100, so no TOC -->[[Category:CatAutoTOC generates no TOC|{{PAGENAME}}]]<!-- -->}}<!-- -->}}<!-- -->{{#ifeq: {{{pagecount}}} | 0 <!-- -->|[[Category:CatAutoTOC on pages where PAGESINCATEGORY returns zero|{{PAGENAME}}]]<!-- -->}}<!-- -->{{clear}}</includeonly><noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia Automatic category TOC]] </noinclude> k6aahn635l9t11p8zmziwvtcnv22md6 796786 796785 2024-05-10T08:28:02Z en>MSGJ 0 update after moves, and remove excessive whitespace 796786 wikitext text/x-wiki {{#ifexpr:{{{pagecount|0}}} > 1200 |{{Large category TOC |CatAutoTOC = yes |pagecount = {{{pagecount}}} }}[[Category:Automatic category TOC generates Large category TOC]] |{{#ifexpr:{{{pagecount|0}}} > 100 |{{Category TOC |pagecount={{{pagecount}}} |CatAutoTOC=yes |align = {{#if:{{{align|}}}|{{{align}}}|left}} |top = {{#if:{{{top|}}}|{{{top}}}|yes}} |numerals = {{#if:{{{numerals|}}}|{{{numerals}}}|group}} |uppercase = {{#if:{{{uppercase|}}}|{{{uppercase}}}|yes}} |lowercase = {{#if:{{{lowercase|}}}|{{{lowercase}}}|no}} }}[[Category:Automatic category TOC generates standard Category TOC]] |[[Category:Automatic category TOC generates no TOC]] }} }}{{#ifeq:{{{pagecount}}}|0 |[[Category:Automatic category TOC on pages where PAGESINCATEGORY returns zero]] }}{{clear}}<noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia Automatic category TOC]] </noinclude> 0e5u9bmmwid4q0o7c5pybouiwgwp4lu 796787 796786 2026-06-06T02:47:02Z SM7 3953 18 revisions imported from [[:en:Template:Automatic_category_TOC/core]] 796786 wikitext text/x-wiki {{#ifexpr:{{{pagecount|0}}} > 1200 |{{Large category TOC |CatAutoTOC = yes |pagecount = {{{pagecount}}} }}[[Category:Automatic category TOC generates Large category TOC]] |{{#ifexpr:{{{pagecount|0}}} > 100 |{{Category TOC |pagecount={{{pagecount}}} |CatAutoTOC=yes |align = {{#if:{{{align|}}}|{{{align}}}|left}} |top = {{#if:{{{top|}}}|{{{top}}}|yes}} |numerals = {{#if:{{{numerals|}}}|{{{numerals}}}|group}} |uppercase = {{#if:{{{uppercase|}}}|{{{uppercase}}}|yes}} |lowercase = {{#if:{{{lowercase|}}}|{{{lowercase}}}|no}} }}[[Category:Automatic category TOC generates standard Category TOC]] |[[Category:Automatic category TOC generates no TOC]] }} }}{{#ifeq:{{{pagecount}}}|0 |[[Category:Automatic category TOC on pages where PAGESINCATEGORY returns zero]] }}{{clear}}<noinclude> {{Documentation|Template:{{ROOTPAGENAME}}/doc}} [[Category:Wikipedia Automatic category TOC]] </noinclude> 0e5u9bmmwid4q0o7c5pybouiwgwp4lu Module:InfoboxImage/data 828 100982 796826 2025-10-21T23:10:59Z en>Pppery 0 Changed protection settings for "[[Module:InfoboxImage/data]]": Match the protection level of the parent ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite)) 796826 Scribunto text/plain local placeholderList = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } local placeholder_image = {} for _, val in ipairs(placeholderList) do placeholder_image[val] = true end local categories = { url_image_links = "[[Category:Pages using infoboxes with URL in image parameter]]", thumbnail_images = "[[Category:Pages using infoboxes with thumbnail images]]", } return { placeholder_image = placeholder_image, categories = categories } 4h39dpz9m6jxmu0vznaup0kyz6rbh4y 796827 796826 2026-06-06T03:00:05Z SM7 3953 1 revision imported from [[:en:Module:InfoboxImage/data]] 796826 Scribunto text/plain local placeholderList = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } local placeholder_image = {} for _, val in ipairs(placeholderList) do placeholder_image[val] = true end local categories = { url_image_links = "[[Category:Pages using infoboxes with URL in image parameter]]", thumbnail_images = "[[Category:Pages using infoboxes with thumbnail images]]", } return { placeholder_image = placeholder_image, categories = categories } 4h39dpz9m6jxmu0vznaup0kyz6rbh4y रामनगर, बनारस 0 100983 796832 2026-06-06T03:13:10Z SM7 3953 पन्ना [[रामनगर]] पर अनुप्रेषित कइल गइल 796832 wikitext text/x-wiki #REDIRECT [[रामनगर]] 0wanqpmf7d4zk4epbz1a49d9ggagyex रामनगर 0 100984 796833 2026-06-06T03:17:37Z SM7 3953 नया आधार लेख 796833 wikitext text/x-wiki '''रामनगर''' भारत के [[उत्तर प्रदेश]] राज्य के [[वाराणसी जिला]] में स्थित एगो कस्बा आ नगर पालिका बोर्ड हवे। ई [[बनारस]] शहर के ठीक बगल में स्थित बा। रामनगर अपना प्रसिद्ध [[रामनगर किला]] खातिर जानल जाला, जवन आजुओ [[काशी नरेश]] के निवास स्थान बा। काशी नरेश के अर्थ "काशी के राजा" होला। हालाँकि, राजशाही बेवस्था अब खतम हो चुकल बा, बाकी बनारस के लोग आजुओ काशी नरेश के बिसेस सम्मान देला। रामनगर किला आ एकर [[म्यूजियम]] बनारस के राजघराना के इतिहास के महत्त्वपूर्ण धरोहर मानल जालें। 18वीं सदी से ई किला काशी नरेश के निवास स्थान रहल बा। आजुओ बनारस के लोग काशी नरेश के गहिर सम्मान देला। धार्मिक परंपरा में ऊ बनारस के धर्म प्रमुख मानल जालें आ बहुत लोग उनका के भगवान शिव के प्रतिनिधि के रूप में देखेला। ऊ बनारस के सांस्कृतिक जीवन के भी प्रमुख संरक्षक बाड़ें आ शहर के कई धार्मिक आयोजनन में महत्त्वपूर्ण भूमिका निभावेलन। रामनगर हर साल आयोजित होखे वाली प्रसिद्ध [[रामनगर रामलीला]] खातिर भी जानल जाला, जवन काशी नरेश के संरक्षण में आयोजित कइल जाले। हाल के सालन में गंगा किनारे स्थित रामनगर किला के सुंदर परिवेश के कारण रामनगर फिलिम आ वेब सीरीज के शूटिंग खातिर लोकप्रिय जगह बन गइल बा। पुराना समय के ''चोखेर बाली'' आ ''रजनीगंधा'' जइसन पॉपुलर फिल्मन के शूटिंग एहिजा भइल बा। एकरे अलावा वेब सीरीज ''मिर्जापुर'' आ फिलिम ''गैंग्स ऑफ वासेपुर'' के कुछ सीन सभ रामनगर में फिल्मावल गइल बाड़ें। किला के आसपास के इलाका में कई गो सदियन पुरान मकान आ ऐतिहासिक इमारत आजुओ देखे के मिले लीं। 8snzlsqoy97060spvcuim320fxks3ub 796834 796833 2026-06-06T03:17:55Z SM7 3953 [[विकिपीडिया:हॉट-कैट|हॉट-कैट]] द्वारा [[श्रेणी:वाराणसी जिला]] जोड़ल गइल 796834 wikitext text/x-wiki '''रामनगर''' भारत के [[उत्तर प्रदेश]] राज्य के [[वाराणसी जिला]] में स्थित एगो कस्बा आ नगर पालिका बोर्ड हवे। ई [[बनारस]] शहर के ठीक बगल में स्थित बा। रामनगर अपना प्रसिद्ध [[रामनगर किला]] खातिर जानल जाला, जवन आजुओ [[काशी नरेश]] के निवास स्थान बा। काशी नरेश के अर्थ "काशी के राजा" होला। हालाँकि, राजशाही बेवस्था अब खतम हो चुकल बा, बाकी बनारस के लोग आजुओ काशी नरेश के बिसेस सम्मान देला। रामनगर किला आ एकर [[म्यूजियम]] बनारस के राजघराना के इतिहास के महत्त्वपूर्ण धरोहर मानल जालें। 18वीं सदी से ई किला काशी नरेश के निवास स्थान रहल बा। आजुओ बनारस के लोग काशी नरेश के गहिर सम्मान देला। धार्मिक परंपरा में ऊ बनारस के धर्म प्रमुख मानल जालें आ बहुत लोग उनका के भगवान शिव के प्रतिनिधि के रूप में देखेला। ऊ बनारस के सांस्कृतिक जीवन के भी प्रमुख संरक्षक बाड़ें आ शहर के कई धार्मिक आयोजनन में महत्त्वपूर्ण भूमिका निभावेलन। रामनगर हर साल आयोजित होखे वाली प्रसिद्ध [[रामनगर रामलीला]] खातिर भी जानल जाला, जवन काशी नरेश के संरक्षण में आयोजित कइल जाले। हाल के सालन में गंगा किनारे स्थित रामनगर किला के सुंदर परिवेश के कारण रामनगर फिलिम आ वेब सीरीज के शूटिंग खातिर लोकप्रिय जगह बन गइल बा। पुराना समय के ''चोखेर बाली'' आ ''रजनीगंधा'' जइसन पॉपुलर फिल्मन के शूटिंग एहिजा भइल बा। एकरे अलावा वेब सीरीज ''मिर्जापुर'' आ फिलिम ''गैंग्स ऑफ वासेपुर'' के कुछ सीन सभ रामनगर में फिल्मावल गइल बाड़ें। किला के आसपास के इलाका में कई गो सदियन पुरान मकान आ ऐतिहासिक इमारत आजुओ देखे के मिले लीं। [[श्रेणी:वाराणसी जिला]] a67tgrrw6ldvq1bfpksc9gokbs2wrpo 796835 796834 2026-06-06T03:18:57Z SM7 3953 [[विकिपीडिया:हॉट-कैट|हॉट-कैट]] द्वारा [[श्रेणी:उत्तर प्रदेश के शहर आ कस्बा]] जोड़ल गइल 796835 wikitext text/x-wiki '''रामनगर''' भारत के [[उत्तर प्रदेश]] राज्य के [[वाराणसी जिला]] में स्थित एगो कस्बा आ नगर पालिका बोर्ड हवे। ई [[बनारस]] शहर के ठीक बगल में स्थित बा। रामनगर अपना प्रसिद्ध [[रामनगर किला]] खातिर जानल जाला, जवन आजुओ [[काशी नरेश]] के निवास स्थान बा। काशी नरेश के अर्थ "काशी के राजा" होला। हालाँकि, राजशाही बेवस्था अब खतम हो चुकल बा, बाकी बनारस के लोग आजुओ काशी नरेश के बिसेस सम्मान देला। रामनगर किला आ एकर [[म्यूजियम]] बनारस के राजघराना के इतिहास के महत्त्वपूर्ण धरोहर मानल जालें। 18वीं सदी से ई किला काशी नरेश के निवास स्थान रहल बा। आजुओ बनारस के लोग काशी नरेश के गहिर सम्मान देला। धार्मिक परंपरा में ऊ बनारस के धर्म प्रमुख मानल जालें आ बहुत लोग उनका के भगवान शिव के प्रतिनिधि के रूप में देखेला। ऊ बनारस के सांस्कृतिक जीवन के भी प्रमुख संरक्षक बाड़ें आ शहर के कई धार्मिक आयोजनन में महत्त्वपूर्ण भूमिका निभावेलन। रामनगर हर साल आयोजित होखे वाली प्रसिद्ध [[रामनगर रामलीला]] खातिर भी जानल जाला, जवन काशी नरेश के संरक्षण में आयोजित कइल जाले। हाल के सालन में गंगा किनारे स्थित रामनगर किला के सुंदर परिवेश के कारण रामनगर फिलिम आ वेब सीरीज के शूटिंग खातिर लोकप्रिय जगह बन गइल बा। पुराना समय के ''चोखेर बाली'' आ ''रजनीगंधा'' जइसन पॉपुलर फिल्मन के शूटिंग एहिजा भइल बा। एकरे अलावा वेब सीरीज ''मिर्जापुर'' आ फिलिम ''गैंग्स ऑफ वासेपुर'' के कुछ सीन सभ रामनगर में फिल्मावल गइल बाड़ें। किला के आसपास के इलाका में कई गो सदियन पुरान मकान आ ऐतिहासिक इमारत आजुओ देखे के मिले लीं। [[श्रेणी:वाराणसी जिला]] [[श्रेणी:उत्तर प्रदेश के शहर आ कस्बा]] ids6y4dwd681rk96f09srqwz853f514 796836 796835 2026-06-06T03:19:24Z SM7 3953 [[User:SM7/stubsorter|Stubsorter]] के मदद से {{UP-geo-stub}} जोड़ल गइल। 796836 wikitext text/x-wiki '''रामनगर''' भारत के [[उत्तर प्रदेश]] राज्य के [[वाराणसी जिला]] में स्थित एगो कस्बा आ नगर पालिका बोर्ड हवे। ई [[बनारस]] शहर के ठीक बगल में स्थित बा। रामनगर अपना प्रसिद्ध [[रामनगर किला]] खातिर जानल जाला, जवन आजुओ [[काशी नरेश]] के निवास स्थान बा। काशी नरेश के अर्थ "काशी के राजा" होला। हालाँकि, राजशाही बेवस्था अब खतम हो चुकल बा, बाकी बनारस के लोग आजुओ काशी नरेश के बिसेस सम्मान देला। रामनगर किला आ एकर [[म्यूजियम]] बनारस के राजघराना के इतिहास के महत्त्वपूर्ण धरोहर मानल जालें। 18वीं सदी से ई किला काशी नरेश के निवास स्थान रहल बा। आजुओ बनारस के लोग काशी नरेश के गहिर सम्मान देला। धार्मिक परंपरा में ऊ बनारस के धर्म प्रमुख मानल जालें आ बहुत लोग उनका के भगवान शिव के प्रतिनिधि के रूप में देखेला। ऊ बनारस के सांस्कृतिक जीवन के भी प्रमुख संरक्षक बाड़ें आ शहर के कई धार्मिक आयोजनन में महत्त्वपूर्ण भूमिका निभावेलन। रामनगर हर साल आयोजित होखे वाली प्रसिद्ध [[रामनगर रामलीला]] खातिर भी जानल जाला, जवन काशी नरेश के संरक्षण में आयोजित कइल जाले। हाल के सालन में गंगा किनारे स्थित रामनगर किला के सुंदर परिवेश के कारण रामनगर फिलिम आ वेब सीरीज के शूटिंग खातिर लोकप्रिय जगह बन गइल बा। पुराना समय के ''चोखेर बाली'' आ ''रजनीगंधा'' जइसन पॉपुलर फिल्मन के शूटिंग एहिजा भइल बा। एकरे अलावा वेब सीरीज ''मिर्जापुर'' आ फिलिम ''गैंग्स ऑफ वासेपुर'' के कुछ सीन सभ रामनगर में फिल्मावल गइल बाड़ें। किला के आसपास के इलाका में कई गो सदियन पुरान मकान आ ऐतिहासिक इमारत आजुओ देखे के मिले लीं। [[श्रेणी:वाराणसी जिला]] [[श्रेणी:उत्तर प्रदेश के शहर आ कस्बा]] {{UP-geo-stub}} el2o1vyan63ui4woeyb4htyl1b8p60s रामनगर के रामलीला 0 100985 796837 2026-06-06T03:20:58Z SM7 3953 पन्ना [[रामनगर रामलीला]] पर अनुप्रेषित कइल गइल 796837 wikitext text/x-wiki #REDIRECT [[रामनगर रामलीला]] fblyf7148gpxq6x034pjpi6mcwnee68 रामनगर रामलीला 0 100986 796838 2026-06-06T03:32:24Z SM7 3953 नया आधार लेख 796838 wikitext text/x-wiki [[चित्र:Ram Leela Mela As Performed before at Ram Nugur before the Raja of Benares by James Prinsep 1834.jpg|thumb|काशी नरेश के सोझा रामलीला के मंचन, जेम्स प्रिंसेप, 1834]] '''रामनगर रामलीला''' चाहे '''रामनगर के रामलीला''' भारतीय राज्य उत्तर प्रदेश के [[बनारस]] के लगे स्थित [[रामनगर]] में खेलल जाये वाली [[रामलीला]] हवे। ई इतिहासी रामलीला हवे जेकर मंचन लगभग 200 साल से बेसी के इतिहास वाला बाटे। एक महीना चले वाली ई रामलीला मुख्य रूप से [[रामनगर के किला]] में खेलल जाले। काशी नरेश खुद एह रामलीला के देखे आवे लन।<ref name="बीबीसी">{{cite web |last1=जायसवाल |first1=रौशन |title=अलग है रामनगर की 233 साल पुरानी रामलीला |url=https://www.bbc.com/hindi/india-37601049 |website=BBC News हिंदी |access-date=6 जून 2026 |language=hi |date=9 अक्टूबर 2016 |url-status=live}}</ref> == इहो देखल जाय == * [[रामनगर किला]] * [[रामलीला]] {{clear}} == संदर्भ == {{Reflist|29em}} [[श्रेणी:बनारस]] {{culture-stub}} qww1vw9fnlk5e3ho0etlbrlno98jecd