Modulo:test: Malsamoj inter versioj

30 675 bitokojn forigis ,  antaŭ 6 monatoj
Forviŝis la tutan enhavon el la paĝo
(danĝera eksperimenta moduulo)
 
(Forviŝis la tutan enhavon el la paĝo)
Etikedo: Vakigo
 
 
local ind12dim = {}
 
local constrborder = '2060A0' -- 6 digits no cross "#" here
local constrbakgnd = 'D0E0F0' -- 6 digits no cross "#" here
local constrtabu7 = '<table class="plainlinks" style="margin:0.5em auto 0.5em auto; border:2px solid #'
local constrtabu8 = '; background-color:#'
local constrtabu9 = '; padding:5px; text-align:center;">'
 
-- very verbose error messages
 
local constrkros = '&nbsp;#&nbsp;#&nbsp;' -- lagom -> huge circumfix
local constrelabg = '<span class="error"><b>' -- lagom whining begin
local constrelaen = '</b></span>' -- lagom whining end
 
local constrdamn = 'Error in "Module:mind12dim" code #E'
 
local contabevilpar2a = {} -- 1...26 AKA #E01...#E26 (use "-" for reserved codes)
contabevilpar2a = {'A', 'B', 'CaD', 'CbD', 'CbDH', 'CcD', '-', 'CdD', 'CdDE', 'CeD', 'CfD', '-', 'CgD', 'CgDF', 'CgDG', 'ChD', 'CiD', 'CjD', 'CjDI', '-', 'CkD', 'CkDH', '-', '-', 'K', 'L'}
 
local contabevilpar3a = {} -- 1...11 AKA "a"..."k" -- lowercase
contabevilpar3a = {'fpn','tit','dud','typ','mwp','ans','alf','fla','ctb','cos','pre'}
 
local contabevilpar4a = {} -- 1...12 AKA "A"..."L" -- UPPERCASE (use "-" for reserved codes)
contabevilpar4a[ 1] = 'Internal error' -- "A"
contabevilpar4a[ 2] = 'Undesirable anonymous parameter' -- "B"
contabevilpar4a[ 3] = 'Parameter "' -- "C"
contabevilpar4a[ 4] = '=" is bad' -- "D"
contabevilpar4a[ 5] = ' (bad base link type, must be 0...6)' -- "E"
contabevilpar4a[ 6] = ' (lowercase char)' -- "F"
contabevilpar4a[ 7] = ' (dupe char)' -- "G"
contabevilpar4a[ 8] = ' (illegal dbl apo:s links transclusions)' -- "H"
contabevilpar4a[ 9] = ' (both colours are non-ZERO and same)' -- "I"
contabevilpar4a[10] = '-' -- "J"
contabevilpar4a[11] = 'Inconsistent explicit parameters' -- "K"
contabevilpar4a[12] = 'Inconsistency with pagename' -- "L"
 
-- text colours (none,1-dim,2-dim) and separators for "strapart" (none,1-dim) controlled by "cos="
 
local contabwarn = {'F00000','00F000','0000F0','F0F000','00F0F0','F000F0','808080'} -- 1...7 RGB CMY grey (ZERO valid and default but separate)
local contabsepa = {'-','--','*','|',string.char(0xC2,0xB7),string.char(0xE2,0x80,0xA2)} -- 1...6 (ZERO valid and default but separate)
 
-- constant strings EO vs ID
 
local constrkatp5 = "Category:" -- EO (obligatory)
local constrkatp6 = "Kategorio:" -- EO (assign to empty string if unused)
 
-- local constrkatp5 = "Category:" -- ID (obligatory)
-- local constrkatp6 = "Kategori:" -- ID (assign to empty string if unused)
 
local constrspep5 = "Special:" -- EO (obligatory)
local constrspep6 = "Speciala" .. string.char(0xC4,0xB5) .. "o:" -- EO (assign to empty string if unused) ($C4,$B5 = "jx")
 
-- local constrspep5 = "Special:" -- ID (obligatory)
-- local constrspep6 = "Istimewa:" -- ID (assign to empty string if unused)
 
------------------------------------------------------------------------
 
