-- This module counts the number of times that various reference tags and cs1|2 templates appear.-- -- --
require('strict');local data = mw.loadData ('Module:Ref info/data');
--mw.logObject (data.cs12_stripped_list, 'data.cs12_stripped_list')local collapsible_tables =
----------------------------< T E M P L A T E _ N A M E _ T A B L E _ M A K E >------------------------------
makes a collapsed html table that holds a list of cs1 or cs2 template used in an article. The list occupies asingle row of the parent table.
local function template_name_table_make (name_list, group) local name_table = ;
local function comp (a, b) -- used in following table.sort return a:lower < b:lower; -- case-insensitive ascending alpha sort end
table.insert (name_table, '\n|-\n|scope="row" colspan="2" style="vertical-align:top;text-align:left" |\n'); -- create a blank row in parent table for this table table.insert (name_table, '
List of '); -- begin simple header row always displays table.insert (name_table, group); -- template group (cs1, cs2 TODO: vcite? harv?) table.insert (name_table, ' templates \n'); -- end of simple heading table.insert (name_table, ' | -\n | \n
; open unordered list local t = ; for k, v in pairs (name_list) do -- spin through the list table.insert (t, string.format (' table.sort (t, comp); -- case-insensitive ascending alpha sort table.insert (t, ' |
----------------------------< C O L L E C T _ T E M P L A T E S >--------------------------------------------
function to collect every template
local function collect_templates (Article_content) local template_list = ; local tstart, tend = Article_content:find ("