58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/octodmin/post.rb', line 58
def update(params)
delete
octopost = Octopress::Post.new(Octopress.site, {
"path" => @post.path,
"date" => params["date"],
"slug" => params["slug"],
"title" => params["title"],
"force" => true,
})
options = Hash[@site.config["octodmin"]["front_matter"].keys.map do |key|
[key, params[key]]
end]
content = params["content"].gsub("\r\n", "\n").strip
result = "---\n#{options.map { |k, v| "#{k}: \"#{v}\"" }.join("\n")}\n---\n\n#{content}\n"
octopost.instance_variable_set(:@content, result)
octopost.write
@post = post_for(octopost)
git = Git.open(Octodmin::App.dir)
git.add(octopost.path)
git.reset(octopost.path)
end
|