mirror of https://codeberg.org/cage/tinmop/
- fixed parsing of gempub metadata.
This commit is contained in:
parent
315b18a7d8
commit
ec2f480b25
|
@ -57,8 +57,12 @@
|
|||
gempub-version
|
||||
gempub-cover))
|
||||
|
||||
(defrule gempub-entry (and gempub-key (? gempub-blanks) gempub-key-value-separator
|
||||
(? gempub-blanks) gempub-value #\NewLine)
|
||||
(defrule linebreak (or #\NewLine #\Return))
|
||||
|
||||
(defrule gempub-entry (or (and gempub-key (? gempub-blanks) gempub-key-value-separator
|
||||
(? gempub-blanks) gempub-value (+ linebreak))
|
||||
(and gempub-key (? gempub-blanks) gempub-key-value-separator
|
||||
(? gempub-blanks) gempub-value))
|
||||
(:function (lambda (a) (list (first a) (fifth a)))))
|
||||
|
||||
(defrule gempub-metadata (* gempub-entry)
|
||||
|
@ -79,7 +83,10 @@
|
|||
(when (find +metadata-entry-name+ entries :test #'String=)
|
||||
(when-let ((metadata-raw (os-utils:unzip-single-file zip-file
|
||||
+metadata-entry-name+)))
|
||||
(parse 'gempub-metadata metadata-raw))))))
|
||||
(handler-case
|
||||
(parse 'gempub-metadata metadata-raw)
|
||||
(error (e)
|
||||
(error "Error parsing metadata from file ~s: ~a" zip-file e))))))))
|
||||
|
||||
(defun save-metadata (zip-file)
|
||||
(when-let ((metadata (extract-metadata zip-file)))
|
||||
|
|
Loading…
Reference in New Issue