Открыть главное меню
Главная
Случайная
Войти
Настройки
Описание проекта «Информаторий»
Отказ от ответственности
in.wiki
Найти
Изменения
← Предыдущая правка
Следующая правка →
Модуль:RadicalWikifier
(посмотреть исходный код)
Версия от 16:53, 3 сентября 2023
79 байт добавлено
,
2 года назад
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
}
}
Александр Машин
Бюрократы
, steward,
Администраторы
1714
правок