So, I just wrote a preprocessor script that does this for me in Lua.
Code:
if not arg[1] then error "No template file given." end
print("Generating tf2items configuration from "..arg[1])
local finishedFile = ""
function parse(file)
local out=""
for line in io.lines(file) do
if line:match("[ \t]+#inc \"(.+)\"") then
print("included file: "..line:match("[ \t]+#inc \"(.+)\""))
out=out..parse(line:match("[ \t]+#inc \"(.+)\""))
else
out=out..line.."\n"
end
end
return out
end
finishedFile=parse(arg[1])
print("Done generating output.")
f=io.open("tf2items.weapons.txt","w")
f:write(finishedFile)
f:close()
Run it with lua script.lua template.txt
where a template is like a normal config file but lets you include files with #inc "filename"