##// END OF EJS Templates
Various improvements to generating config docs
Thomas Kluyver -
Show More
@@ -1,6 +1,6 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2
2
3 from IPython.utils.text import indent, wrap_paragraphs
3 from IPython.utils.text import indent, dedent
4
4
5 from IPython.terminal.ipapp import TerminalIPythonApp
5 from IPython.terminal.ipapp import TerminalIPythonApp
6 from IPython.kernel.zmq.kernelapp import IPKernelApp
6 from IPython.kernel.zmq.kernelapp import IPKernelApp
@@ -34,13 +34,12 b' def document_config_options(classes):'
34 dvr = dvr[:61]+'...'
34 dvr = dvr[:61]+'...'
35 # Double up backslashes, so they get to the rendered docs
35 # Double up backslashes, so they get to the rendered docs
36 dvr = dvr.replace('\\n', '\\\\n')
36 dvr = dvr.replace('\\n', '\\\\n')
37 lines.append(' Default: ' + dvr)
37 lines.append(' Default: `%s`' % dvr)
38 lines.append('')
38 lines.append('')
39
39
40 help = trait.get_metadata('help')
40 help = trait.get_metadata('help')
41 if help is not None:
41 if help is not None:
42 help = '\n\n'.join(wrap_paragraphs(help, 76))
42 lines.append(indent(dedent(help), 4))
43 lines.append(indent(help, 4))
44 else:
43 else:
45 lines.append(' No description')
44 lines.append(' No description')
46
45
@@ -72,8 +71,7 b" if __name__ == '__main__':"
72 write_doc('kernel', 'IPython kernel options', kernel_classes,
71 write_doc('kernel', 'IPython kernel options', kernel_classes,
73 preamble="These options can be used in :file:`ipython_kernel_config.py`",
72 preamble="These options can be used in :file:`ipython_kernel_config.py`",
74 )
73 )
75 nbclasses = set(NotebookApp().classes) - set(kernel_classes)
74 write_doc('notebook', 'IPython notebook options', NotebookApp().classes,
76 write_doc('notebook', 'IPython notebook options', nbclasses,
77 preamble="To configure the IPython kernel, see :doc:`kernel`."
75 preamble="To configure the IPython kernel, see :doc:`kernel`."
78 )
76 )
79
77
@@ -83,8 +81,7 b" if __name__ == '__main__':"
83 print("WARNING: Could not import qtconsoleapp. Config options for the "
81 print("WARNING: Could not import qtconsoleapp. Config options for the "
84 "Qt Console will not be documented.")
82 "Qt Console will not be documented.")
85 else:
83 else:
86 qtclasses = set(IPythonQtConsoleApp().classes) - set(kernel_classes)
84 write_doc('qtconsole', 'IPython Qt console options', IPythonQtConsoleApp().classes,
87 write_doc('qtconsole', 'IPython Qt console options', qtclasses,
88 preamble="To configure the IPython kernel, see :doc:`kernel`."
85 preamble="To configure the IPython kernel, see :doc:`kernel`."
89 )
86 )
90
87
General Comments 0
You need to be logged in to leave comments. Login now