##// END OF EJS Templates
modularize inlining
Matthias BUSSONNIER -
Show More
@@ -83,13 +83,14 b' def header_body():'
83
83
84 with io.open(sheet, encoding='utf-8') as f:
84 with io.open(sheet, encoding='utf-8') as f:
85 s = f.read()
85 s = f.read()
86 header.extend(s.split('\n'))
86 header.append(s)
87
87
88 pygments_css = HtmlFormatter().get_style_defs('.highlight')
88 pygments_css = HtmlFormatter().get_style_defs('.highlight')
89 header.extend(pygments_css.split('\n'))
89 header.append(pygments_css)
90 return header
90 return header
91
91
92 ecss = header_body()
92 inlining= {}
93 inlining['css'] = header_body()
93
94
94 env.filters['pycomment'] = python_comment
95 env.filters['pycomment'] = python_comment
95 env.filters['indent'] = indent
96 env.filters['indent'] = indent
@@ -135,7 +136,7 b' class ConverterTemplate(Configurable):'
135 return converted_cells
136 return converted_cells
136
137
137 def convert(self, cell_separator='\n'):
138 def convert(self, cell_separator='\n'):
138 return self.template.render(worksheets=self.process(), ecss=ecss)
139 return self.template.render(worksheets=self.process(), inlining=inlining)
139
140
140
141
141 def read(self, filename):
142 def read(self, filename):
@@ -3,10 +3,12 b''
3 {%- block header -%}
3 {%- block header -%}
4 <html>
4 <html>
5 <head>
5 <head>
6 <meta charset="UTF-8">
7 {% for css in inlining.css -%}
6 <style type="text/css">
8 <style type="text/css">
7 {% for css in ecss %}{{css}}
9 {{css}}
8 {% endfor %}
9 </style>
10 </style>
11 {% endfor %}
10 <script src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" type="text/javascript">
12 <script src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" type="text/javascript">
11
13
12 </script>
14 </script>
General Comments 0
You need to be logged in to leave comments. Login now