html-jqplot.scm begone!

Remove unused jqplot-escape-string, and move remaining
(gnc:html-[js|css]-include) functions to html-utilities.scm
This commit is contained in:
Christopher Lam 2018-04-27 21:51:13 +08:00
parent fcb5f64bd5
commit ba2c1f6a05
8 changed files with 17 additions and 48 deletions

View File

@ -73,7 +73,6 @@ SET (report_system_SCHEME_3
html-table.scm
html-text.scm
html-utilities.scm
html-jqplot.scm
options-utilities.scm
report-utilities.scm
report.scm

View File

@ -21,7 +21,7 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load-from-path "html-jqplot")
(use-modules (gnucash report report-system))
(define <html-barchart>
(make-record-type "<html-barchart>"

View File

@ -1,44 +0,0 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of
;; the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, contact:
;;
;; Free Software Foundation Voice: +1-617-542-5942
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash core-utils))
(define (gnc:html-js-include file)
(string-append
"<script language=\"javascript\" type=\"text/javascript\" src=\"file:///"
(gnc-path-find-localized-html-file file)
"\"></script>\n"
))
(define (gnc:html-css-include file)
(string-append
"<link rel=\"stylesheet\" type=\"text/css\" href=\"file:///"
(gnc-path-find-localized-html-file file)
"\" />\n"
))
(define (jqplot-escape-string s1)
;; Escape single and double quotes and backslashes
(set! s1 (regexp-substitute/global #f "\\\\" s1 'pre "\\\\" 'post))
(set! s1 (regexp-substitute/global #f "'" s1 'pre "\\'" 'post))
(set! s1 (regexp-substitute/global #f "\"" s1 'pre "\\\"" 'post))
;; Escape HTML special characters
(set! s1 (regexp-substitute/global #f "&" s1 'pre "&amp;" 'post))
(set! s1 (regexp-substitute/global #f "<" s1 'pre "&lt;" 'post))
(regexp-substitute/global #f ">" s1 'pre "&gt;" 'post))

View File

@ -24,6 +24,8 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash report report-system))
(define <html-linechart>
(make-record-type "<html-linechart>"
'(width

View File

@ -21,7 +21,7 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load-from-path "html-jqplot")
(use-modules (gnucash report report-system))
(define <html-piechart>
(make-record-type "<html-piechart>"

View File

@ -24,7 +24,7 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load-from-path "html-jqplot")
(use-modules (gnucash report report-system))
(define <html-scatter>
(make-record-type "<html-scatter>"

View File

@ -854,6 +854,16 @@
(_ "No data")
(_ "The selected accounts contain no data/transactions (or only zeroes) for the selected time period")))
(define (gnc:html-js-include file)
(format #f
"<script language=\"javascript\" type=\"text/javascript\" src=\"file:///~a\"></script>\n"
(gnc-path-find-localized-html-file file)))
(define (gnc:html-css-include file)
(format #f
"<link rel=\"stylesheet\" type=\"text/css\" href=\"file:///~a\" />\n"
(gnc-path-find-localized-html-file file)))
;; function to sanitize strings prior to sending to html
(define (gnc:html-string-sanitize str)
(with-output-to-string

View File

@ -119,6 +119,8 @@
(export gnc:html-make-generic-simple-warning)
(export gnc:html-make-empty-data-warning)
(export gnc:html-make-options-link)
(export gnc:html-js-include)
(export gnc:html-css-include)
(export gnc:html-string-sanitize)
;; report.scm