diff options
Diffstat (limited to 'utils/cover')
-rw-r--r-- | utils/cover/cover.scm | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/utils/cover/cover.scm b/utils/cover/cover.scm index cde9c10..0cc573e 100644 --- a/utils/cover/cover.scm +++ b/utils/cover/cover.scm @@ -69,6 +69,17 @@ #\newline)))))) +(define (get-string key alist) + (let ((val (assoc key alist))) + (if (pair? val) + (cdr val) + ""))) +(define (get-list key alist) + (let ((val (assoc key alist))) + (if (pair? val) + (vector->list (cdr val)) + '()))) + (define (metadata->svg metadata outport) (let* (;B5 Paper size @@ -76,15 +87,16 @@ (page-width 176) ;mm (margin 3) ;mm - (isbn "9780201379624") - (book-title "Programación en Python") - (book-subtitle "Introducción a la programación y al lenguaje") + (isbn (if (equal? "" (get-string 'isbn metadata)) + "0000000000000")) + (book-title (get-string 'title metadata)) + (book-subtitle (get-string 'subtitle metadata)) (book-title-before "") ; TODO: Thinking about removing this (book-title-after book-subtitle) - (book-category "Básico") - (book-authors '("Giacomo Tesio" "Ekaitz Zarraga")) - (book-summary " ") - (company-info "") + (book-category (get-string 'category metadata)) + (book-authors (get-list 'author metadata)) + (book-summary (get-string 'summary metadata)) + (company-info (get-string 'company-info metadata)) (main-title-size (let ((size (exact->inexact @@ -198,8 +210,8 @@ (display "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" outport) (display (sxml->xml `(svg - (@ (width ,(mm width)) - (height ,(mm height)) + (@ (width ,(mm width)) + (height ,(mm height)) (viewBox ,viewBox)) (defs (style ,style)) |