-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgnc_jqplot.py
More file actions
37 lines (27 loc) · 1.37 KB
/
gnc_jqplot.py
File metadata and controls
37 lines (27 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import xml.etree.ElementTree as ET
from sw_core_utils import gnc_path_find_localized_html_file
#class HtmlJqplotUtils(object):
if True:
# we need to force the terminating </script> otherwise we get no displayed plot
def html_js_include (file):
jstr = "file://" + gnc_path_find_localized_html_file(file)
jelm = ET.Element('script', attrib={'language' : "javascript", 'type' : "text/javascript", 'src' : jstr})
jelm.text = "\n"
jelm.tail = "\n"
return jelm
def html_css_include (file):
cssstr = "file://" + gnc_path_find_localized_html_file(file)
csselm = ET.Element('link', attrib={'rel' : "stylesheet", 'type' : "text/css", 'href' : cssstr})
csselm.text = "\n"
csselm.tail = "\n"
return csselm
def html_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 "&" 'post))
#(set! s1 (regexp-substitute/global #f "<" s1 'pre "<" 'post))
#(regexp-substitute/global #f ">" s1 'pre ">" 'post))
pass