---- ORDINARY LOCAL LOW LEVEL FUNCTIONS ----
 
------------------------------------------------------------------------
 
-- Local function LFCOUNTCHR
 
-- Count occurrences of a given ASCII char in a string
 
-- Input : - strqq -- string (empty is useless but can't cause any harm)
-- - numascii -- code of char to be counted
 
-- Output : - numrezalt -- amount
 
local function lfcountchr (strqq, numascii)
local numrezalt = 0
local numciar = 0
local numukuran = 0
local numindxe = 0 -- ZERO-based
numukuran = string.len (strqq)
while (true) do
if (numindxe==numukuran) then
break -- done -- ZERO iterations possible
end--if
numciar = string.byte (strqq,(numindxe+1),(numindxe+1))
if (numciar==numascii) then
numrezalt = numrezalt + 1
end--if
numindxe = numindxe + 1
end--while
return numrezalt
end--function lfcountchr
 
------------------------------------------------------------------------
 
-- Local function LFDEC1DIGLM
 
-- Convert 1 decimal ASCII digit to UINT8 with inclusive upper limit
 
-- Use this for single-digit conversions with range and for pseudo-bool
-- (0,1) and for genuine bool (false,true) via "boocrap=(numcrap==1)"
 
local function lfdec1diglm (num1dygyt, num1lim)
num1dygyt = num1dygyt - 48 -- may become invalid ie negative
if ((num1dygyt<0) or (num1dygyt>num1lim)) then
num1dygyt = 255
end--if
return num1dygyt
end--function lfdec1diglm
 
------------------------------------------------------------------------
 
-- Local function LFDECINP
 
-- Convert string (1...13 octet:s) with decimal ASCII digits to a positive
-- (UINT32) integer number (0...4'000'000'000) ignoring possible inside apo:s
 
-- 65'536 good
-- 655'36 ugly but accepted -- 6''''55''''36 ugly but accepted
-- '65536 rejected -- 65536' rejected
 
-- Input : - strin
 
-- Output : - numaout (4'294'967'295 on error)
 
local function lfdecinp (strin)
local numaout = 0
local numleen = 0
local numinxx = 1 -- ONE-based -- counts up
local numokkt = 0
numleen = string.len (strin)
if ((numleen<1) or (numleen>13)) then
numaout = 4294967295 -- damn
else
while (true) do
numokkt = string.byte (strin,numinxx,numinxx)
if (numokkt==39) then
if ((numinxx==1) or (numinxx==numleen)) then
numaout = 4294967295
break -- damn (may not begin or end with apo)
end--if
else
if ((numokkt<48) or (numokkt>57) or (numaout>400000000)) then
numaout = 4294967295
break -- damn (bad char or out of range)
end--if
numaout = numaout * 10 + (numokkt - 48)
end--if
if (numinxx==numleen) then
break -- done (hopefully success, but not yet sure)
end--if
numinxx = numinxx + 1
end--while
if (numaout>4000000000) then
numaout = 4294967295 -- damn (out of range)
end--if
end--if
return numaout
end--function lfdecinp
 
------------------------------------------------------------------------
 
-- Local function LFEXTHEXTOINT
 
-- Convert 1 ASCII code of an extended quasi-hex digit (0...9 A...Z)
-- to a number 0...35 (255 invalid)
 
-- Only uppercase accepted
 
local function lfexthextoint (numdgiit)
local numressult = 255
if ((numdgiit>47) and (numdgiit<58)) then
numressult = numdgiit-48
end--if
if ((numdgiit>64) and (numdgiit<91)) then
numressult = numdgiit-55
end--if
return numressult
end--function lfexthextoint
 
------------------------------------------------------------------------
 
-- Local function LFUTF8LENGTH
 
-- Measure length of a UTF8 char, return ZERO if invalid
 
-- Does NOT thoroughly check the validity, looks at 1 octet only
 
-- Input : - numbgoctet (beginning octet of a UTF8 char)
 
-- Output : - numlen1234x (1...4 or ZERO if invalid)
 
local function lfutf8length (numbgoctet)
local numlen1234x = 0
if (numbgoctet<128) then
numlen1234x = 1 -- $00...$7F -- ANSI/ASCII
end--if
if ((numbgoctet>=194) and (numbgoctet<=223)) then
numlen1234x = 2 -- $C2 to $DF
end--if
if ((numbgoctet>=224) and (numbgoctet<=239)) then
numlen1234x = 3 -- $E0 to $EF
end--if
if ((numbgoctet>=240) and (numbgoctet<=244)) then
numlen1234x = 4 -- $F0 to $F4
end--if
return numlen1234x
end--function lfutf8length
 
------------------------------------------------------------------------
 
-- Local function LFCASELETO
 
-- Adjust case of a single letter, limited unicode support
 
-- Input : - strucinut : single unicode letter (1 or 2 octet:s)
-- - booucas : "true" for uppercase and "false" for lowercase
 
-- Output : - strucinut : (same var, unchanged if input is
-- empty or unknown or invalid)
 
-- Depends on sub "lfutf8length"
 
local function lfcaseleto (strucinut, booucas)
local numlaengden = 0 -- length from "string.len"
local numchaer = 0
local numchaes = 0
local booc3blok = false
local booc4c5bl = false
local booisuppr = false
local booislowr = false
while (true) do -- fake loop
numlaengden = string.len (strucinut)
if ((numlaengden==0) or (numlaengden>2)) then
break -- to join mark
end--if
numchaer = string.byte (strucinut,1,1)
if ((lfutf8length(numchaer))~=numlaengden) then
break -- to join mark -- mismatch with length from sub "lfutf8length"
end--if
if (numlaengden==1) then
booisuppr = ((numchaer>64) and (numchaer< 91))
booislowr = ((numchaer>96) and (numchaer<123))
if (booisuppr and (booucas==false)) then
numchaer = numchaer+32 -- ASCII UPPER->lower
end--if
if (booislowr and booucas) then
numchaer = numchaer-32 -- ASCII lower->UPPER
end--if
strucinut = string.char (numchaer)
break -- to join mark
end--if
numchaes = string.byte (strucinut,2,2)
booc3blok = (numchaer==195) -- case delta is 32
booc4c5bl = ((numchaer==196) or (numchaer==197)) -- case delta is 1
if (booc3blok) then
if ((numchaes>=128) and (numchaes<160)) then
booisuppr = true -- C3,80...C3,9F
end--if
if ((numchaes>=160) and (numchaes<192)) then
booislowr = true -- C3,A0...C3,BF
end--if
end--if
if (booc4c5bl) then
if ((numchaes%2)==0) then -- MOD is available but DIV is NOT available
booisuppr = true
else
booislowr = true
end--if
end--if
if (booc3blok and booisuppr and (booucas==false)) then
numchaes = numchaes+32 -- UC UPPER->lower -- holds f AA AE EE NN OE UE
end--if
if (booc3blok and booislowr and booucas) then
numchaes = numchaes-32 -- UC lower->UPPER -- holds f aa ae ee nn oe ue
end--if
if (booc4c5bl and booisuppr and (booucas==false)) then
numchaes = numchaes+1 -- UC UPPER->lower -- holds for JX SX ...
end--if
if (booc4c5bl and booislowr and booucas) then
numchaes = numchaes-1 -- UC lower->UPPER -- holds for jx sx ...
end--if
strucinut = string.char (numchaer) .. string.char (numchaes)
break -- finally to join mark
end--while -- fake loop -- join mark
return strucinut -- same var for input and output !!!
end--function lfcaseleto
 
------------------------------------------------------------------------
 
-- Local function LFXCASEULT
 
-- Adjust case of beginning letter or all letters in a word or group of
-- words to upper or lower, limited unicode support
 
-- Input : - strenigo : word or group of words (may be empty)
-- - booupcas : "true" for uppercase and "false" for lowercase
-- - boodoall : "true" to adjust all letters, "false" only beginning
 
-- Depends on subs "lfcaseleto" and "lfutf8length"
 
local function lfxcaseult (strenigo, booupcas, boodoall)
local numlein = 0
local numposi = 1 -- octet position ONE-based
local numcut = 0 -- length of an UTF8 char
local bootryadj = false
local strte7mp = ""
local strelygo = ""
numlein = string.len (strenigo)
while (true) do
if (numposi>numlein) then
break -- done
end--if
bootryadj = (boodoall or (numposi==1))
numcut = lfutf8length(string.byte(strenigo,numposi,numposi))
if ((numcut==0) or ((numposi+numcut-1)>numlein)) then
numcut = 1 -- skip ie copy one faulty octet
bootryadj = false
end--if
strte7mp = string.sub (strenigo,numposi,(numposi+numcut-1)) -- 1...4 oct
if (bootryadj) then
strte7mp = lfcaseleto(strte7mp,booupcas)
end--if
strelygo = strelygo .. strte7mp
numposi = numposi + numcut
end--while
return strelygo
end--function lfxcaseult
 
------------------------------------------------------------------------
 
---- ORDINARY LOCAL HIGH LEVEL FUNCTIONS ----
 
------------------------------------------------------------------------
 
-- Local function lfranges
 
-- Check whether ASCII char is maybe illegal (2) or maybe lowercase (1)
 
local function lfranges (numascii)
local numtrista = 2 -- preassume guilt
if ((numascii>=48) and (numascii<=57)) then
numtrista = 0 -- innocent -- "0"..."9"
end--if
if ((numascii>=65) and (numascii<=90)) then
numtrista = 0 -- innocent -- "A"..."Z"
end--if
if ((numascii==39) or (numascii==45)) then
numtrista = 0 -- innocent -- apo "'" or dash "-"
end--if
if ((numascii>=97) and (numascii<=122)) then
numtrista = 1 -- lowercase -- "a"..."z"
end--if
return numtrista
end--function lfranges
 
------------------------------------------------------------------------
 
-- Local function LFILLEGAL
 
-- Check whether string contains illegal
-- stuff such as <> '''' [[]] {{}} "[http"
 
-- Input : - "strinpil" (empty cannot cause major harm and returns "false")
-- - boonotags (disallow <> ie HTML tags)
-- - boonobold (disallow "''" ie both italics and bold)
-- - boonowili (disallow "[[" and "]]" but not single ones)
-- - boonotskl (disallow "{{" and "}}" but not single ones)
-- - boonohttp (disallow "[http")
 
-- Output : - boocriminal ("true" if "strinpil" contains illegal stuff)
 
local function lfillegal (strinpil, boonotags, boonobold, boonowili, boonotskl, boonohttp)
local numleunin = 0
local numindexx = 1 -- ONE-based
local numcrap = 0
local numcraq = 0 -- previous
local boocriminal = false
if (boonohttp and (string.find(strinpil,"[http",1,true))) then
boocriminal = true
else
numleunin = string.len (strinpil) -- length of input string to be tested
while (true) do
if (numindexx>numleunin) then
break -- innocent now
end--if
numcrap = string.byte (strinpil,numindexx,numindexx)
if (boonotags and ((numcrap==60) or (numcrap==62))) then
boocriminal = true -- single "<" or ">" is criminal
break
end--if
if (numcrap==numcraq) then
if (boonobold and (numcrap==39)) then
boocriminal = true -- "''" ie italics or bold
break
end--if
if (boonowiki and ((numcrap==91) or (numcrap==93))) then
boocriminal = true
break
end--if
if (boonotskl and ((numcrap==123) or (numcrap==125))) then
boocriminal = true
break
end--if
end--if
numcraq = numcrap -- previous
numindexx = numindexx + 1
end--while
end--if (boonohttp and (string.find(strinpil,"[http",1,true))) else
return boocriminal
end--function lfillegal
 
------------------------------------------------------------------------
 
-- Local function LFDBLCMP
 
-- Check whether string begins with one of 2 supplied reference strings
 
-- Input : - strinp
-- - strx4 (may be empty, partial result is false then)
-- - strx5 (may be empty, partial result is false then)
 
-- Output : - booequal ("true" if "strinp" begins with "strx4" or "strx5")
 
local function lfdblcmp (strinp, strx4, strx5)
local numlenin = 0
local numleeen = 0
local booequal = false
numlenin = string.len (strinp) -- length of input string to be tested
numleeen = string.len (strx4)
if ((numleeen~=0) and (numleeen<=numlenin)) then
if (string.sub(strinp,1,numleeen)==strx4) then
booequal = true -- hit against "strx4"
end--if
end--if
numleeen = string.len (strx5)
if ((numleeen~=0) and (numleeen<=numlenin)) then
if (string.sub(strinp,1,numleeen)==strx5) then
booequal = true -- hit against "strx5"
end--if
end--if
return booequal
end--function lfdblcmp
 
------------------------------------------------------------------------
 
-- Local function LFWARNA
 
-- Convert index 1...21 (1...7 8...14 15...21) to 6 HEX digits
 
-- Depends on const table "contabwarn"
 
local function lfwarna (numwarnaidx)
local strhexhex = '000000'
local strhexaut = ''
local numin5ex = 1
local numch5ar = 0
local boolajt = false
local boodark = false
if ((numwarnaidx>=1) and (numwarnaidx<=21)) then
boolajt = ((numwarnaidx>= 8) and (numwarnaidx<=14))
boodark = ((numwarnaidx>=15) and (numwarnaidx<=21))
if (boolajt) then
numwarnaidx = numwarnaidx - 7
end--if
if (boodark) then
numwarnaidx = numwarnaidx - 14
end--if
else
numwarnaidx = 7 -- grey
end--if
strhexhex = contabwarn [numwarnaidx] -- 1...7
while (true) do
if (numin5ex==7) then -- ONE-based
break -- done
end--if
numch5ar = string.byte (strhexhex,numin5ex,numin5ex)
if ((numin5ex==1) or (numin5ex==3) or (numin5ex==5)) then
if (numch5ar>57) then
numch5ar = numch5ar - 7 -- now 48...63
end--if
if (boolajt) then
numch5ar = numch5ar + 6
end--if
if (boodark) then
numch5ar = numch5ar - 6
end--if
if (numch5ar<48) then
numch5ar = 48 -- do NOT sink below ZERO
end--if
if (numch5ar>63) then
numch5ar = 63 -- do NOT grow above F AKA 15
end--if
if (numch5ar>57) then
numch5ar = numch5ar + 7 -- now 48...57 or 65...70
end--if
end--if
strhexaut = strhexaut .. string.char (numch5ar)
numin5ex = numin5ex + 1
end--while
return strhexaut
end--function lfwarna
 
------------------------------------------------------------------------
 
-- Local function LFPER6MUT
 
-- Permute RGB in a colour string
 
-- Input : - strhex6in (6 hex digits, no cross "#")
-- - numindepe (0...5)
 
-- Output : - strhex6out
 
local function lfper6mut (strhex6in, numindepe)
local strhexmm = ""
local strhexnn = ""
local strhexoo = ""
local strhex6out = ""
if (string.len(strhex6in)==6) then
strhexmm = string.sub (strhex6in,1,2)
strhexnn = string.sub (strhex6in,3,4)
strhexoo = string.sub (strhex6in,5,6)
if (numindepe==1) then
strhex6out = strhexmm .. strhexoo .. strhexnn
end--if
if (numindepe==2) then
strhex6out = strhexnn .. strhexmm .. strhexoo
end--if
if (numindepe==3) then
strhex6out = strhexnn .. strhexoo .. strhexmm
end--if
if (numindepe==4) then
strhex6out = strhexoo .. strhexmm .. strhexnn
end--if
if (numindepe==5) then
strhex6out = strhexoo .. strhexnn .. strhexmm
end--if
end--if
if (strhex6out=="") then
strhex6out = strhex6in -- unchanged if (numindepe==0) or invalid value
end--if
return strhex6out
end--function lfper6mut
 
------------------------------------------------------------------------
 
-- Local function LFLUKSALIGILO
 
-- Input : - one string and 3 numbers (1 of them tristate)
 
-- Enhance string (visible part of the link)
 
local function lfluksaligilo (strvysy, numenklo, numwarnanya, numwarnabkg)
local strstilo = ''
strvysy = "<b>" .. strvysy .. "</b>" -- text is BOLD, enclosement is NOT
if (numenklo==1) then
strvysy = "<small>&#91;</small>" .. strvysy .. "<small>&#93;</small>" -- "[" and "]"
end--if
if (numenklo==2) then
strvysy = "<small>(</small>" .. strvysy .. "<small>)</small>"
end--if
if (numwarnanya~=0) then
strstilo = 'color:#' .. lfwarna(numwarnanya) .. ';'
end--if
if (numwarnabkg~=0) then
strstilo = strstilo .. 'background-color:#' .. lfwarna(numwarnabkg) .. ';'
end--if
if (strstilo~="") then
strvysy = '<span style="' .. strstilo .. '">' .. strvysy .. '</span>'
end--if
return strvysy
end--function lfluksaligilo
 
------------------------------------------------------------------------
 
-- Local function LFBREWLINK
 
-- Brew a single link (maybe quasi-external http link, but actually
-- always internal not leaving the wiki)
 
-- Input : - numtyplnk -- base type of link 0...6
-- - numtuncas -- case tuning 0...4 (1: lower | 2: upper | 3 | 4)
-- (for ba types 1 2 5 6 only -- NOT for "^" and "~")
-- - numtungap -- gap tuning 0 or 1 (1: add space) (for ba types
-- 2 and 6 only -- NOT for "^" and "~")
-- - strfull -- fullpagename (category name must be already prefixed
-- by a dot like ":Category:Piracy", here we add wall,
-- visible string and brackets, ignored for type 4)
-- - strpostf -- postfix string (one letter, two letters, maybe
-- other type of char or short string, special values
-- "^" for "all" and "~" for "remainder" are permitted
-- for types 0 and 1 only, may NOT be empty, may not be
-- "''" (double apo), can be both "y" and "x" parts
-- concatenated in this order for 2-dim table
-- (caller has the responsibility)
-- - strvisi -- visible link string (may NOT be empty)
-- - numencl -- enclosement of the visible link string (0 none |
-- 1 "[" and "]" as "&#91;" and "&#93;" | 2 "(" and ")")
-- forwarded to "lfxcaseult"
-- - numw8, numw9
-- - boomowop -- true if <<#mw-pages>> desired (only type 0
-- and only category, caller has the responsibility)
-- - numruangnama -- namespace (required, use ZERO if no better
-- value available, ZERO is the default of the
-- wiki software, ZERO will NOT be passed to
-- the wiki, caller has the responsibility)
-- - strpos2pa -- for base link types 5 and 6 the "y" row part
 
-- Output : - strlaenken (always begins with "[" and ends with "]")
 
-- BEWARE: It is the caller's responsibility to make sure that the 12
-- parameters are valid and consistent.
 
-- The "strfull" fullpagename may contain plain spaces, no encoding
-- to underscore "_" or "%20" is needed since for base type 0 it goes
-- through "mw.uri.canonicalUrl". Gap tuning is possible only for base
-- link types 2 and 6 where we use wiki links thus spaces cannot cause
-- any major harm either.
 
-- Depends on sub "lfxcaseult" (in turn depends
-- on "lfcaseleto" and "lfutf8length")
 
-- "numtyplnk" values: 0 "from=" | 1 wiki link + "/" | 2 wiki link + raw pofi
-- 3 wiki link + "#" | 4 "#" section link
-- 5 combo 2-part link "/"+"#" 1+3
-- 6 combo 2-part link raw+"#" 2+3
 
-- With 2-part links (types 5 and 6) we use "strpos2pa" (only "y") and
-- "strpostf" ("y" and "x") in this order, otherwise we use only "strpostf"
-- and ignore "strpos2pa".
 
-- Incoming "strpos2pa" and "strpostf" are NOT used anymore after "stradrq"
-- and "strkrys" have been assigned from them. Only "stradrq" can be victim
-- of tuning. "stradrq" is needed even for bottom link "~" but NOT for
-- top link.
 
local function lfbrewlink (numtyplnk, numtuncas, numtungap, strfull, strpostf, strvisi, numencl, numw8, numw9, boomowop, numruangnama, strpos2pa)
local strlaenken = ""
local stradrq = "" -- part of address or http query
local strkrys = "" -- part after the cross "#"
local strquery = "" -- can have ZERO or 1 or 2 items
local booalltop = false -- all AKA top AKA "^"
local boorembot = false -- bottom AKA remainder AKA "~"
if (numtyplnk<=1) then
booalltop = (strpostf=="^") -- do not use "strpostf" "strpos2pa" "strkrys"
boorembot = (strpostf=="~") -- do not use "strpostf" "strpos2pa" "strkrys"
end--if
strvisi = lfluksaligilo (strvisi, numencl, numw8, numw9)
if ((booalltop==false) and (boorembot==false)) then
if (numtyplnk<=2) then
stradrq = strpostf -- "krys" NOT needed for 0 1 2
end--if
if (numtyplnk>=3) then
strkrys = strpostf -- "adre" maybe needed (for 5 and 6 only)
end--if
if (numtyplnk>=5) then
stradrq = strpos2pa -- "krys" needed and comes from "strpostf"
end--if
if (numtuncas==1) then
stradrq = lfxcaseult (stradrq, false, false) -- force lowercase beg
end--if
if (numtuncas==2) then
stradrq = lfxcaseult (stradrq, true, false) -- force uppercase beg
end--if
if (numtuncas==3) then
stradrq = lfxcaseult (stradrq, false, true) -- force lowercase all
end--if
if (numtuncas==4) then
stradrq = lfxcaseult (stradrq, true, true) -- force uppercase all
end--if
if (numtungap==1) then
stradrq = "_" .. stradrq -- add space encoded as underscore "_" (!!!)
end--if
end--if
if (boorembot) then
stradrq = "~" -- CRUCIAL & needed several times below ("strkrys" NOT used)
end--if
if ((numtyplnk==0) and (booalltop==false)) then
strquery = "from=" .. stradrq -- even for bottom AKA remainder but NOT top
end--if
if (numruangnama~=0) then
if (strquery~="") then
strquery = strquery .. "&" -- need "and" separator (NOT wall separator)
end--if
strquery = strquery .. "namespace=" .. tostring (numruangnama)
end--if
if (numtyplnk==0) then
if (strquery=="") then
strlaenken = tostring ( mw.uri.canonicalUrl ( strfull ) )
else
strlaenken = tostring ( mw.uri.canonicalUrl ( strfull , strquery ) )
end--if
end--if
if ((numtyplnk~=0) and (numtyplnk~=4)) then
strlaenken = strfull -- via "canonicalUrl" for 0 and not needed for 4
end--if
if (((numtyplnk==1) or (numtyplnk==5)) and (booalltop==false)) then
strlaenken = strlaenken .. "/" -- link type 1 or 5 (but NOT for "^")
end--if
if ((numtyplnk~=0) and (booalltop==false)) then
strlaenken = strlaenken .. stradrq -- type 1...6 -- tuning already done
end--if
if ((numtyplnk>=3) and (booalltop==false)) then
strlaenken = strlaenken .. "#" .. strkrys -- link type 3 or 4 or 5 or 6
end--if
if (boomowop) then
strlaenken = strlaenken .. "#mw-pages" -- only legal for type 0 some cases
end--if
if (numtyplnk==0) then
strlaenken = strlaenken .. " " -- separation space (NOT wall "|" in http)
else
strlaenken = strlaenken .. "|" -- wiki link
end--if
strlaenken = "[" .. strlaenken .. strvisi .. "]"
if (numtyplnk~=0) then
strlaenken = "[" .. strlaenken .. "]"
end--if
return strlaenken
end--function lfbrewlink
 
------------------------------------------------------------------------
 
---- MAIN EXPORTED FUNCTION ----
 
------------------------------------------------------------------------
 
function ind12dim.ek (arxframent)
 
-- various types 11 parameters (fpn,tit,dud,typ,mwp,ans,alf,fla,ctb,cos,pre)
 
local strfpn = "" -- fullpagename AKA title
local boohavfpn = false -- true even if "-" was supplied
local boofpns = false -- no fullpagename and link type 3 due to "fpn=-"
 
local strtit = "" -- title of the table
local bootits = false -- suppress table due to "tit=-"
 
local boodud = false -- berdimensi dua
 
local strtyp = "" -- base type & 2 tuning digits (guess "000" or ...)
local boohavtyp = false -- true even if "000" was supplied
local numtypb = 0 -- (0...6) ba type of link -- 0 "from=" 1 "/" 2 raw
local numtycas = 0 -- case tuning 0 or 1 2 3 4 (1 lower | 2 upper)
local numtygap = 0 -- gap tuning 0 or 1
 
local boomwp = false -- add <<#mw-pages>>
 
local numans = 0 -- namespace for "Special:AllPages"
local boohavans = false -- true even if ZERO was supplied
 
local strfla = ""
local boohavfla = false -- true even if "-" was supplied
local strflb4 = "" -- "top" link string ("all" "top" "^")
local strflb5 = "" -- "top" visible description
local strflb6 = "" -- "bottom" link string ("remainder" "bottom" "~")
local strflb7 = "" -- "bottom" visible description
local booflas = false -- suppress 2 extra links due to "fla=-"
 
local numctb = 0 -- (0...5) permutation of colour table background
local boohavctb = false -- true even if ZERO was supplied
 
local strcos = "" -- 6 d tuning col & sepa values (default "000000")
local boohavcos = false -- true even if "000000" was supplied
local numscw8 = 0
local numscw9 = 0
local numenkli = 0 -- forwarded to some calls, can be 0 or 1 only, []
local numspix = 0 -- (0...6) 1...6 indx "contabsepa" or ZERO -> NBSP
local boosepenh = false -- enhance separator with 2 NBSP:s if "true"
 
local strpre = "" -- default is empty "", empty value is even valid
local boohavpre = false -- true if param used (explicit empty impossible)
 
-- general unknown type
 
local vartmp = 0 -- variable without type
 
-- special type "args" AKA "arx"
 
local arxsomons = 0 -- metaized "args" from our own or caller's "frame"
 
-- general "tab"
 
local tababjad = {} -- fill in useful default content later if needed
 
-- general "str"
 
local strret = "" -- output string
local str1to4err = "" -- for error generation 1...4 char:s
local strapart = "" -- separator for 1-dim or no table from "contabsepa"
local strtmp = ""
local strtpm = ""
local stryonl = "" -- for 2-dimensional -- only "y"
local stryyxx = "" -- for 2-dimensional -- "y" and "x" concatenated
local strrow = "" -- for 2-dimensional
 
-- general "num"
 
local numerrk = 0 -- error code (0...20 -- 0 OK 1 inter 2 anon 3 ...)
local numabjad = 0 -- hard minimum 3 -- maximum ca 220
 
local numlong = 0 -- temp length of parameter
local numoct = 0 -- temp some char
local numsrcind = 0 -- temp for "alf=" conversion
local numunilen = 0 -- temp for "alf=" conversion
local numranger = 0 -- temp for "alf=" conversion
local numtmpx = 0 -- temp
local numtmpy = 0 -- temp
local numtmpz = 0 -- temp
 
local numclspl = 0 -- colspan left
local numclspr = 0 -- colspan right
 
-- general "boo" (no main fatal error flag here, see "numerrk")
 
local booiskat = false -- true for categories
local booisspe = false -- true for special pages
local boocrap = false -- temp (this is a local flag only)
local boomult = false -- temp
 
---- GUARD AGAINST INTERNAL ERROR ----
 
-- constrkatp5,constrkatp6,constrspep5,constrspep6 must be assigned
-- constrkatp5,constrspep5 must be non-empty
 
if ((type(constrkatp5)~="string") or (type(constrspep5)~="string")) then
numerrk = 1 -- #E01 -- internal
else
if ((constrkatp5=="") or (constrspep5=="")) then
numerrk = 1 -- #E01 -- internal
end--if
end--if
if ((type(constrkatp6)~="string") or (type(constrspep6)~="string")) then
numerrk = 1 -- #E01 -- internal
end--if
 
arxsomons = arxframent.args -- "args" from our own "frame" (F**K!!!)
strtmp = arxsomons[1]
strret=lfxcaseult(strtmp,true,true)
return strret
 
end--function
 
return ind12dim
17 817

redaktoj