aboutsummaryrefslogtreecommitdiff
path: root/doc/skribilo.scm
diff options
context:
space:
mode:
Diffstat (limited to 'doc/skribilo.scm')
-rw-r--r--doc/skribilo.scm13
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")