diff options
author | Arun Isaac | 2021-11-05 23:20:54 +0530 |
---|---|---|
committer | Arun Isaac | 2021-11-05 23:20:54 +0530 |
commit | c86e1b4276fba6dd110dfb91ffead5707a77421d (patch) | |
tree | d44ec08cd359bc4f547f39fcaeb41082d31bf397 /doc/skribilo.scm | |
parent | 56de5b79d8a340b6aa003bd4c586c7a4af7a454f (diff) | |
download | ccwl-c86e1b4276fba6dd110dfb91ffead5707a77421d.tar.gz ccwl-c86e1b4276fba6dd110dfb91ffead5707a77421d.tar.lz ccwl-c86e1b4276fba6dd110dfb91ffead5707a77421d.zip |
doc: Support extracting specific forms from a scheme file.
* doc/skribilo.scm (scheme-source-form): New public function.
Diffstat (limited to 'doc/skribilo.scm')
-rw-r--r-- | doc/skribilo.scm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/skribilo.scm b/doc/skribilo.scm index 22d31f9..cba6d08 100644 --- a/doc/skribilo.scm +++ b/doc/skribilo.scm @@ -38,6 +38,7 @@ #:export (command file scheme-source + scheme-source-form source-ref)) ;; Constants @@ -125,6 +126,18 @@ and END are line numbers indexed from 1." (number->string end-line))))) #:text text)) +;; Extract forms from scheme source +(define (scheme-source-form file regexp) + "Extract form from scheme source FILE whose beginning matches +REGEXP. Return it enclosed in a prog form." + (prog (match (sexp-file-lines file regexp) + ((start . stop) + (source #:language scheme + #:file file + #:start (1- start) + #:stop (1- stop)))) + #:line #f)) + ;; HTML engine customizations (let ((html-engine (find-engine 'html))) (engine-custom-set! html-engine 'css "/style.css") |