From f45845687353013faa9f9d3b9b1b58889e08b660 2013-01-13 10:21:17 From: Matthias BUSSONNIER Date: 2013-01-13 10:21:17 Subject: [PATCH] modularize inlining --- diff --git a/converters/template.py b/converters/template.py index be9579b..7c360eb 100755 --- a/converters/template.py +++ b/converters/template.py @@ -83,13 +83,14 @@ def header_body(): with io.open(sheet, encoding='utf-8') as f: s = f.read() - header.extend(s.split('\n')) + header.append(s) pygments_css = HtmlFormatter().get_style_defs('.highlight') - header.extend(pygments_css.split('\n')) + header.append(pygments_css) return header -ecss = header_body() +inlining= {} +inlining['css'] = header_body() env.filters['pycomment'] = python_comment env.filters['indent'] = indent @@ -135,7 +136,7 @@ class ConverterTemplate(Configurable): return converted_cells def convert(self, cell_separator='\n'): - return self.template.render(worksheets=self.process(), ecss=ecss) + return self.template.render(worksheets=self.process(), inlining=inlining) def read(self, filename): diff --git a/templates/fullhtml.tpl b/templates/fullhtml.tpl index fcf30d0..8d25ee9 100644 --- a/templates/fullhtml.tpl +++ b/templates/fullhtml.tpl @@ -3,10 +3,12 @@ {%- block header -%} + +{% for css in inlining.css -%} +{% endfor %}