diff --git a/converters/template.py b/converters/template.py index 890c9c7..c42896a 100755 --- a/converters/template.py +++ b/converters/template.py @@ -39,6 +39,8 @@ from IPython.utils.traitlets import (List, Unicode, Type, Bool, Dict, CaselessSt # Our own imports from IPython.utils.text import indent from .utils import remove_ansi +from markdown import markdown +from .utils import highlight #----------------------------------------------------------------------------- # Class declarations #----------------------------------------------------------------------------- @@ -56,6 +58,8 @@ env.filters['pycomment'] = python_comment env.filters['indent'] = indent env.filters['rm_fake'] = rm_fake env.filters['rm_ansi'] = remove_ansi +env.filters['markdown'] = markdown +env.filters['highlight'] = highlight class ConverterTemplate(Configurable): @@ -69,8 +73,8 @@ class ConverterTemplate(Configurable): infile_dir = Unicode() - def __init__(self, config=None, **kw): - self.template = env.get_template('python.tpl') + def __init__(self, tplfile='fullhtml', config=None, **kw): + self.template = env.get_template(tplfile+'.tpl') super(ConverterTemplate,self).__init__(config=config) def _get_prompt_number(self, cell): diff --git a/runme.py b/runme.py index ec48df1..6b05f08 100644 --- a/runme.py +++ b/runme.py @@ -1,7 +1,9 @@ # coding: utf-8 +import sys from converters.template import * -C = ConverterTemplate() +C = ConverterTemplate(tplfile=sys.argv[1]) C.read('tests/ipynbref/IntroNumPy.orig.ipynb') + S = C.convert() with open('temp.txt','w') as f: f.write(S) diff --git a/templates/basichtml.tpl b/templates/basichtml.tpl new file mode 100644 index 0000000..9b6e7d8 --- /dev/null +++ b/templates/basichtml.tpl @@ -0,0 +1,61 @@ +{%- extends 'basic.tpl' -%} + + + + +{% block codecell scoped %} +