|
1 | 1 | # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/10_processors.ipynb. |
2 | 2 |
|
3 | 3 | # %% auto 0 |
4 | | -__all__ = ['populate_language', 'insert_warning', 'cell_lang', 'add_show_docs', 'mv_exports', 'add_links', 'add_fold', |
5 | | - 'strip_ansi', 'strip_hidden_metadata', 'hide_', 'hide_line', 'filter_stream_', 'clean_magics', |
6 | | - 'rm_header_dash', 'rm_export', 'clean_show_doc', 'exec_show_docs', 'FilterDefaults'] |
| 4 | +__all__ = ['CARD_DIV', 'CLOSE_DIV', 'populate_language', 'insert_warning', 'cell_lang', 'add_show_docs', 'mv_exports', |
| 5 | + 'add_links', 'add_fold', 'strip_ansi', 'strip_hidden_metadata', 'hide_', 'hide_line', 'filter_stream_', |
| 6 | + 'clean_magics', 'rm_header_dash', 'rm_export', 'clean_show_doc', 'exec_show_docs', 'FilterDefaults'] |
7 | 7 |
|
8 | 8 | # %% ../nbs/api/10_processors.ipynb 2 |
9 | 9 | import ast |
@@ -83,13 +83,19 @@ def begin(self): |
83 | 83 | nb.has_docs_ = shown_docs or exports |
84 | 84 |
|
85 | 85 | # %% ../nbs/api/10_processors.ipynb 17 |
| 86 | +CARD_DIV = mk_cell('::: {.py-2 .px-3 .mb-4 fig-align="center" .border .rounded .shadow-sm}', cell_type='markdown') |
| 87 | +CLOSE_DIV = mk_cell(':::', cell_type='markdown') |
| 88 | + |
86 | 89 | class mv_exports(Processor): |
87 | 90 | "Move `exports` cells to after the `show_doc`" |
88 | 91 | def begin(self): |
89 | 92 | cells = self.nb.cells |
90 | 93 | exports = L(c for c in cells if c.cell_type=='code' and 'exports' in c.directives_) |
91 | 94 | for cell in reversed(exports): |
92 | | - if getattr(cells[cell.idx_+1], 'has_sd', 0): cells.insert(cell.idx_+1, cells.pop(cell.idx_)) |
| 95 | + if getattr(cells[cell.idx_+1], 'has_sd', 0): |
| 96 | + cells.insert(cell.idx_+1, cells.pop(cell.idx_)) |
| 97 | + cells.insert(cell.idx_, CARD_DIV) |
| 98 | + cells.insert(cell.idx_+3, CLOSE_DIV) |
93 | 99 |
|
94 | 100 | # %% ../nbs/api/10_processors.ipynb 18 |
95 | 101 | _re_defaultexp = re.compile(r'^\s*#\|\s*default_exp\s+(\S+)', flags=re.MULTILINE) |
|
0 commit comments