وحدة:Art pref/data
المظهر
![](http://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Test_Template_Info-Icon_-_Version_%282%29.svg/50px-Test_Template_Info-Icon_-_Version_%282%29.svg.png)
local title_object = mw.title.getCurrentTitle();
local content;
local ret = {}
if 10 ~= title_object.namespace then
content = title_object:getContent() or '';
end
if not content then
return ret;
end
local start = content:find('{{ *تفضيلات مقالة[%s\n]*[|}]');
if start then
local config_template = content:match ('%b{}', start);
if not config_template then
return ret;
end
local params_t = mw.text.split (config_template:gsub ('^{{%s*', ''):gsub ('[%s\n]*}}$', ''), '[%s\n]*|[%s\n]*');
table.remove (params_t, 1);
for _, param in ipairs (params_t) do
local k, v, t = param:match ('([^=]-)%s*=%s*(.+)'); -- <k> is the parameter name; <v> is parameter's assigned value
if k then
if k:find (':') then
t, k = k:match ('([^:]-):(.+)');
else
t="عام"
end
if ret[t] then
ret[t][k]=v
else
ret[t] = {[k]=v}
end
end
end
end
return ret