diff options
author | Arun Isaac | 2021-07-04 19:46:43 +0530 |
---|---|---|
committer | Arun Isaac | 2021-07-04 19:46:43 +0530 |
commit | 3ca3bd1022b16c26811af86d48a85e9e74f2c00a (patch) | |
tree | 4003ff0690d05ed512f9dbd618679e9505857a4c | |
parent | 4569b62babd486da75adeb856811ef411d8d2ead (diff) | |
download | ccwl-3ca3bd1022b16c26811af86d48a85e9e74f2c00a.tar.gz ccwl-3ca3bd1022b16c26811af86d48a85e9e74f2c00a.tar.lz ccwl-3ca3bd1022b16c26811af86d48a85e9e74f2c00a.zip |
doc: Remove redundant file open.
* doc/skribilo.scm (source-ref): Remove redundant file open.
-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))) |