html.py
59 lines
| 2.0 KiB
| text/x-python
|
PythonLexer
MinRK
|
r13664 | """HTML Exporter class""" | ||
Jonathan Frederic
|
r10588 | |||
#----------------------------------------------------------------------------- | ||||
# Copyright (c) 2013, the IPython Development Team. | ||||
# | ||||
# Distributed under the terms of the Modified BSD License. | ||||
# | ||||
# The full license is in the file COPYING.txt, distributed with this software. | ||||
#----------------------------------------------------------------------------- | ||||
#----------------------------------------------------------------------------- | ||||
# Imports | ||||
#----------------------------------------------------------------------------- | ||||
Jonathan Frederic
|
r11383 | from IPython.utils.traitlets import Unicode, List | ||
Jonathan Frederic
|
r10677 | |||
Paul Ivanov
|
r12219 | from IPython.nbconvert import preprocessors | ||
Jonathan Frederic
|
r11736 | from IPython.config import Config | ||
Jonathan Frederic
|
r10677 | |||
Jonathan Frederic
|
r12505 | from .templateexporter import TemplateExporter | ||
Jonathan Frederic
|
r10588 | |||
#----------------------------------------------------------------------------- | ||||
# Classes | ||||
#----------------------------------------------------------------------------- | ||||
Matthias BUSSONNIER
|
r12500 | class HTMLExporter(TemplateExporter): | ||
Jonathan Frederic
|
r10677 | """ | ||
Exports a basic HTML document. This exporter assists with the export of | ||||
HTML. Inherit from it if you are writing your own HTML template and need | ||||
Paul Ivanov
|
r12219 | custom preprocessors/filters. If you don't need custom preprocessors/ | ||
Jonathan Frederic
|
r10677 | filters, just change the 'template_file' config option. | ||
""" | ||||
Jonathan Frederic
|
r10624 | file_extension = Unicode( | ||
'html', config=True, | ||||
help="Extension of the file that should be written to disk" | ||||
) | ||||
Thomas Kluyver
|
r13830 | mime_type = Unicode('text/html', config=True, | ||
help="MIME type of the result file, for HTTP response headers." | ||||
) | ||||
Jonathan Frederic
|
r11745 | default_template = Unicode('full', config=True, help="""Flavor of the data | ||
format to use. I.E. 'full' or 'basic'""") | ||||
MinRK
|
r13664 | |||
Thomas Kluyver
|
r13834 | output_mimetype = 'text/html' | ||
MinRK
|
r13664 | |||
Jonathan Frederic
|
r11733 | @property | ||
def default_config(self): | ||||
c = Config({ | ||||
Paul Ivanov
|
r12219 | 'CSSHTMLHeaderPreprocessor':{ | ||
Jonathan Frederic
|
r11733 | 'enabled':True | ||
Pablo de Oliveira
|
r12573 | }, | ||
'HighlightMagicsPreprocessor': { | ||||
'enabled':True | ||||
} | ||||
Jonathan Frederic
|
r11733 | }) | ||
Jonathan Frederic
|
r11736 | c.merge(super(HTMLExporter,self).default_config) | ||
Jonathan Frederic
|
r11733 | return c | ||