aboutsummaryrefslogtreecommitdiff
path: root/lexercise.lua
diff options
context:
space:
mode:
authorFrank Fuhlbrück2022-01-25 18:48:11 +0100
committerFrank Fuhlbrück2022-01-25 18:48:11 +0100
commit6766e3f2cd846b770fa131664053521dbfb9171a (patch)
treeef272e0040cd3a8bc3ce97c59fb62988b10ec742 /lexercise.lua
parent6fe5baf09d0222b4e3546e29fd6897f857483755 (diff)
downloadexercisesheets-6766e3f2cd846b770fa131664053521dbfb9171a.tar.gz
exercisesheets-6766e3f2cd846b770fa131664053521dbfb9171a.tar.bz2
exercisesheets-6766e3f2cd846b770fa131664053521dbfb9171a.zip
Lua interface progress
Diffstat (limited to 'lexercise.lua')
-rw-r--r--lexercise.lua76
1 files changed, 0 insertions, 76 deletions
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
-