summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo/reader/outline.scm20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/guile/skribilo/reader/outline.scm b/src/guile/skribilo/reader/outline.scm
index 7411892..1e64d01 100644
--- a/src/guile/skribilo/reader/outline.scm
+++ b/src/guile/skribilo/reader/outline.scm
@@ -83,15 +83,21 @@ equal to @var{name}, a markup name."
(let loop ((trees trees)
(result '()))
(if (null? trees)
- result
+ (let ((result (reverse! result)))
+ (cond ((and (pair? result)
+ (not (symbol? (car result))))
+ ;; Make sure only symbols end up in the head.
+ (cons 'list result))
+ (else
+ result)))
(let ((tree (car trees)))
(loop (cdr trees)
- (append result
- (if (list? tree)
- (cond ((null? tree) '())
- ((symbol? (car tree)) (list tree))
- (else tree))
- (list tree))))))))
+ (append (if (list? tree)
+ (cond ((null? tree) '())
+ ((symbol? (car tree)) (list tree))
+ (else tree))
+ (list tree))
+ result))))))
(define (null-string? s)
(and (string? s) (string=? s "")))