From ce4109b2a598bb2c0151aa1671e9684c1f9de967 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sun, 26 May 2019 10:54:13 -0700 Subject: [PATCH] div by zero is still bad --- quad/quadwriter/core.rkt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/quad/quadwriter/core.rkt b/quad/quadwriter/core.rkt index 7f704545..c547146a 100644 --- a/quad/quadwriter/core.rkt +++ b/quad/quadwriter/core.rkt @@ -249,7 +249,7 @@ (cond [(or (equal? align-value "justify") ;; force justification upon overfull lines - line-overfull?) + (and line-overfull? (> word-count 1))) (define justified-space-width (/ empty-hspace (sub1 word-count))) (apply append (add-between hung-word-sublists (list (make-quad #:from 'bo @@ -591,15 +591,15 @@ (define ((page-finish-wrap page-quad path) cols q0 q page-idx) (define elems (match (quad-ref (car cols) 'footer-display "true") - [(or "false" "none") (from-parent cols 'nw)] - [_ - (define-values (dir name _) (split-path (path-replace-extension path #""))) - (define footer (struct-copy quad q:footer - [attrs (let ([h (hash-copy (quad-attrs q:footer))]) - (hash-set! h 'page-number page-idx) - (hash-set! h 'doc-title (string-titlecase (path->string name))) - h)])) - (cons footer (from-parent cols 'nw))])) + [(or "false" "none") (from-parent cols 'nw)] + [_ + (define-values (dir name _) (split-path (path-replace-extension path #""))) + (define footer (struct-copy quad q:footer + [attrs (let ([h (hash-copy (quad-attrs q:footer))]) + (hash-set! h 'page-number page-idx) + (hash-set! h 'doc-title (string-titlecase (path->string name))) + h)])) + (cons footer (from-parent cols 'nw))])) (list (struct-copy quad page-quad [elems elems]))) (define (page-wrap qs width [page-quad q:page])