Module:Process Query Output 3b: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 31: | Line 31: | ||
end | end | ||
combined_length_of_parts = combined_length_of_parts + #query_output_tbl - 1 | combined_length_of_parts = combined_length_of_parts + #query_output_tbl - 1 | ||
if combined_length_of_parts == #full_query_arg then | |||
length_test = "lengths are equal" | |||
else | |||
length_test = "lengths are equal" | |||
end | |||
| Line 41: | Line 45: | ||
concatenated_string_2 = concatenated_string_2 .. "</ul>" | concatenated_string_2 = concatenated_string_2 .. "</ul>" | ||
return concatenated_string .. concatenated_string_2 .. "<ul><li>" .. length_test "</li></ul>" | return concatenated_string .. concatenated_string_2 .. "<ul><li>" .. length_test .. "</li></ul>" | ||
Latest revision as of 23:43, 4 December 2025
Documentation for this module may be created at Module:Process Query Output 3b/doc
local p = {}
function p.processData(frame)
local pages_only_arg = frame.args["pages_only"]
local full_query_arg = frame.args["full_query"]
--local vartype = type(plainlistString)
local page_names_array = mw.text.split(pages_only_arg, ",")
for i = 1, #page_names_array do
page_names_array[i] = mw.text.trim(page_names_array[i])
end
local concatenated_string = "<ul>"
for i, v in ipairs(page_names_array) do
concatenated_string = concatenated_string .. "<li>" .. i .. ": " .. v .. "</li>"
end
concatenated_string = concatenated_string .. "</ul>"
query_output_tbl = {}
query_output_tbl = mw.text.split(full_query_arg, ", ")
combined_length_of_parts = 0
for i, v in ipairs(query_output_tbl) do
combined_length_of_parts = combined_length_of_parts + #v
end
combined_length_of_parts = combined_length_of_parts + #query_output_tbl - 1
if combined_length_of_parts == #full_query_arg then
length_test = "lengths are equal"
else
length_test = "lengths are equal"
end
concatenated_string_2 = "<ul>"
for k, v in pairs(query_output_tbl) do
concatenated_string_2 = concatenated_string_2 .. "<li>" .. k .. ": " .. v .. "</li>"
end
concatenated_string_2 = concatenated_string_2 .. "</ul>"
return concatenated_string .. concatenated_string_2 .. "<ul><li>" .. length_test .. "</li></ul>"
end
return p