From 6766e3f2cd846b770fa131664053521dbfb9171a Mon Sep 17 00:00:00 2001 From: Frank Fuhlbrück Date: Tue, 25 Jan 2022 18:48:11 +0100 Subject: Lua interface progress --- lexercise.lua | 76 ----------------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 lexercise.lua (limited to 'lexercise.lua') diff --git a/lexercise.lua b/lexercise.lua deleted file mode 100644 index 22649d5..0000000 --- a/lexercise.lua +++ /dev/null @@ -1,76 +0,0 @@ -solution = function(sol) - if type(sol) ~= "string" then - local solt = sol - sol = "[" - if solt.idea then - sol = sol .. "idea," - end - if solt.name then - sol = sol .. "strings/solution={"..solt.name.."}," - end - sol = sol .. "] " .. (solt.text or "") - end - return [[\begin{solution}]]..sol..[[\end{solution}]] -end - -subexercise = function(se) - local pts = "" - local sols = "" - if type(se) ~= "string" then - local set = se - se = "[" - if set.points then - pts = [[\points{]] .. set.points ..[[}]] - end - if set.solution then - sols = sols .. solution(set.solution) - end - if set.altsolutions then - for _,sol in ipairs(set.altsolutions) do - sols = sols .. solution(sol) - end - end - se = se .. "]{" .. (set.task or "") .. "}" - end - return [[\subtask]]..se .. pts .. sols -end - -exercise = function(ex) - local ece = [[\begin{exercise}[]] - if ex.firstline then - ece = ece .. [[firstline={]] .. ex.firstline .. [[},]] - end - if ex.points then - ece = ece .. [[points={]] .. ex.points .. [[},]] - end - if ex.name then - ece = ece .. [[name={]] .. ex.name .. [[},]] - end - if ex.options then - ece = ece .. ex.options .. "," - end - ece = ece .. "]{}" - if ex.task then - ece = ece .. [[\begin{maintask}]] .. ex.task - .. [[\end{maintask}]] - end - if ex.solution then - ece = ece .. solution(ex.solution) - end - if ex.altsolutions then - for _,sol in ipairs(ex.altsolutions) do - ece = ece .. solution(sol) - end - end - if ex.subexercises then - ece = ece .. [[\begin{subtasks}]] - for _,se in ipairs(ex.subexercises) do - ece = ece .. subexercise(se) - end - ece = ece .. [[\end{subtasks}]] - end - ece = ece .. "\n" .. [[\end{exercise}]] - print(ece) - return ece -end - -- cgit v1.2.3