-- dead code, remove from /sandbox
local tX100DEV =
---------------------------------------------------------------------------------- test2DEV current range--------------------------------------------------------------------------------function r.test2DEV(frame) local tArgs = getArgs(frame) local min, max, ccRange ccRange = tArgs['range'] min = string.match(ccRange, '^([PH][%d%+A-Za-z]*)-') or 'Nil' max = string.match(ccRange, '-([PH][%d%+A-Za-z]*)$') or 'Nil' return 'test2: ' .. ccRange .. ' MIN:' .. min .. ' MAX:' .. maxend
---------------------------------------------------------------------------------- listRangeDEV---- listtypes: all + tablerow x col + pipedlist-- range = H330-H399 min-max (inclde 401-330-402 !)-- range = single only [AND/OR]-- range = all-- range = min-max-- has ellipses (=wordtype)-- X100 group headers H123, P12345--------------------------------------------------------------------------------function r.listRangeDEV(frame) -- DEVlocal tArgs = getArgs(frame)local tL = local t2 = -- from listAll orig: wellordered
-- PARAMS setid, Rmin, Rmax, Rform prepareArgsAndCodes(tArgs) ---- setid?; later more tArgs.Range = 'H300-H350' -- -- range = todo ellipses, X100, multi/single H/P/all local range = range.range, range.min, range.max = getRangeMinMax(tArgs.Range)
-- -- DEV: range parameter if isDebug then return range.range .. ' |min=' .. range.min .. ' max=' .. range.max else return -- DEV only end -- SOURCE table tGHSdata (H/P GHSdata table) local tGHSdata tGHSdata = GHSdata['GHSphrases']
if tArgName.setid
-- ORDERED RANGE: t2 ; pairs not ipairs -- (from listAll 28-11 7:00) local t2 = for s, v in pairs(tGHSdata) do table.insert(t2, s) end t2 = tTools.compressSparseArray(t2) table.sort(t2) -- required
-- STRUCT TABLE t3 (ordered, has data on code number) -- suffix 1=from 1st table (GHSdata); 2=from t2 (ordered); local t3 = local numC, countC, phrase1 local hasEllipses = local multiC -- C2, C3, C4 local trip local withPhrase = true for i2, c2 in pairs(t2) do -- value=phrase: ignored for now, countC = 0 multiC = local iterator = mw.ustring.gmatch(c2, '%d%d%d') -- todo not [HP] ??? for codeN in iterator do countC = countC + 1 if countC
if withPhrase then phrase1 = tGHSdata[c2] hasEllipses = string.match(phrase1, '%.%.%.') or false end
trip = table.insert(t3, trip) if i2 > 20 then break end end t3 = tTools.compressSparseArray(t3)
-- LIST t33 local t33 = for i3, tV in ipairs(t3) do table.insert(t33, table.concat(unpack(t3, i3), '; ')) end return 't33:' .. tTools.size(t3) .. ' \n ' .. table.concat(t33, ' \n ')end
---------------------------------------------------------------------------------- H300-H340 into min, max--------------------------------------------------------------------------------local function getRangeMinMax(ccRange) local c c = mw.text.decode(ccRange) c = mw.ustring.gsub(c, '[%−%–]', '-') -- minus, ndash c = mw.ustring.gsub(c, '[^%d%+A-Za-z%-]', ) -- hyphen: extra for Range definition c = mw.ustring.gsub(c, '^(%d)', tArgName.setid .. '%1') ccRange = mw.ustring.gsub(c, '%+(%d)', '+' .. tArgName.setid .. '%1')
local min, max min = string.match(ccRange, '^([PH][%d%+A-Za-z]*)-') or max = string.match(ccRange, '-([PH][%d%+A-Za-z]*)$') or return ccRange, min, maxend
return x