feat: Allow after_each option in template
This commit is contained in:
@@ -126,6 +126,9 @@ neogen.default_generator = function(parent, data, template, required_type)
|
|||||||
for _, value in ipairs(data[inserted_type]) do
|
for _, value in ipairs(data[inserted_type]) do
|
||||||
local inserted = conditional_prefix_inserter(prefix, formatted_string:format(value))
|
local inserted = conditional_prefix_inserter(prefix, formatted_string:format(value))
|
||||||
table.insert(result, inserted)
|
table.insert(result, inserted)
|
||||||
|
if opts.after_each then
|
||||||
|
table.insert(result, conditional_prefix_inserter(prefix, opts.after_each))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif type(inserted_type) == "table" and data[opts.required] then
|
elseif type(inserted_type) == "table" and data[opts.required] then
|
||||||
-- First item in the template item can be a table.
|
-- First item in the template item can be a table.
|
||||||
@@ -151,6 +154,9 @@ neogen.default_generator = function(parent, data, template, required_type)
|
|||||||
formatted_string:format(unpack(_values))
|
formatted_string:format(unpack(_values))
|
||||||
)
|
)
|
||||||
table.insert(result, inserted)
|
table.insert(result, inserted)
|
||||||
|
if opts.after_each then
|
||||||
|
table.insert(result, conditional_prefix_inserter(prefix, opts.after_each))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user