mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[eguile-gnc] fix whitespace
This commit is contained in:
parent
955a5651d8
commit
c81e9354f7
@ -142,36 +142,32 @@
|
|||||||
;; switch between code and text modes
|
;; switch between code and text modes
|
||||||
(define (switch-mode code? dmodifier?)
|
(define (switch-mode code? dmodifier?)
|
||||||
(display stop)
|
(display stop)
|
||||||
(if code?
|
(cond
|
||||||
(begin ; code mode to text mode
|
(code? (display textstart)
|
||||||
(display textstart)
|
|
||||||
(set! stop textstop))
|
(set! stop textstop))
|
||||||
(begin ; text mode to code mode
|
(dmodifier? (display dcodestart)
|
||||||
(if dmodifier?
|
|
||||||
(begin
|
|
||||||
(display dcodestart)
|
|
||||||
(set! stop dcodestop))
|
(set! stop dcodestop))
|
||||||
(begin
|
(else (display codestart)
|
||||||
(display codestart)
|
(set! stop codestop))))
|
||||||
(set! stop codestop))))))
|
|
||||||
|
|
||||||
;; recursively process input stream
|
;; recursively process input stream
|
||||||
(define (loop inp needle other code? line)
|
(define (loop inp needle other code? line)
|
||||||
(if (equal? line "")
|
(when (string-null? line)
|
||||||
(set! line (read-line inp 'concat)))
|
(set! line (read-line inp 'concat)))
|
||||||
(if (not (eof-object? line))
|
(unless (eof-object? line)
|
||||||
(let ((match (regexp-exec needle line)))
|
(cond
|
||||||
(if match
|
((regexp-exec needle line)
|
||||||
|
=> (lambda (rmatch)
|
||||||
(let ((dmodifier? #f))
|
(let ((dmodifier? #f))
|
||||||
(display-it (match:prefix match) code?)
|
(display-it (match:prefix rmatch) code?)
|
||||||
(if (not code?)
|
(unless code?
|
||||||
; switching from text to code -- check for modifier
|
;; switching from text to code -- check for modifier
|
||||||
(set! dmodifier? (match:substring match 1)))
|
(set! dmodifier? (match:substring rmatch 1)))
|
||||||
(switch-mode code? dmodifier?)
|
(switch-mode code? dmodifier?)
|
||||||
(loop inp other needle (not code?) (match:suffix match)))
|
(loop inp other needle (not code?) (match:suffix rmatch)))))
|
||||||
(begin ; no match - output whole line and continue
|
(else ; no match - output whole line and continue
|
||||||
(display-it line code?)
|
(display-it line code?)
|
||||||
(loop inp needle other code? ""))))))
|
(loop inp needle other code? "")))))
|
||||||
|
|
||||||
(display textstart)
|
(display textstart)
|
||||||
(loop (current-input-port) startre endre #f "")
|
(loop (current-input-port) startre endre #f "")
|
||||||
@ -221,7 +217,10 @@
|
|||||||
(error-length (stack-length error-stack)))
|
(error-length (stack-length error-stack)))
|
||||||
; Show the backtrace. Remove one extra from the "first"
|
; Show the backtrace. Remove one extra from the "first"
|
||||||
; argument, since that is an index, not a count.
|
; argument, since that is an index, not a count.
|
||||||
(display-backtrace error-stack (current-output-port) (- (- error-length remove-top) 1) (- (- error-length remove-top) remove-bottom)))
|
(display-backtrace error-stack
|
||||||
|
(current-output-port)
|
||||||
|
(- (- error-length remove-top) 1)
|
||||||
|
(- (- error-length remove-top) remove-bottom)))
|
||||||
(display "</pre><br>"))
|
(display "</pre><br>"))
|
||||||
|
|
||||||
; This handler will be called by catch before unwinding the
|
; This handler will be called by catch before unwinding the
|
||||||
@ -249,15 +248,18 @@
|
|||||||
|
|
||||||
;; Process a template file and return the result as a string
|
;; Process a template file and return the result as a string
|
||||||
(define (eguile-file-to-string infile environment)
|
(define (eguile-file-to-string infile environment)
|
||||||
(if (not (access? infile R_OK))
|
(cond
|
||||||
(format #f (_ "Template file \"~a\" can not be read") infile)
|
((not (access? infile R_OK))
|
||||||
(let ((script (with-input-from-file
|
(format #f (_ "Template file \"~a\" can not be read") infile))
|
||||||
infile
|
(else
|
||||||
(lambda () (with-output-to-string template->script)))))
|
(let ((script (with-input-from-file infile
|
||||||
|
(lambda ()
|
||||||
|
(with-output-to-string template->script)))))
|
||||||
(with-output-to-string
|
(with-output-to-string
|
||||||
(lambda () (with-input-from-string
|
(lambda ()
|
||||||
script
|
(with-input-from-string script
|
||||||
(lambda () (script->output environment))))))))
|
(lambda ()
|
||||||
|
(script->output environment)))))))))
|
||||||
|
|
||||||
(export eguile-file-to-string)
|
(export eguile-file-to-string)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user