Support References field
git-svn-id: file:///srv/svn/repo/kosuzu/trunk@38 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
@@ -25,7 +25,9 @@ let oldest a b = Date.(compare b.date a.date)
|
||||
let str key m = try String_map.find (String.lowercase_ascii key) m.string_map with Not_found -> ""
|
||||
let set key m = try String_map.find (String.lowercase_ascii key) m.stringset_map with Not_found -> String_set.empty
|
||||
let str_set key m = String_set.to_string @@ set key m
|
||||
let with_str_set m key str = { m with stringset_map = String_map.add (String.lowercase_ascii key) (String_set.of_string str) m.stringset_map }
|
||||
let with_str_set m key str = { m with
|
||||
stringset_map = String_map.add (String.lowercase_ascii key) (String_set.of_string str) m.stringset_map
|
||||
}
|
||||
|
||||
let with_kv x (k,v) =
|
||||
let trim = String.trim in
|
||||
@@ -37,7 +39,7 @@ let with_kv x (k,v) =
|
||||
| "authors" -> { x with authors = Person.Set.of_string (trim v)}
|
||||
| "date" -> { x with date = Date.{ x.date with created = Date.of_string v }}
|
||||
| "date-edited"-> { x with date = Date.{ x.date with edited = Date.of_string v }}
|
||||
| "licences" | "topics" | "keywords" | "series" as k -> with_str_set x k v
|
||||
| "licences" | "topics" | "keywords" | "references" | "series" as k -> with_str_set x k v
|
||||
| k -> { x with string_map = String_map.add k (trim v) x.string_map }
|
||||
|
||||
let kv_of_string line = match Str.(bounded_split (regexp ": *")) line 2 with
|
||||
@@ -77,6 +79,7 @@ let to_string x =
|
||||
s "Licences" (str_set "licences" x);
|
||||
s "Topics" (str_set "topics" x);
|
||||
s "Keywords" (str_set "keywords" x);
|
||||
s "References"(str_set "references" x);
|
||||
s "Series" (str_set "series" x);
|
||||
s "Abstract" (str "abstract" x);
|
||||
s "Alias" (str "Alias" x)
|
||||
|
||||
Reference in New Issue
Block a user