diff --git a/docs/docread/docread.scm b/docs/docread/docread.scm index 33d7c68..126c2c7 100644 --- a/docs/docread/docread.scm +++ b/docs/docread/docread.scm @@ -24,7 +24,7 @@ (call-with-port (open-input-string comments-fixed) (lambda (port) (read port)))) ;; Iterate over the contents of a define-library, and collect comments on certain defines. -(define (parse-library-contents contents lib-comments) +(define (parse-library-contents fname contents lib-comments) (define comments '()) (define defines '()) (define imports '()) @@ -87,7 +87,7 @@ (define out-file (open-output-file out-path)) ; Print out the comments - (fprintf out-file "= `~A`\n\n" (car contents)) + (fprintf out-file "= `~A`\n\nhttps://puck.moe/git/zilch/tree~A[source code]\n\n" (car contents) fname) (for-each (lambda (l) (fprintf out-file "~A\n" l)) lib-comments) (fprintf out-file "\n:toc:\n\n") (for-each (lambda (i) @@ -101,15 +101,15 @@ (define root (call-with-input-pipe "git rev-parse --show-toplevel" (lambda (p) (define path (read-string 9999999 p)) (string-copy path 0 (- (string-length path) 1))))) -(define (parse-file contents) +(define (parse-file fname contents) (define comments '()) (for-each (lambda (j) - (cond ((eq? (car j) 'define-library) (parse-library-contents (cdr j) (reverse comments))) + (cond ((eq? (car j) 'define-library) (parse-library-contents fname (cdr j) (reverse comments))) ((eq? (car j) 'comment) (set! comments (cons (cadr j) comments))))) contents)) (define (process-file fname _) - (parse-file (read-file-with-rewritten-comments fname))) + (parse-file (string-copy fname (string-length root)) (read-file-with-rewritten-comments fname))) (find-files root #:test ".*\\.(sld|scm)" #:action process-file)