Module:Sandbox/Jeblad/NLG/layout explained

local conf = require 'Module:NLG/layout/conf'('en')

--- Table acting as a class for Taglocal Tag = Tag.__index = Tag

setmetatable(Tag,)

--- Initialiser for the Tag class-- @param t table holding additional datafunction Tag:_init(t) self._data = t self._position = t and t.position or 50end

--- Set values in the instance-- @return table representing selffunction Tag:set(t) if t then if t.position then self._position = t.position end end return selfend

--- Get the name-- @return string representing the name, otherwise nilfunction Tag:name return self._data.nameend

--- Get the after list-- @return list of strings representing the tags, otherwise nilfunction Tag:after return self._data.after or end

--- Get the before list-- @return list of strings representing the tags, otherwise nilfunction Tag:before return self._data.before or end

--- Get the position-- @return number representing the position, otherwise nilfunction Tag:position return self._positionend

local layout =

if 1 or _G['_BDD'] then layout['Tag'] = Tagend

layout.order = function(t) local registry = for _,v in ipairs(t) do registry[v.name] = Tag(v):set end for _,v in ipairs(t) do local vTag = registry[v.name] for _,w in ipairs(vTag:after) do local wTag = registry[w.name] local diff = vTag:position - wTag:position if diff < 0 then local position = vTag:position + 0.4 * diff vTag:set end end end local max = -100 local min = 200 for _,v in pairs(registry) do if max < v:position then max = v:position end if min > v:position then min = v:position end end mw.logObject(min) mw.logObject(max) local scale = 100/(max-min) mw.logObject(scale) for _,v in pairs(registry) do local position = scale*v:position + min v:set end return orderend

return layout