##// END OF EJS Templates
export_format is an enum...
MinRK -
Show More
@@ -24,7 +24,9 b' import glob'
24 #From IPython
24 #From IPython
25 from IPython.core.application import BaseIPythonApplication, base_aliases, base_flags
25 from IPython.core.application import BaseIPythonApplication, base_aliases, base_flags
26 from IPython.config import catch_config_error, Configurable
26 from IPython.config import catch_config_error, Configurable
27 from IPython.utils.traitlets import Unicode, List, Instance, DottedObjectName, Type
27 from IPython.utils.traitlets import (
28 Unicode, List, Instance, DottedObjectName, Type, CaselessStrEnum,
29 )
28 from IPython.utils.importstring import import_item
30 from IPython.utils.importstring import import_item
29
31
30 from .exporters.export import export_by_name, get_export_names, ExporterNameError
32 from .exporters.export import export_by_name, get_export_names, ExporterNameError
@@ -70,18 +72,31 b' class NbConvertApp(BaseIPythonApplication):'
70 return classes
72 return classes
71
73
72 description = Unicode(
74 description = Unicode(
73 u"""This application is used to convert notebook files (*.ipynb).
75 u"""This application is used to convert notebook files (*.ipynb)
74 An ipython config file can be used to batch convert notebooks in the
76 to various other formats.""")
75 current directory.""")
76
77
77 examples = Unicode(u"""
78 examples = Unicode(u"""
79 The simplest way to use nbconvert is
80
81 > ipython nbconvert mynotebook.ipynb
82
83 which will convert mynotebook.ipynb to the default format (probably HTML).
84
85 You can specify the export format with `--format`.
86 Options include {0}
87
88 > ipython nbconvert --format latex mynotebook.ipnynb
89
90 You can also pipe the output to stdout, rather than a file
91
92 > ipython nbconvert mynotebook.ipynb --stdout
93
78 Multiple notebooks can be given at the command line in a couple of
94 Multiple notebooks can be given at the command line in a couple of
79 different ways:
95 different ways:
80
96
81 > ipython nbconvert notebook*.ipynb
97 > ipython nbconvert notebook*.ipynb
82 > ipython nbconvert notebook1.ipynb notebook2.ipynb
98 > ipython nbconvert notebook1.ipynb notebook2.ipynb
83 > ipython nbconvert --format sphinx_howto notebook.ipynb
99 """.format(get_export_names()))
84 """)
85 #Writer specific variables
100 #Writer specific variables
86 writer = Instance('IPython.nbconvert.writers.base.WriterBase',
101 writer = Instance('IPython.nbconvert.writers.base.WriterBase',
87 help="""Instance of the writer class used to write the
102 help="""Instance of the writer class used to write the
@@ -101,13 +116,16 b' class NbConvertApp(BaseIPythonApplication):'
101
116
102
117
103 #Other configurable variables
118 #Other configurable variables
104 export_format = Unicode(
119 export_format = CaselessStrEnum(get_export_names(),
105 "full_html", config=True,
120 default_value="full_html",
106 help="""If specified, nbconvert will convert the document(s) specified
121 config=True,
107 using this format.""")
122 help="""The export format to be used."""
123 )
108
124
109 notebooks = List([], config=True, help="""List of notebooks to convert.
125 notebooks = List([], config=True, help="""List of notebooks to convert.
110 Search patterns are supported.""")
126 Wildcards are supported.
127 Filenames passed positionally will be added to the list.
128 """)
111
129
112 @catch_config_error
130 @catch_config_error
113 def initialize(self, argv=None):
131 def initialize(self, argv=None):
General Comments 0
You need to be logged in to leave comments. Login now