ipypublish.preprocessors.latex_doc_defaults module¶
-
class
ipypublish.preprocessors.latex_doc_defaults.MetaDefaults(*args, **kwargs)[source]¶ Bases:
nbconvert.preprocessors.base.Preprocessora preprocessor which enters default metadata tags into all cell metadata, without overriding any currently set
-
cell_defaults¶ An instance of a Python dict.
-
nb_defaults¶ An instance of a Python dict.
-
overwrite¶ A boolean (True, False) trait.
-
preprocess(nb, resources)[source]¶ Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
nb (
NotebookNode) – Notebook being convertedresources (
dictionary) – Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
-
-
ipypublish.preprocessors.latex_doc_defaults.flatten(d, key_as_tuple=True, sep='.')[source]¶ get nested dict as {key:val,…}, where key is tuple/string of all nested keys
- Parameters
Examples
>>> from pprint import pprint
>>> d = {1:{"a":"A"},2:{"b":"B"}} >>> pprint(flatten(d)) {(1, 'a'): 'A', (2, 'b'): 'B'}
>>> d = {1:{"a":"A"},2:{"b":"B"}} >>> pprint(flatten(d,key_as_tuple=False)) {'1.a': 'A', '2.b': 'B'}