I recently converted this page to use Zola, and in doing so I had to migrate the frontmatter for the actual pages.
I did so using this small script I whipped up:
#!/usr/bin/env ruby
if ARGV.empty?
STDERR.puts
exit(-1)
end
filename = File.expand_path(ARGV.shift)
if !File.exist?(filename)
STDERR.puts
exit(-2)
end
STDERR.puts filename
contents = File.read(filename)
_, frontmatter, body = contents.split().map(&:strip)
frontmatter = YAML.load(frontmatter, permitted_classes: [Time])
case value
when Time
when Array
value.to_s
when true, false
value
else
end
end
puts
frontmatter.each do
puts
end
puts
puts
puts body
Yes, it's in Ruby. That's the language I came to think of that I know, have installed, and that has a built-in YAML library.
It's also not very pretty, but that's what a quick hack looks like, I guess.