nbsync 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nbsync/sync.py +22 -8
- {nbsync-0.1.3.dist-info → nbsync-0.1.4.dist-info}/METADATA +1 -1
- {nbsync-0.1.3.dist-info → nbsync-0.1.4.dist-info}/RECORD +6 -6
- {nbsync-0.1.3.dist-info → nbsync-0.1.4.dist-info}/WHEEL +0 -0
- {nbsync-0.1.3.dist-info → nbsync-0.1.4.dist-info}/entry_points.txt +0 -0
- {nbsync-0.1.3.dist-info → nbsync-0.1.4.dist-info}/licenses/LICENSE +0 -0
nbsync/sync.py
CHANGED
@@ -35,7 +35,7 @@ class Synchronizer:
|
|
35
35
|
yield elem
|
36
36
|
|
37
37
|
if isinstance(elem, Image | CodeBlock):
|
38
|
-
update_notebooks(
|
38
|
+
update_notebooks(elem, notebooks, self.store)
|
39
39
|
|
40
40
|
for url, notebook in notebooks.items():
|
41
41
|
if url not in self.notebooks or not self.notebooks[url].equals(notebook):
|
@@ -58,17 +58,13 @@ class Synchronizer:
|
|
58
58
|
if isinstance(elem, str):
|
59
59
|
yield elem
|
60
60
|
|
61
|
-
elif
|
62
|
-
|
63
|
-
nb = self.notebooks[elem.url].nb
|
64
|
-
yield convert_image(elem, nb)
|
65
|
-
elif code_block := convert_code_block(elem):
|
66
|
-
yield code_block
|
61
|
+
elif cell := convert(elem, self.notebooks):
|
62
|
+
yield cell
|
67
63
|
|
68
64
|
|
69
65
|
def update_notebooks(
|
70
|
-
notebooks: dict[str, Notebook],
|
71
66
|
elem: Image | CodeBlock,
|
67
|
+
notebooks: dict[str, Notebook],
|
72
68
|
store: Store,
|
73
69
|
) -> None:
|
74
70
|
url = elem.url
|
@@ -93,6 +89,24 @@ def update_notebooks(
|
|
93
89
|
notebook.add_cell(elem.identifier, source)
|
94
90
|
|
95
91
|
|
92
|
+
def convert(
|
93
|
+
elem: Image | CodeBlock,
|
94
|
+
notebooks: dict[str, Notebook],
|
95
|
+
) -> str | Cell:
|
96
|
+
if elem.identifier not in [".", "_"]:
|
97
|
+
if isinstance(elem, Image):
|
98
|
+
if elem.url not in notebooks:
|
99
|
+
logger.warning(f"Notebook not found: {elem.url}")
|
100
|
+
return ""
|
101
|
+
|
102
|
+
nb = notebooks[elem.url].nb
|
103
|
+
return convert_image(elem, nb)
|
104
|
+
|
105
|
+
return convert_code_block(elem)
|
106
|
+
|
107
|
+
return ""
|
108
|
+
|
109
|
+
|
96
110
|
def convert_image(image: Image, nb: NotebookNode) -> Cell:
|
97
111
|
try:
|
98
112
|
image.source = get_source(nb, image.identifier)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nbsync
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.4
|
4
4
|
Summary: MkDocs plugin treating Jupyter notebooks, Python scripts and Markdown files as first-class citizens for documentation with dynamic execution and real-time synchronization
|
5
5
|
Project-URL: Documentation, https://daizutabi.github.io/nbsync/
|
6
6
|
Project-URL: Source, https://github.com/daizutabi/nbsync
|
@@ -5,9 +5,9 @@ nbsync/markdown.py,sha256=xcPhQKWpFDyVQ_xtZCpFrnR0QED_hYs4PAyaT7dF3t4,3830
|
|
5
5
|
nbsync/notebook.py,sha256=Voh-e8RQsoYmWKnaHzAn4bm6Ud5v-aHwmng2Uc0rUts,1009
|
6
6
|
nbsync/plugin.py,sha256=YywBAD7fcrPg3-_9T_kSuvD8RBzsc_ovlIviGlKR9po,2835
|
7
7
|
nbsync/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
nbsync/sync.py,sha256=
|
9
|
-
nbsync-0.1.
|
10
|
-
nbsync-0.1.
|
11
|
-
nbsync-0.1.
|
12
|
-
nbsync-0.1.
|
13
|
-
nbsync-0.1.
|
8
|
+
nbsync/sync.py,sha256=M21moADW2dgvQB46ahbcd2aXOHHqwx9CwfjNO7GR2mQ,3835
|
9
|
+
nbsync-0.1.4.dist-info/METADATA,sha256=EzIqH3hnebqKZ0N1pFzGuE0zL-LNzyVYUyDKBNaRmRQ,6287
|
10
|
+
nbsync-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
11
|
+
nbsync-0.1.4.dist-info/entry_points.txt,sha256=bSqmJTDmrUoSm4yDjk8YDWxI71SShx16judadGdiKbA,47
|
12
|
+
nbsync-0.1.4.dist-info/licenses/LICENSE,sha256=wy1pqn52upuo_qYwY-epWmspwE-3UWJso0xodciGXYc,1062
|
13
|
+
nbsync-0.1.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|