Module:MathModDBHelperMethods

From MaRDI portal
Revision as of 08:56, 25 July 2025 by TA4Shehu (talk | contribs) (Created page with "-- MediaWiki library for logging and utilities local mw = require('mw') local json = require("mw.text") -- Main table to hold all functions local p = {} -- Function to replace pattern in the comma pattern separated list function p.replace_pattern(frame) local input = frame.args[1] or "" local sep = frame.args[2] or " " -- default to space if no separator given -- Replace comma+pattern (,xxxx) with sep local result = string.gsub(input, ",xxxx%s*", sep...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:MathModDBHelperMethods/doc

-- MediaWiki library for logging and utilities
local mw = require('mw')
local json = require("mw.text") 

-- Main table to hold all functions
local p = {}

-- Function to replace pattern in the comma pattern separated list 
function p.replace_pattern(frame)
    local input = frame.args[1] or ""
    local sep = frame.args[2] or " "  -- default to space if no separator given
    -- Replace comma+pattern (,xxxx) with sep
    local result = string.gsub(input, ",xxxx%s*", sep)
    return result
end

return p