competitest.nvim icon indicating copy to clipboard operation
competitest.nvim copied to clipboard

Add functionality to ignore periods and replace spaces with underscore in the filename

Open realasib opened this issue 1 year ago • 0 comments

Prevoiusly the filename was something like this image

I've added this function in the receive.lua file to modify the filename so that it:

  • Replace spaces with underscores
  • Remove periods
-- New function to process the problem name
local function process_problem_name(name)
	name = name:gsub("%s+", "_") -- Replace spaces with underscores
	name = name:gsub("%.", "") -- Remove periods
	return name
end

I also changed the PROBLEM var in receive_modifiers from this

["PROBLEM"] = task.name, -- problem name, name field

to

["PROBLEM"] = process_problem_name(task.name), -- problem name, name field, processed

this.

And now the filename look like this: image

realasib avatar Oct 16 '24 03:10 realasib