Skip to content

Commit

Permalink
two more safeguards
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena committed Jun 14, 2024
1 parent 2da7d43 commit 16ee538
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions _plugins/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ def generate(site)
slides_data = site.pages.select { |p2| p2.url == "/#{directory}/slides.html" }[0]
p.update(slides_data.data) if slides_data&.data

if !Dir.exist?(File.dirname(path))
FileUtils.mkdir_p(File.dirname(path))
end
File.write(path, JSON.generate(p))
end

Expand All @@ -394,6 +397,9 @@ def generate(site)
p = material.dup
p.delete('ref')
p['contributors'] = Gtn::Contributors.get_contributors(p).dup.map { |c| mapContributor(site, c) }
if !Dir.exist?(File.dirname(path))
FileUtils.mkdir_p(File.dirname(path))
end
File.write(path, JSON.generate(p))
end
end
Expand Down

0 comments on commit 16ee538

Please sign in to comment.