add section break thingy

main
Matthew Butterick 5 years ago
parent 79b11ea75e
commit f7c8067fa1

@ -8,6 +8,7 @@
page-break
column-break
hr-break
section-break
q:para-break
q:line-break
q:page-break

@ -167,6 +167,10 @@
(define q:page-break (make-page-break-quad #:printable #f
#:id 'page-break))
(define-quad section-break-quad page-break-quad ())
(define q:section-break (make-section-break-quad #:printable #f
#:id 'section-break))
(define q:line (q #:size (pt 0 default-line-height)
#:from 'sw
#:to 'nw
@ -679,7 +683,8 @@
#:finish-wrap (page-finish-wrap page-quad (pdf-output-path (current-pdf)))))
(define (section-wrap qs)
(list qs))
(wrap qs +inf.0
#:hard-break section-break-quad?))
(define (insert-blocks lines)
(define groups-of-lines (contiguous-group-by (λ (x) (quad-ref x :display)) lines))

@ -41,7 +41,7 @@
(define TYPE-BREAK '(q ((break TYPE-STR)))) ...
(define ALL-BREAKS-ID (list (cons TYPE-BREAK Q:TYPE-BREAK) ...))))]))
(define-break-types all-breaks para line page column hr)
(define-break-types all-breaks para line page column hr section)
(define (replace-breaks x)
(map-elements (λ (el)
@ -207,4 +207,4 @@
(log-quadwriter-info (format "wrote PDF to ~a" pdf-path))
(begin0
(file->bytes pdf-path)
(delete-file pdf-path))))
(delete-file pdf-path))))

Loading…
Cancel
Save