forked from kirbs-/hide_code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhide_code_html_exporter.py
More file actions
32 lines (26 loc) · 1.15 KB
/
Copy pathhide_code_html_exporter.py
File metadata and controls
32 lines (26 loc) · 1.15 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
import os
import os.path
# import traitlets.config import Config
from traitlets import default, Unicode
from nbconvert.exporters.html import HTMLExporter
from traitlets.log import get_logger
class HideCodeHTMLExporter(HTMLExporter):
def __init__(self, config=None, **kw):
# self.register_preprocessor('hide_code.HideCodePreprocessor', True)
super(HideCodeHTMLExporter, self).__init__(config, **kw)
# self.preprocessors = ['hide_code.HideCodePreprocessor']
# self._init_preprocessors()
@default('template_file')
def _template_file_default(self):
return 'hide_code_full.tpl'
@property
def template_path(self):
"""
We want to inherit from HTML template, and have template under
`./templates/` so append it to the search path. (see next section)
"""
return super(HideCodeHTMLExporter, self).template_path + [os.path.join(os.path.dirname(__file__), "Templates")]
# return [os.path.join(os.path.dirname(__file__), "Templates")]
# @default('template_path')
# def _default_template_path(self):
# return os.path.join(os.path.dirname(__file__), "Templates")