More actions
Created page with "local p = {} function p.increaseHeadings(frame) local content = frame.args[1] or '' -- Replace headings with one level higher (e.g., == becomes ===) content = mw.ustring.gsub(content, '^(=+)(.-)(=+)$', function(eq1, text, eq2) if #eq1 == #eq2 then local newLevel = eq1 .. '=' return newLevel .. text .. newLevel else return eq1 .. text .. eq2 end end) return content end return p" |
m Gpe moved page Module:H to Module:IncreaseHeadings without leaving a redirect |
(No difference)
|
Revision as of 01:29, 26 December 2024
Documentation for this module may be created at Module:IncreaseHeadings/doc
local p = {}
function p.increaseHeadings(frame)
local content = frame.args[1] or ''
-- Replace headings with one level higher (e.g., == becomes ===)
content = mw.ustring.gsub(content, '^(=+)(.-)(=+)$', function(eq1, text, eq2)
if #eq1 == #eq2 then
local newLevel = eq1 .. '='
return newLevel .. text .. newLevel
else
return eq1 .. text .. eq2
end
end)
return content
end
return p