From 2fa0b1bdecd57455279383092ddef10029319e79 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 22 Jun 2016 01:03:07 -0700 Subject: [PATCH] note --- quad/quad/quadlang-test.rkt | 4 ++-- quad/quad/typeset.rkt | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/quad/quad/quadlang-test.rkt b/quad/quad/quadlang-test.rkt index f8bb0497..4cd5b7b2 100644 --- a/quad/quad/quadlang-test.rkt +++ b/quad/quad/quadlang-test.rkt @@ -1,2 +1,2 @@ -#lang quad/text test 300 -Artful@(page-break)Belligerence \ No newline at end of file +#lang quad/text test 240 +Not that you need to be a programmer to start using Pollen. On the contrary, the Pollen language is markup-based, so you can write & edit text naturally. But when you want to automate repetitive tasks, add cross-references, or pull in data from other sources, you can access a full programming language from within the text. \ No newline at end of file diff --git a/quad/quad/typeset.rkt b/quad/quad/typeset.rkt index 4017d38e..17ab3ce4 100644 --- a/quad/quad/typeset.rkt +++ b/quad/quad/typeset.rkt @@ -2,6 +2,9 @@ (provide (all-defined-out)) (require "measure.rkt") +;; track this k outside of for/fold loop to keep it independent. +;; otherwise, every time k is invoked, the loop k will also change. +;; (mutated data is not reset by a continuation, but loop vars are) (define last-breakpoint-k raise-overflow-error) (define (set-breakpoint-k-here!) @@ -52,6 +55,7 @@ [(>= (posn-page current-posn) page-width) (last-breakpoint-k 'page-break)] ;; set a new bp-k, or resume after invoking a bp-k + ;; bp-k has to be in conditional so it triggers side effect but also forces next branch [(and ($space? q) (set-breakpoint-k-here!)) => ; grabs the value of the condition: the arg passed to breakpoint-k (λ (breakpoint-k-result)