diff --git a/nbdev/export2html.py b/nbdev/export2html.py
index dde5aec20..62cb0ee74 100644
--- a/nbdev/export2html.py
+++ b/nbdev/export2html.py
@@ -315,7 +315,7 @@ def _documented(name):
res.append(cell)
if check_re_multi(cell, [_re_export, _re_export_magic]):
for n in export_names(cell['source'], func_only=True):
- if not _documented(n): res.append(_show_doc_cell(n, cls_lvl=cls_lvl))
+ if not _documented(n): res.insert(len(res)-1, _show_doc_cell(n, cls_lvl=cls_lvl))
return res
# Cell
diff --git a/nbs/03_export2html.ipynb b/nbs/03_export2html.ipynb
index 67b8f398f..d1e243c58 100644
--- a/nbs/03_export2html.ipynb
+++ b/nbs/03_export2html.ipynb
@@ -1060,6 +1060,15 @@
" return {'cell_type': 'code', 'execution_count': None, 'metadata': {}, 'outputs': [], 'source': source}"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import pdb"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -1092,7 +1101,7 @@
" res.append(cell)\n",
" if check_re_multi(cell, [_re_export, _re_export_magic]):\n",
" for n in export_names(cell['source'], func_only=True):\n",
- " if not _documented(n): res.append(_show_doc_cell(n, cls_lvl=cls_lvl))\n",
+ " if not _documented(n): res.insert(len(res)-1, _show_doc_cell(n, cls_lvl=cls_lvl))\n",
" return res"
]
},
@@ -1115,9 +1124,9 @@
"added_cells = add_show_docs(tst_cells, cls_lvl=3)\n",
"test_eq(len(added_cells), 3)\n",
"test_eq(added_cells[0], tst_nb['cells'][i-1])\n",
- "test_eq(added_cells[1], tst_nb['cells'][i])\n",
- "test_eq(added_cells[2], _show_doc_cell('read_nb', cls_lvl=3))\n",
- "test_eq(added_cells[2]['source'], 'show_doc(read_nb, default_cls_level=3)')\n",
+ "test_eq(added_cells[2], tst_nb['cells'][i])\n",
+ "test_eq(added_cells[1], _show_doc_cell('read_nb', cls_lvl=3))\n",
+ "test_eq(added_cells[1]['source'], 'show_doc(read_nb, default_cls_level=3)')\n",
"\n",
"for flag in ['#export', '%nbdev_export', '#exports', '%nbdev_export_and_show']:\n",
" for show_doc_source in [\n",
@@ -1702,7 +1711,7 @@
"fake_nb = {k:v for k,v in tst_nb.items() if k != 'cells'}\n",
"fake_nb['cells'] = [tst_nb['cells'][0].copy()] + added_cells\n",
"fake_nb = execute_nb(fake_nb, mod='export')\n",
- "assert len(fake_nb['cells'][-1]['outputs']) > 0"
+ "assert len(fake_nb['cells'][-2]['outputs']) > 0"
]
},
{
@@ -1939,36 +1948,7 @@
"metadata": {
"hide_input": false
},
- "outputs": [
- {
- "data": {
- "text/html": [],
- "text/plain": [
- ""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "converting: /home/peter/github/pete88b/nbdev/nbs/01_sync.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/05_merge.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/99_search.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/tutorial.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/06_cli.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/index.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/00_export.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/04_test.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/magic_flags.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/07_clean.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/02_showdoc.ipynb\n",
- "converting: /home/peter/github/pete88b/nbdev/nbs/03_export2html.ipynb\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"#slow\n",
"#hide\n",
@@ -2354,13 +2334,6 @@
"from nbdev.export import *\n",
"notebook2script()"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {