diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2021-04-28 11:10:09 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2021-04-28 11:10:09 +0200 |
commit | df2e1dc8bc18b8b8aaa06c23b2066a5db6822eed (patch) | |
tree | 8eef2e8333c057e4cf79ef044c3675589c5e13ef /doc | |
parent | 7f8613cb088f0df0b1979620f36686aea1300465 (diff) |
doc: Generalize snarf helper script.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/snarf.scm | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/doc/snarf.scm b/doc/snarf.scm index 5dd2f7d..15088c0 100644 --- a/doc/snarf.scm +++ b/doc/snarf.scm @@ -78,27 +78,35 @@ (string-upcase (symbol->string sym))) (resolve-interface module))) (let ((unsorted - (module-map - (lambda (sym var) - (let ((proc (variable-ref var))) - (cons sym (format #false - "\ + (filter identity + (module-map + (lambda (sym var) + (false-if-exception + (let ((proc (variable-ref var))) + (cons sym (format #false + "\ @cindex ~a @deffn {Scheme Procedure} ~a ~a ~a @end deffn " sym sym - (arguments->string proc) - (fancy-docstring proc known-procedures))))) - (resolve-interface module)))) +(arguments->string proc) +(fancy-docstring proc known-procedures)))))) + (resolve-interface module))))) (sort unsorted (lambda (a b) (string< (symbol->string (car a)) (symbol->string (car b))))))) -(with-output-to-file "doc/low.texi" - (lambda () - (for-each (match-lambda - ((sym . doc) - (display doc) - (newline))) - (docs '(drmaa v1 low))))) +(define (main . args) + (match (command-line) + ((_ module file) + (let ((directory (dirname file))) + (unless (file-exists? directory) + (mkdir directory))) + (with-output-to-file file + (lambda () + (for-each (match-lambda + ((sym . doc) + (display doc) + (newline))) + (docs (call-with-input-string module read)))))))) |