diff --git a/lua/rr.example.lua b/lua/rr.example.lua index 4822adb..9a6992d 100644 --- a/lua/rr.example.lua +++ b/lua/rr.example.lua @@ -69,25 +69,25 @@ function list_field_types(xs_result) return result end +function filename(str) + local name = string.gsub(str, "(.*/)(.*)", "%2") + return name +end ---local ms_form = rr.json("/Users/tbr/Desktop/ms_form.json") -local xs_result = rr.json("/Volumes/data/problematics/10138832-0ec5-4ea9-bf9e-2d863f714b6c-result.json") -local xs_fields = group_by_type(xs_result) -local record = rr.recording("fix") -record:image("steets_city_mixup", "/Volumes/data/problematics/street_city_mixup.png") -for field_type, fields in pairs(xs_fields) do - for field_name, sub_fields in pairs(fields) do - record:text_objects("steets_city_mixup/" .. field_type .. "/" .. field_name, sub_fields) +function show(name, document, xs_result_path) + local xs_result = rr.json(xs_result_path) + local xs_fields = group_by_type(xs_result) + local record = rr.recording(name) + record:image(name, document) + for field_type, fields in pairs(xs_fields) do + for field_name, sub_fields in pairs(fields) do + record:text_objects(name .. "/" .. field_type .. "/" .. field_name, sub_fields) + end end end +local master = "/Volumes/data/problematics/10138832-0ec5-4ea9-bf9e-2d863f714b6c-result.json" +local fix = "/Volumes/data/problematics/10138832-0ec5-4ea9-bf9e-2d863f714b6c-result.json" ---local master_xs_result = rr.json("/Volumes/data/problematics/0636036f-6ade-41db-8fbe-1a97b2cdb6ca-result.json") ---local master_fields = group_by_type(master_xs_result) ---local master_record = rr.recording("master") ---master_record:image("steets_city_mixup", "/Volumes/data/problematics/street_city_mixup.png") ---for field_type, fields in pairs(master_fields) do --- for field_name, sub_fields in pairs(fields) do --- master_record:text_objects("steets_city_mixup/" .. field_type .. "/" .. field_name, sub_fields) --- end ---end +show("master","/Volumes/data/problematics/street_city_mixup.png", master ) +show("fix","/Volumes/data/problematics/street_city_mixup.png", fix )