From 2fb88465f7a25b1eac0cdbb78a05de9e78e68bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 23 Jun 2022 04:14:46 +0200 Subject: Normalize keyword syntax. --- module/text/flow.scm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'module/text/flow.scm') diff --git a/module/text/flow.scm b/module/text/flow.scm index 315bea06..77f39a9f 100644 --- a/module/text/flow.scm +++ b/module/text/flow.scm @@ -8,21 +8,22 @@ :use-module (text util) :use-module (srfi srfi-1) :use-module (srfi srfi-71) + :use-module (srfi srfi-88) :export (flow-text)) ;; str -> (str) -(define* (flow-text str #:key (width 70)) +(define* (flow-text str key: (width 70)) (flatten - (map (lambda (line) (justify-line line #:width width)) + (map (lambda (line) (justify-line line width: width)) (lines str)))) -;; Splits and justifies the given line to @var{#:width}. +;; Splits and justifies the given line to @var{width:}. ;; Returns a list of justified strings. ;; str -> (str) -(define* (justify-line line #:key (width 70)) +(define* (justify-line line key: (width 70)) (let recur ((lst (words line))) (let ((head tail (span (let ((w 0)) @@ -36,11 +37,11 @@ ;; than our max width. Add it as is and continue ;; (while crying). (cons (car tail) (recur (cdr tail)))) - (else (cons (justify-line-helper head #:width width) + (else (cons (justify-line-helper head width: width) (recur tail))))))) ;; (str) -> str -(define* (justify-line-helper words #:key (width 70)) +(define* (justify-line-helper words key: (width 70)) (let* ((phrase-length (true-string-length (string-concatenate/shared words))) (needed-spaces (- width phrase-length)) (slots (1- (length words))) -- cgit v1.2.3