aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Court`es2007-09-20 17:19:27 +0000
committerLudovic Court`es2007-09-20 17:19:27 +0000
commit33f508af77d56ba3c56947dc503744f24bae2529 (patch)
treecfba8c3700e198aa29591982c37316ed8f4c2701
parent8ead9b042f96a719cf023ceede4177ed448a04c3 (diff)
downloadskribilo-33f508af77d56ba3c56947dc503744f24bae2529.tar.gz
skribilo-33f508af77d56ba3c56947dc503744f24bae2529.tar.lz
skribilo-33f508af77d56ba3c56947dc503744f24bae2529.zip
lout: Add customs for the `book' document type.
* src/guile/skribilo/engine/lout.scm (lout-engine)[publisher, edition, before-title-page, on-title-page, after-title-page, at-end]: New customs. (output-report-options, output-book-options): New. (document): Use them. git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-109
-rw-r--r--src/guile/skribilo/engine/lout.scm83
1 files changed, 57 insertions, 26 deletions
diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm
index 49df54d..d0819bf 100644
--- a/src/guile/skribilo/engine/lout.scm
+++ b/src/guile/skribilo/engine/lout.scm
@@ -557,7 +557,7 @@
;*---------------------------------------------------------------------*/
-;* lout-engine ... */
+;* lout-engine ... */
;*---------------------------------------------------------------------*/
(define lout-engine
(make-engine 'lout
@@ -613,6 +613,14 @@
;; current language is chosen.
(abstract-title #t)
+ ;; For books.
+ (publisher #f)
+ (edition #f)
+ (before-title-page #f)
+ (on-title-page #f)
+ (after-title-page #f)
+ (at-end #f)
+
;; Whether to optimize pages.
(optimize-pages? #f)
@@ -1011,6 +1019,10 @@
(markup-writer 'breakable-space :before " &1s\n" :action #f)
+;;;
+;;; Document.
+;;;
+
(define (lout-page-orientation orientation)
;; Return a string representing the Lout page orientation name for symbol
;; `orientation'.
@@ -1025,6 +1037,46 @@
orientation)
(cdr which))))
+(define (output-report-options doc e)
+ ;; Output document options specific to the `report' document type.
+ (let ((cover-sheet? (engine-custom e 'cover-sheet?))
+ (abstract (engine-custom e 'abstract))
+ (abstract-title (engine-custom e 'abstract-title)))
+ (display (string-append " @CoverSheet { "
+ (if cover-sheet? "Yes" "No")
+ " }\n"))
+
+ (if abstract
+ (begin
+ (if (not (eq? abstract-title #t))
+ (begin
+ (display " @AbstractTitle { ")
+ (cond
+ ((not abstract-title) #t)
+ (else (output abstract-title e)))
+ (display " }\n")))
+
+ (display " @Abstract {\n")
+ (output abstract e)
+ (display "\n}\n")))))
+
+(define (output-book-options doc engine)
+ ;; Output document options specific to the `book' document type.
+ (define (output-option lout opt)
+ (let ((val (engine-custom engine opt)))
+ (if val
+ (begin
+ (format #t " ~a { " lout)
+ (output val engine)
+ (display " }\n")))))
+
+ (output-option "@Edition" 'edition)
+ (output-option "@Publisher" 'publisher)
+ (output-option "@BeforeTitlePage" 'before-title-page)
+ (output-option "@OnTitlePage" 'on-title-page)
+ (output-option "@AfterTitlePage" 'after-title-page)
+ (output-option "@AtEnd" 'at-end))
+
;*---------------------------------------------------------------------*/
;* document ... */
@@ -1119,31 +1171,10 @@
(display (if date-line "Yes" "No")))
(display " }\n")))
- ;; Lout reports make it possible to choose whether to prepend
- ;; a cover sheet (books and docs don't). Same for a date
- ;; line.
- (if (eq? doc-type 'report)
- (let ((cover-sheet? (engine-custom e 'cover-sheet?))
- (abstract (engine-custom e 'abstract))
- (abstract-title (engine-custom e 'abstract-title)))
- (display (string-append " @CoverSheet { "
- (if cover-sheet?
- "Yes" "No")
- " }\n"))
-
- (if abstract
- (begin
- (if (not (eq? abstract-title #t))
- (begin
- (display " @AbstractTitle { ")
- (cond
- ((not abstract-title) #t)
- (else (output abstract-title e)))
- (display " }\n")))
-
- (display " @Abstract {\n")
- (output abstract e)
- (display "\n}\n")))))
+ ;; Output options specific to one of the document types.
+ (case doc-type
+ ((report) (output-report-options n e))
+ ((book) (output-book-options n e)))
(format #t " @OptimizePages { ~a }\n"
(if (engine-custom e 'optimize-pages?)