docread: link to source code
This commit is contained in:
parent
145cf85e5d
commit
144702f70c
1 changed files with 5 additions and 5 deletions
|
|
@ -24,7 +24,7 @@
|
||||||
(call-with-port (open-input-string comments-fixed) (lambda (port) (read port))))
|
(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.
|
;; 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 comments '())
|
||||||
(define defines '())
|
(define defines '())
|
||||||
(define imports '())
|
(define imports '())
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
|
|
||||||
(define out-file (open-output-file out-path))
|
(define out-file (open-output-file out-path))
|
||||||
; Print out the comments
|
; 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)
|
(for-each (lambda (l) (fprintf out-file "~A\n" l)) lib-comments)
|
||||||
(fprintf out-file "\n:toc:\n\n")
|
(fprintf out-file "\n:toc:\n\n")
|
||||||
(for-each (lambda (i)
|
(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 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 '())
|
(define comments '())
|
||||||
(for-each (lambda (j)
|
(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))
|
((eq? (car j) 'comment) (set! comments (cons (cadr j) comments))))) contents))
|
||||||
|
|
||||||
|
|
||||||
(define (process-file fname _)
|
(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)
|
(find-files root #:test ".*\\.(sld|scm)" #:action process-file)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue