Изменения

Перейти к навигации Перейти к поиску
assimilating spans
Строка 139: Строка 139:  
-- If there is only one child node, and it can be safely assimilated into the parent node:
 
-- If there is only one child node, and it can be safely assimilated into the parent node:
 
local function assimilate (node)
 
local function assimilate (node)
if #node == 0 or #node > 1 then
+
if #node ~= 1 then
 
return node
 
return node
 
end
 
end
Строка 150: Строка 150:  
child = assimilate (child)
 
child = assimilate (child)
 
for key, value in pairs (child) do
 
for key, value in pairs (child) do
if key == 'style' and node [key] and node [key] ~= '' then
+
if key ~= '__name' then
node [key] = node [key] .. '; ' .. value
+
if key == 'style' and node [key] and node [key] ~= '' then
else
+
node [key] = node [key] .. '; ' .. value
node [key] = value
+
else
 +
node [key] = value
 +
end
 
end
 
end
 
end
 
end
node [1] = child [1]
   
end
 
end
 
return node
 
return node
Строка 236: Строка 237:  
--return frame:preprocess (tostring (grammar:match (test)))
 
--return frame:preprocess (tostring (grammar:match (test)))
 
return mw.dumpObject (grammar:match (test))
 
return mw.dumpObject (grammar:match (test))
 +
end,
 +
test2 = function (txt)
 +
return mw.dumpObject (grammar:match (txt))
 
end
 
end
 
}
 
}

Реклама:

Навигация