save_metadata = function(node) --print('saving metadata for', node.id) local mfile = metadata_file(node.id) local mpath if node.metadata.parent then mpath = full_path('comments/'..mfile) else mpath = full_path(mfile) end print('saving metadata for', node.id, 'to', mpath) local status, err = App.write_file(mpath, json.encode(node.metadata)) if err then error(err) end end