fixed article renamed when title changes
This commit is contained in:
parent
bafec4a287
commit
152f1695d2
@ -62,6 +62,7 @@ let form ?(header_tpl=None) blog_url lgrn ymd =
|
||||
let auth_name = either ymd.meta.author.Author.name Logarion.Configuration.(lgrn.owner) in
|
||||
let auth_addr = either ymd.meta.author.Author.email Logarion.Configuration.(lgrn.email) in
|
||||
[
|
||||
input ~a:[a_name "uuid"; a_value (Id.to_string ymd.meta.uuid); a_hidden ()] ();
|
||||
input_set
|
||||
"Title"
|
||||
(input ~a:[a_name "title"; a_value ymd.meta.title; a_required ()] ());
|
||||
|
@ -42,8 +42,15 @@ let file_meta_pairs () =
|
||||
List.map t ymds
|
||||
|
||||
let to_file ymd =
|
||||
let path = "ymd/" ^ (Ymd.filename ymd) ^ ".ymd" in
|
||||
let fmp = file_meta_pairs () in
|
||||
let path = ("ymd/" ^ (Ymd.filename ymd) ^ ".ymd") in
|
||||
let write_ymd out = Lwt_io.write out (Ymd.to_string ymd) in
|
||||
let open Ymd in
|
||||
(try
|
||||
let (file, m) = List.find (fun (_, meta) -> meta.uuid = ymd.meta.uuid) fmp in
|
||||
let fp = "ymd/" ^ file in
|
||||
Unix.rename fp path;
|
||||
with Not_found -> ());
|
||||
Lwt_io.with_file ~mode:Lwt_io.output path write_ymd
|
||||
|
||||
let latest_file_meta_pair fragment =
|
||||
|
Loading…
x
Reference in New Issue
Block a user