##// END OF EJS Templates
Drop unused traitlet imports
Thomas Kluyver -
Show More
@@ -1,53 +1,51 b''
1 """HTML Exporter class"""
1 """HTML Exporter class"""
2
2
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (c) 2013, the IPython Development Team.
4 # Copyright (c) 2013, the IPython Development Team.
5 #
5 #
6 # Distributed under the terms of the Modified BSD License.
6 # Distributed under the terms of the Modified BSD License.
7 #
7 #
8 # The full license is in the file COPYING.txt, distributed with this software.
8 # The full license is in the file COPYING.txt, distributed with this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 from IPython.utils.traitlets import Unicode, List
16
17 from IPython.nbconvert import preprocessors
15 from IPython.nbconvert import preprocessors
18 from IPython.config import Config
16 from IPython.config import Config
19
17
20 from .templateexporter import TemplateExporter
18 from .templateexporter import TemplateExporter
21
19
22 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
23 # Classes
21 # Classes
24 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
25
23
26 class HTMLExporter(TemplateExporter):
24 class HTMLExporter(TemplateExporter):
27 """
25 """
28 Exports a basic HTML document. This exporter assists with the export of
26 Exports a basic HTML document. This exporter assists with the export of
29 HTML. Inherit from it if you are writing your own HTML template and need
27 HTML. Inherit from it if you are writing your own HTML template and need
30 custom preprocessors/filters. If you don't need custom preprocessors/
28 custom preprocessors/filters. If you don't need custom preprocessors/
31 filters, just change the 'template_file' config option.
29 filters, just change the 'template_file' config option.
32 """
30 """
33
31
34 def _file_extension_default(self):
32 def _file_extension_default(self):
35 return 'html'
33 return 'html'
36
34
37 def _template_file_default(self):
35 def _template_file_default(self):
38 return 'html_full'
36 return 'html_full'
39
37
40 output_mimetype = 'text/html'
38 output_mimetype = 'text/html'
41
39
42 @property
40 @property
43 def default_config(self):
41 def default_config(self):
44 c = Config({
42 c = Config({
45 'CSSHTMLHeaderPreprocessor':{
43 'CSSHTMLHeaderPreprocessor':{
46 'enabled':True
44 'enabled':True
47 },
45 },
48 'HighlightMagicsPreprocessor': {
46 'HighlightMagicsPreprocessor': {
49 'enabled':True
47 'enabled':True
50 }
48 }
51 })
49 })
52 c.merge(super(HTMLExporter,self).default_config)
50 c.merge(super(HTMLExporter,self).default_config)
53 return c
51 return c
@@ -1,91 +1,91 b''
1 """LaTeX Exporter class"""
1 """LaTeX Exporter class"""
2
2
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (c) 2013, the IPython Development Team.
4 # Copyright (c) 2013, the IPython Development Team.
5 #
5 #
6 # Distributed under the terms of the Modified BSD License.
6 # Distributed under the terms of the Modified BSD License.
7 #
7 #
8 # The full license is in the file COPYING.txt, distributed with this software.
8 # The full license is in the file COPYING.txt, distributed with this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 # Stdlib imports
15 # Stdlib imports
16 import os
16 import os
17
17
18 # IPython imports
18 # IPython imports
19 from IPython.utils.traitlets import Unicode, List
19 from IPython.utils.traitlets import Unicode
20 from IPython.config import Config
20 from IPython.config import Config
21
21
22 from IPython.nbconvert import filters, preprocessors
22 from IPython.nbconvert import filters, preprocessors
23 from .templateexporter import TemplateExporter
23 from .templateexporter import TemplateExporter
24
24
25 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
26 # Classes and functions
26 # Classes and functions
27 #-----------------------------------------------------------------------------
27 #-----------------------------------------------------------------------------
28
28
29 class LatexExporter(TemplateExporter):
29 class LatexExporter(TemplateExporter):
30 """
30 """
31 Exports to a Latex template. Inherit from this class if your template is
31 Exports to a Latex template. Inherit from this class if your template is
32 LaTeX based and you need custom tranformers/filters. Inherit from it if
32 LaTeX based and you need custom tranformers/filters. Inherit from it if
33 you are writing your own HTML template and need custom tranformers/filters.
33 you are writing your own HTML template and need custom tranformers/filters.
34 If you don't need custom tranformers/filters, just change the
34 If you don't need custom tranformers/filters, just change the
35 'template_file' config option. Place your template in the special "/latex"
35 'template_file' config option. Place your template in the special "/latex"
36 subfolder of the "../templates" folder.
36 subfolder of the "../templates" folder.
37 """
37 """
38
38
39 def _file_extension_default(self):
39 def _file_extension_default(self):
40 return 'tex'
40 return 'tex'
41
41
42 def _template_file_default(self):
42 def _template_file_default(self):
43 return 'article'
43 return 'article'
44
44
45 #Latex constants
45 #Latex constants
46 default_template_path = Unicode(
46 default_template_path = Unicode(
47 os.path.join("..", "templates", "latex"), config=True,
47 os.path.join("..", "templates", "latex"), config=True,
48 help="Path where the template files are located.")
48 help="Path where the template files are located.")
49
49
50 template_skeleton_path = Unicode(
50 template_skeleton_path = Unicode(
51 os.path.join("..", "templates", "latex", "skeleton"), config=True,
51 os.path.join("..", "templates", "latex", "skeleton"), config=True,
52 help="Path where the template skeleton files are located.")
52 help="Path where the template skeleton files are located.")
53
53
54 #Special Jinja2 syntax that will not conflict when exporting latex.
54 #Special Jinja2 syntax that will not conflict when exporting latex.
55 jinja_comment_block_start = Unicode("((=", config=True)
55 jinja_comment_block_start = Unicode("((=", config=True)
56 jinja_comment_block_end = Unicode("=))", config=True)
56 jinja_comment_block_end = Unicode("=))", config=True)
57 jinja_variable_block_start = Unicode("(((", config=True)
57 jinja_variable_block_start = Unicode("(((", config=True)
58 jinja_variable_block_end = Unicode(")))", config=True)
58 jinja_variable_block_end = Unicode(")))", config=True)
59 jinja_logic_block_start = Unicode("((*", config=True)
59 jinja_logic_block_start = Unicode("((*", config=True)
60 jinja_logic_block_end = Unicode("*))", config=True)
60 jinja_logic_block_end = Unicode("*))", config=True)
61
61
62 #Extension that the template files use.
62 #Extension that the template files use.
63 template_extension = Unicode(".tplx", config=True)
63 template_extension = Unicode(".tplx", config=True)
64
64
65 output_mimetype = 'text/latex'
65 output_mimetype = 'text/latex'
66
66
67
67
68 @property
68 @property
69 def default_config(self):
69 def default_config(self):
70 c = Config({
70 c = Config({
71 'NbConvertBase': {
71 'NbConvertBase': {
72 'display_data_priority' : ['latex', 'pdf', 'png', 'jpg', 'svg', 'jpeg', 'text']
72 'display_data_priority' : ['latex', 'pdf', 'png', 'jpg', 'svg', 'jpeg', 'text']
73 },
73 },
74 'ExtractOutputPreprocessor': {
74 'ExtractOutputPreprocessor': {
75 'enabled':True
75 'enabled':True
76 },
76 },
77 'SVG2PDFPreprocessor': {
77 'SVG2PDFPreprocessor': {
78 'enabled':True
78 'enabled':True
79 },
79 },
80 'LatexPreprocessor': {
80 'LatexPreprocessor': {
81 'enabled':True
81 'enabled':True
82 },
82 },
83 'SphinxPreprocessor': {
83 'SphinxPreprocessor': {
84 'enabled':True
84 'enabled':True
85 },
85 },
86 'HighlightMagicsPreprocessor': {
86 'HighlightMagicsPreprocessor': {
87 'enabled':True
87 'enabled':True
88 }
88 }
89 })
89 })
90 c.merge(super(LatexExporter,self).default_config)
90 c.merge(super(LatexExporter,self).default_config)
91 return c
91 return c
@@ -1,44 +1,43 b''
1 """Markdown Exporter class"""
1 """Markdown Exporter class"""
2
2
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (c) 2013, the IPython Development Team.
4 # Copyright (c) 2013, the IPython Development Team.
5 #
5 #
6 # Distributed under the terms of the Modified BSD License.
6 # Distributed under the terms of the Modified BSD License.
7 #
7 #
8 # The full license is in the file COPYING.txt, distributed with this software.
8 # The full license is in the file COPYING.txt, distributed with this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 from IPython.config import Config
15 from IPython.config import Config
16 from IPython.utils.traitlets import Unicode
17
16
18 from .templateexporter import TemplateExporter
17 from .templateexporter import TemplateExporter
19
18
20 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
21 # Classes
20 # Classes
22 #-----------------------------------------------------------------------------
21 #-----------------------------------------------------------------------------
23
22
24 class MarkdownExporter(TemplateExporter):
23 class MarkdownExporter(TemplateExporter):
25 """
24 """
26 Exports to a markdown document (.md)
25 Exports to a markdown document (.md)
27 """
26 """
28
27
29 def _file_extension_default(self):
28 def _file_extension_default(self):
30 return 'md'
29 return 'md'
31
30
32 def _template_file_default(self):
31 def _template_file_default(self):
33 return 'markdown'
32 return 'markdown'
34
33
35 output_mimetype = 'text/markdown'
34 output_mimetype = 'text/markdown'
36
35
37 def _raw_mimetypes_default(self):
36 def _raw_mimetypes_default(self):
38 return ['text/markdown', 'text/html', '']
37 return ['text/markdown', 'text/html', '']
39
38
40 @property
39 @property
41 def default_config(self):
40 def default_config(self):
42 c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
41 c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
43 c.merge(super(MarkdownExporter,self).default_config)
42 c.merge(super(MarkdownExporter,self).default_config)
44 return c
43 return c
@@ -1,33 +1,31 b''
1 """Python script Exporter class"""
1 """Python script Exporter class"""
2
2
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (c) 2013, the IPython Development Team.
4 # Copyright (c) 2013, the IPython Development Team.
5 #
5 #
6 # Distributed under the terms of the Modified BSD License.
6 # Distributed under the terms of the Modified BSD License.
7 #
7 #
8 # The full license is in the file COPYING.txt, distributed with this software.
8 # The full license is in the file COPYING.txt, distributed with this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 from IPython.utils.traitlets import Unicode
16
17 from .templateexporter import TemplateExporter
15 from .templateexporter import TemplateExporter
18
16
19 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
20 # Classes
18 # Classes
21 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
22
20
23 class PythonExporter(TemplateExporter):
21 class PythonExporter(TemplateExporter):
24 """
22 """
25 Exports a Python code file.
23 Exports a Python code file.
26 """
24 """
27 def _file_extension_default(self):
25 def _file_extension_default(self):
28 return 'py'
26 return 'py'
29
27
30 def _template_file_default(self):
28 def _template_file_default(self):
31 return 'python'
29 return 'python'
32
30
33 output_mimetype = 'text/x-python'
31 output_mimetype = 'text/x-python'
@@ -1,41 +1,40 b''
1 """restructuredText Exporter class"""
1 """restructuredText Exporter class"""
2
2
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (c) 2013, the IPython Development Team.
4 # Copyright (c) 2013, the IPython Development Team.
5 #
5 #
6 # Distributed under the terms of the Modified BSD License.
6 # Distributed under the terms of the Modified BSD License.
7 #
7 #
8 # The full license is in the file COPYING.txt, distributed with this software.
8 # The full license is in the file COPYING.txt, distributed with this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 from IPython.utils.traitlets import Unicode
16 from IPython.config import Config
15 from IPython.config import Config
17
16
18 from .templateexporter import TemplateExporter
17 from .templateexporter import TemplateExporter
19
18
20 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
21 # Classes
20 # Classes
22 #-----------------------------------------------------------------------------
21 #-----------------------------------------------------------------------------
23
22
24 class RSTExporter(TemplateExporter):
23 class RSTExporter(TemplateExporter):
25 """
24 """
26 Exports restructured text documents.
25 Exports restructured text documents.
27 """
26 """
28
27
29 def _file_extension_default(self):
28 def _file_extension_default(self):
30 return 'rst'
29 return 'rst'
31
30
32 def _template_file_default(self):
31 def _template_file_default(self):
33 return 'rst'
32 return 'rst'
34
33
35 output_mimetype = 'text/restructuredtext'
34 output_mimetype = 'text/restructuredtext'
36
35
37 @property
36 @property
38 def default_config(self):
37 def default_config(self):
39 c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
38 c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
40 c.merge(super(RSTExporter,self).default_config)
39 c.merge(super(RSTExporter,self).default_config)
41 return c
40 return c
@@ -1,45 +1,43 b''
1 """HTML slide show Exporter class"""
1 """HTML slide show Exporter class"""
2
2
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (c) 2013, the IPython Development Team.
4 # Copyright (c) 2013, the IPython Development Team.
5 #
5 #
6 # Distributed under the terms of the Modified BSD License.
6 # Distributed under the terms of the Modified BSD License.
7 #
7 #
8 # The full license is in the file COPYING.txt, distributed with this software.
8 # The full license is in the file COPYING.txt, distributed with this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 from IPython.utils.traitlets import Unicode
16
17 from IPython.nbconvert import preprocessors
15 from IPython.nbconvert import preprocessors
18 from IPython.config import Config
16 from IPython.config import Config
19
17
20 from .html import HTMLExporter
18 from .html import HTMLExporter
21
19
22 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
23 # Classes
21 # Classes
24 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
25
23
26 class SlidesExporter(HTMLExporter):
24 class SlidesExporter(HTMLExporter):
27 """Exports HTML slides with reveal.js"""
25 """Exports HTML slides with reveal.js"""
28
26
29 def _file_extension_default(self):
27 def _file_extension_default(self):
30 return 'slides.html'
28 return 'slides.html'
31
29
32 def _template_file_default(self):
30 def _template_file_default(self):
33 return 'slides_reveal'
31 return 'slides_reveal'
34
32
35 output_mimetype = 'text/html'
33 output_mimetype = 'text/html'
36
34
37 @property
35 @property
38 def default_config(self):
36 def default_config(self):
39 c = Config({
37 c = Config({
40 'RevealHelpPreprocessor': {
38 'RevealHelpPreprocessor': {
41 'enabled': True,
39 'enabled': True,
42 },
40 },
43 })
41 })
44 c.merge(super(SlidesExporter,self).default_config)
42 c.merge(super(SlidesExporter,self).default_config)
45 return c
43 return c
General Comments 0
You need to be logged in to leave comments. Login now