From 2ed2e87d4f07a38426a968a683779b6eaf34637f Mon Sep 17 00:00:00 2001 From: malc Date: Mon, 28 Nov 2016 13:28:11 +0300 Subject: [PATCH] Restore info wrt. dates --- link.c | 5 +++-- main.ml | 29 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/link.c b/link.c index 1d5ed15..d98b655 100644 --- a/link.c +++ b/link.c @@ -507,8 +507,9 @@ static void pdfinfo (void) { FZ_META_INFO_AUTHOR, "Author" }, { FZ_META_FORMAT, "Format" }, { FZ_META_ENCRYPTION, "Encryption" }, - { "Info:Creator", "Creator" }, - { "Info:Producer", "Producer" }, + { "info:Creator", "Creator" }, + { "info:Producer", "Producer" }, + { "info:CreationDate", "Creation date" }, }; for (size_t i = 0; i < sizeof (metatbl) / sizeof (metatbl[1]); ++i) { diff --git a/main.ml b/main.ml index e564254..c645f6a 100644 --- a/main.ml +++ b/main.ml @@ -1852,27 +1852,27 @@ let act cmds = state.reprf <- (fun () -> gotopagexy !wtmode n (float l) (float t)) | "info", args -> - let pos = nindex args '\t' in + let c, v = splitatchar args '\t' in let s = - if pos >= 0 + if nonemptystr v then - if substratis args 0 "Title" - then - let s = String.sub args (pos+1) @@ String.length args - pos - 1 in - conf.title <- s; - Wsi.settitle s; + if c = "Title" + then ( + conf.title <- v; + Wsi.settitle v; args + ) else - if substratis args 0 "CreationDate" + if let len = String.length c in + len > 6 && ((String.sub c (len-4) 4) = "date") then ( - if String.length args >= pos + 7 - && args.[pos+1] = 'D' && args.[pos+2] = ':' + if String.length v >= 7 && v.[0] = 'D' && v.[1] = ':' then - let b = Buffer.create 18 in - Buffer.add_string b "CreationDate\t"; + let b = Buffer.create 10 in + Printf.bprintf b "%s\t" c; let sub p l c = try - Buffer.add_substring b args (pos+p+1) l; + Buffer.add_substring b v p l; Buffer.add_char b c; with exn -> Buffer.add_string b @@ exntos exn in @@ -1883,8 +1883,7 @@ let act cmds = sub 12 2 ':'; sub 14 2 ' '; Buffer.add_char b '['; - Buffer.add_substring b args (pos+1) - (String.length args - pos - 1); + Buffer.add_string b v; Buffer.add_char b ']'; Buffer.contents b else args -- 2.11.4.GIT