blob: ef7f3bf43698525353aa1fb646b379f5e0bc8eb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- Test fixture for the cgit Lua filter API, exercised by tests/t0111-filter.sh.
-- It echoes the filter_open arguments and upper-cases the body, which lets the
-- test confirm that arguments and content flow through the lua: filter path. It
-- is not a production filter. Runs on Lua 5.1 through 5.4 and LuaJIT.

function filter_open(...)
	buffer = ""
	for i = 1, select("#", ...) do
		buffer = buffer .. select(i, ...) .. " "
	end
end

function filter_close()
	html(buffer)
	return 0
end

function filter_write(str)
	buffer = buffer .. string.upper(str)
end