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 +++++++------ module/text/numbers.scm | 5 +++-- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'module/text') 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))) diff --git a/module/text/numbers.scm b/module/text/numbers.scm index 168d267e..c45016bc 100644 --- a/module/text/numbers.scm +++ b/module/text/numbers.scm @@ -1,4 +1,5 @@ (define-module (text numbers) + :use-module (srfi srfi-88) :export (number->string-cardinal number->string-ordinal each-string)) @@ -17,11 +18,11 @@ 2))) (define* (number->string-cardinal - n #:optional (language (resolve-language))) + n optional: (language (resolve-language))) ((get language 'number->string-cardinal) n)) (define* (number->string-ordinal - n #:optional (language (resolve-language))) + n optional: (language (resolve-language))) ((get language 'number->string-ordinal) n)) ;; TODO change API to allow language, and stop having random extra -- cgit v1.2.3