diff options
-rw-r--r-- | doc/skribilo.scm | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/doc/skribilo.scm b/doc/skribilo.scm index 4a1eda0..3438b82 100644 --- a/doc/skribilo.scm +++ b/doc/skribilo.scm @@ -108,22 +108,20 @@ and END are line numbers indexed from 1." (position->line-number str end)))))) (define (source-ref file regexp text) - (call-with-input-file file - (lambda (port) - (ref #:url (match (sexp-file-lines file regexp) - ((start-line . end-line) - (if (= start-line end-line) - (string-append %source-uri-base - file - "#L" - (number->string start-line)) - (string-append %source-uri-base - file - "#L" - (number->string start-line) - "-L" - (number->string end-line))))) - #:text text)))) + (ref #:url (match (sexp-file-lines file regexp) + ((start-line . end-line) + (if (= start-line end-line) + (string-append %source-uri-base + file + "#L" + (number->string start-line)) + (string-append %source-uri-base + file + "#L" + (number->string start-line) + "-L" + (number->string end-line))))) + #:text text)) ;; HTML engine customizations (let ((html-engine (find-engine 'html))) |