More actions
Content deleted Content added
No edit summary Tag: Reverted |
No edit summary |
||
(11 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
function p.transclude(frame) |
function p.transclude(frame) |
||
-- Get and preprocess the input |
-- Get and preprocess the input |
||
local |
local raw_input = frame.args[1] or '' |
||
local processed_input = 'yoggle' .. raw_input:gsub('E', 's') .. 'yoggle' |
|||
⚫ | |||
⚫ | |||
-- Handle multiple consecutive newlines and spaces |
|||
return string.format( |
|||
for line in input:gmatch("[^%s]+") do |
|||
"Raw input:\n<pre>%s</pre>\n\nProcessed input:\n<pre>%s</pre>", |
|||
-- Trim any remaining whitespace |
|||
⚫ | |||
line = line:match("^%s*(.-)%s*$") |
|||
processed_input |
|||
⚫ | |||
table.insert(output, string.format("{{%s}}", line)) |
|||
⚫ | |||
end |
|||
⚫ | |||
-- Join with single newlines |
|||
return table.concat(output, "\n") |
|||
end |
end |
||
Latest revision as of 11:53, 14 January 2025
Documentation for this module may be created at Module:Transclude/doc
local p = {}
function p.transclude(frame)
-- Get and preprocess the input
local raw_input = frame.args[1] or ''
local processed_input = 'yoggle' .. raw_input:gsub('E', 's') .. 'yoggle'
-- Debug output
return string.format(
"Raw input:\n<pre>%s</pre>\n\nProcessed input:\n<pre>%s</pre>",
raw_input,
processed_input
)
end
return p