aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-05-04 17:09:44 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-05-04 17:09:44 +0200
commita4cf576d20a075cb56b034c449e7432e390bf5b8 (patch)
tree70170c73464cf3411337bbb9e7cc5a1198b0f1cc
parentAdd true-string-length. (diff)
downloadcalp-a4cf576d20a075cb56b034c449e7432e390bf5b8.tar.gz
calp-a4cf576d20a075cb56b034c449e7432e390bf5b8.tar.xz
Add some more text formatting tags.
-rw-r--r--module/util/options.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/module/util/options.scm b/module/util/options.scm
index 87078ed7..690b9c5a 100644
--- a/module/util/options.scm
+++ b/module/util/options.scm
@@ -44,20 +44,29 @@
[(invert) 7]
[else 4]))))
+(use-modules (texinfo string-utils))
+
+;; NOTE width is hard coded to 70 chars
(define* (ontree tag body optional: (args '()))
(case tag
[(*TOP* group) (string-concatenate (map sxml->ansi-text body))]
+ [(center) (center-string (string-concatenate (map sxml->ansi-text body)) 70)]
+ [(p) (string-append (string-join (flow-text (string-concatenate (map sxml->ansi-text body))
+ width: 70)
+ "\n")
+ "\n\n")]
[(b) (string-append (esc 'bold) (string-concatenate (map sxml->ansi-text body)) (esc))]
[(i em) (string-append (esc 'italic) (string-concatenate (map sxml->ansi-text body)) (esc))]
[(blockquote) (string-concatenate
(map (lambda (line) (sxml->ansi-text `(group (ws (@ (minwidth 4))) ,line (br))))
(flow-text
(string-concatenate (map sxml->ansi-text body))
- width: 50)))]
+ width: 66)))]
[(ws) (make-string (aif (assoc-ref args 'minwidth)
(car it) 1)
#\space)]
[(br) "\n"]
+ [(hr) (string-append " " (make-string 60 #\_) " \n")]
[else (string-append (esc 'invert) (string-concatenate (map sxml->ansi-text body)) (esc))]
)
)
@@ -78,7 +87,7 @@
[any (leaf-callback any)]))
-(define (sxml->ansi-text tree)
+(define-public (sxml->ansi-text tree)
((parse-tree ontree onleaf) tree))
(define-public (format-arg-help options)