Editing Module:BucketGet
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 369: | Line 369: | ||
end | end | ||
row[spec.alias .. i] = val or "" | |||
row[spec.alias .. i] = val | |||
end | end | ||
end | end | ||
| Line 488: | Line 481: | ||
local function normalizeUserformatValue(value) | local function normalizeUserformatValue(value) | ||
-- Missing values. | -- Missing values. | ||
if value == nil | if value == nil then | ||
return '' | |||
end | |||
-- Boolean false should not become "false". | |||
if value == false then | |||
return '' | return '' | ||
end | end | ||
| Line 500: | Line 498: | ||
local s = mw.text.trim(tostring(v)) | local s = mw.text.trim(tostring(v)) | ||
if s ~= '' then | |||
if s ~= ' | |||
table.insert(values, s) | table.insert(values, s) | ||
end | end | ||
| Line 520: | Line 510: | ||
value = mw.text.trim(tostring(value)) | value = mw.text.trim(tostring(value)) | ||
-- Treat | -- Treat common null representations as empty. | ||
local lower = mw.ustring.lower(value) | local lower = mw.ustring.lower(value) | ||
| Line 526: | Line 516: | ||
or lower == 'null' | or lower == 'null' | ||
or lower == 'nil' | or lower == 'nil' | ||
or lower == 'false | or lower == 'false' then | ||
return '' | return '' | ||
end | end | ||
-- Remove non-breaking spaces. | -- Remove non-breaking spaces if a bucket value happens | ||
-- to contain them. | |||
value = value:gsub('\194\160', ' ') | value = value:gsub('\194\160', ' ') | ||
| Line 559: | Line 549: | ||
for _, col in ipairs(columns) do | for _, col in ipairs(columns) do | ||
local value = | local value = | ||
normalizeUserformatValue( | normalizeUserformatValue(row[col.alias]) | ||
local placeholder = | local placeholder = | ||
| Line 822: | Line 810: | ||
local value = row[fmt_info.column] | local value = row[fmt_info.column] | ||
if value == nil then | |||
if value == nil | value = '' | ||
elseif type(value) == "table" then | elseif type(value) == "table" then | ||
| Line 842: | Line 817: | ||
for _, v in ipairs(value) do | for _, v in ipairs(value) do | ||
local | local formatted = | ||
fmt_info.format:gsub( | |||
"%%s", | |||
function() | |||
return v or '' | |||
end | |||
) | ) | ||
table.insert( | |||
formatted_values, | |||
formatted | |||
) | |||
end | end | ||
| Line 1,909: | Line 1,864: | ||
if group_by_str then | if group_by_str then | ||
local group_by_cols = | local group_by_cols = | ||
parseGroupBy(group_by_str) | parseGroupBy( | ||
group_by_str | |||
) | |||
local agg_specs = | local agg_specs = | ||