[modularise] (gnucash eguile)

This commit is contained in:
Christopher Lam 2020-12-05 00:33:27 +08:00
parent 381b955ddf
commit ffbd09089c
3 changed files with 21 additions and 16 deletions

View File

@ -22,16 +22,29 @@
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;; 02111-1307 USA
(define-module (gnucash eguile eguile-html-utilities))
; using all of these seems like overkill --
; not sure which are really required
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
(use-modules (ice-9 regex)) ; for regular expressions
(use-modules (srfi srfi-13)) ; for extra string functions
(export string-substitute-alist)
(define-public (string-substitute-alist str sub-alist)
(with-output-to-string
(lambda ()
(string-for-each
(lambda (c)
(display
(or (assv-ref sub-alist c)
c)))
str))))
(define (string-repeat s n)
;; return a string made of n copies of string s
(string-join (make-list n s) ""))

View File

@ -22,6 +22,8 @@
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;; 02111-1307 USA
(define-module (gnucash eguile eguile-utilities))
(use-modules (ice-9 match))
; using all of these seems like overkill --
; not sure which are really required

View File

@ -86,18 +86,13 @@
(use-modules (ice-9 regex)) ; for regular expressions
(use-modules (ice-9 rdelim)) ; for read-line
(use-modules (ice-9 local-eval)) ; for the-environment
(use-modules (gnucash app-utils)) ; for _
(use-modules (gnucash core-utils)); for G_ N_
(use-modules (gnucash utilities)) ; for gnc:html-string-sanitize
(define-public (string-substitute-alist str sub-alist)
(with-output-to-string
(lambda ()
(string-for-each
(lambda (c)
(display
(or (assv-ref sub-alist c)
c)))
str))))
(load-and-reexport (gnucash eguile eguile-utilities)
(gnucash eguile eguile-html-utilities))
(export eguile-file-to-string)
;; regexps used to find start and end of code segments
(define startre (and (defined? 'make-regexp) (make-regexp "<\\?scm(:d)?[[:space:]]")))
@ -166,8 +161,3 @@
(unless (eof-object? next)
(local-eval next local-env)
(lp (read))))))))))))
(export eguile-file-to-string)
(load-from-path "gnucash/eguile/eguile-utilities")
(load-from-path "gnucash/eguile/eguile-html-utilities")