Thanks a lot!

I was able to build an @sec-number-ref function. Here it is below. Matthew, 
since this is not a copy-paste of your code, I hope you won't see any problems 
if I place this in the public domain / CC0 license?

@(define (sec-number→string tag #:doc [doc #f])
   (delayed-element
    (λ (the-renderer the-part the-resolve-info)
      (define sec-tag (make-section-tag tag #:doc doc))
      (define resolved-sec-tag (resolve-get the-part the-resolve-info sec-tag))
      (if resolved-sec-tag
          (let ()
            (unless (and (vector? resolved-sec-tag)
                         (>= (vector-length resolved-sec-tag) 3))
              (error (format (string-append
                              "Resolved section tag was not a"
                              " vector of more than 3 elements: ~a")
                       resolved-sec-tag)))
            (define sec-number (vector-ref resolved-sec-tag 2))
            (unless (list? sec-number)
              (error "Third element of a resolved section tag was not a list."))
            (if (= (length sec-number) 1)
                (format "Chapter ~a" (car sec-number))
                (format "Section ~a" (string-join (map number->string
                                                       sec-number)
                                                  "."))))
          (elem #:style (style "badlink" '())
                tag " #:doc " (format "~s" doc))))
    (λ ()
      "Section ??")
    (λ ()
      "Section ??")))

@(define (sec-number-ref tag #:doc [doc #f])
   (seclink tag #:doc doc (sec-number→string tag #:doc doc)))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to