mirror of
https://github.com/danbee/danbarber.me.hugo.git
synced 2025-03-04 08:59:18 +00:00
Scripts here really fuck with Hugo
This commit is contained in:
parent
386544fb71
commit
566a40f84b
@ -1,24 +0,0 @@
|
|||||||
#!/usr/bin/env ruby
|
|
||||||
|
|
||||||
require "date"
|
|
||||||
require "fileutils"
|
|
||||||
require "front_matter_parser"
|
|
||||||
|
|
||||||
unsafe_yaml_loader = ->(string) { YAML.load(string) }
|
|
||||||
|
|
||||||
Dir.glob("./**/*.md").each do |file|
|
|
||||||
parsed_file = FrontMatterParser::Parser.
|
|
||||||
parse_file(file, loader: unsafe_yaml_loader)
|
|
||||||
|
|
||||||
date = DateTime.parse(parsed_file["date"].to_s).iso8601
|
|
||||||
|
|
||||||
new_content = <<~CONTENT
|
|
||||||
#{parsed_file.front_matter.merge("date" => date).to_yaml}---
|
|
||||||
|
|
||||||
#{parsed_file.content}
|
|
||||||
CONTENT
|
|
||||||
|
|
||||||
File.open(file, "w") do |new_file|
|
|
||||||
new_file.write(new_content)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Loading…
Reference in New Issue
Block a user