-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser.lua
40 lines (38 loc) · 990 Bytes
/
parser.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require("lualibs.lua")
local inspect = require("inspect")
local function getJsonFromFile(file)
local fileHandle = io.open(file, "r")
local jsonData = nil
if fileHandle then
local jsonString = fileHandle:read("*a")
jsonData = utilities.json.tolua(jsonString)
fileHandle:close()
end
-- tex.print(" " .. jsonString .. "")
-- tex.print(tostring(inspect(jsonData)))
-- tex.print(tostring(jsonData == nil))
return jsonData
end
function printAuthors(file)
local json = getJsonFromFile(file)
-- tex.print(tostring(inspect(json)))
if json then
-- tex.print(tostring(inspect(json)))
-- tex.print("hey hey")
-- for author in json do
-- tex.print(tostring(inspect(author)))
for key, value in pairs(json) do
-- tex.print(key)
tex.print(
"{{\\bfseries Name:} "
.. value["vorname"]
.. " {\\scshape "
.. value["nachname"]
.. "}\\par} & & & {{\\bfseries Mat. Nr:} "
.. value["matNumb"]
.. "\\par} & & \\\\"
)
end
-- end
end
end