slidesync 0.4.0__tar.gz → 0.4.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: slidesync
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Bidirectional sync between a Slidev markdown deck and Google Slides as native, editable objects
5
5
  Author-email: Daniel Hails <slidesync@hails.info>
6
6
  License: MIT
@@ -22,7 +22,7 @@ Bidirectional sync between a [Slidev](https://sli.dev) markdown deck and **Googl
22
22
  Slides** — as native, editable objects (title/body/bullets/tables/positioned
23
23
  images, brand-styled text boxes), not pasted screenshots.
24
24
 
25
- Version: 0.4.0
25
+ Version: 0.4.1
26
26
 
27
27
  ```bash
28
28
  uvx slidesync --help # run without installing
@@ -4,7 +4,7 @@ Bidirectional sync between a [Slidev](https://sli.dev) markdown deck and **Googl
4
4
  Slides** — as native, editable objects (title/body/bullets/tables/positioned
5
5
  images, brand-styled text boxes), not pasted screenshots.
6
6
 
7
- Version: 0.4.0
7
+ Version: 0.4.1
8
8
 
9
9
  ```bash
10
10
  uvx slidesync --help # run without installing
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "slidesync"
3
- version = "0.4.0"
3
+ version = "0.4.1"
4
4
  authors = [
5
5
  { name = "Daniel Hails", email = "slidesync@hails.info" },
6
6
  ]
@@ -32,7 +32,7 @@ include = ["slidesync*"]
32
32
  dev = ["pytest>=8"]
33
33
 
34
34
  [tool.bumpver]
35
- current_version = "0.4.0"
35
+ current_version = "0.4.1"
36
36
  version_pattern = "MAJOR.MINOR.PATCH"
37
37
  commit_message = "bump version {old_version} -> {new_version}"
38
38
  commit = true
@@ -30,7 +30,7 @@ from slidesync._sync import (
30
30
  write_slidev,
31
31
  )
32
32
 
33
- __version__ = "0.4.0"
33
+ __version__ = "0.4.1"
34
34
 
35
35
  __all__ = [
36
36
  "Para",
@@ -2015,6 +2015,20 @@ def _diff(a: list[str], b: list[str], a_name: str, b_name: str) -> str:
2015
2015
  return "\n".join(difflib.unified_diff(a, b, a_name, b_name, lineterm=""))
2016
2016
 
2017
2017
 
2018
+ def _content_lines(src: str | None, template: str | None) -> list[str] | None:
2019
+ """Markdown text lines as they would actually RENDER for this template.
2020
+
2021
+ graph/full slides are text-free (only the image renders), so markdown body
2022
+ text on them can never reach the deck — comparing it against the live slide
2023
+ would report drift forever.
2024
+ """
2025
+ if src is None:
2026
+ return None
2027
+ if (template or "").lower() in ("graph", "full"):
2028
+ return []
2029
+ return text_lines_md(src)
2030
+
2031
+
2018
2032
  def _live_state(s) -> tuple[list[str], str, str | None, dict]:
2019
2033
  """(text lines, normalised notes, base source, marker) of a live slide."""
2020
2034
  notes_raw = _read_notes(s)
@@ -2040,13 +2054,14 @@ def _clobber_risks(pres, managed, source, pruned) -> list[str]:
2040
2054
  replacing = sl is not None and sl.custom is None and sl.object_id != oid
2041
2055
  if not (replacing or oid in pruned) or live.get(oid) is None:
2042
2056
  continue
2043
- live_lines, live_notes, base_src, _marker_ = _live_state(live[oid])
2057
+ live_lines, live_notes, base_src, marker = _live_state(live[oid])
2044
2058
  if base_src is None:
2045
2059
  continue
2046
- if (live_lines == text_lines_md(base_src)
2060
+ if (live_lines == _content_lines(base_src, marker.get("template"))
2047
2061
  and live_notes == " ".join(_extract_notes(base_src).split())):
2048
2062
  continue # deck untouched since last push
2049
- if (sl is not None and live_lines == text_lines_md(sl.src or "")
2063
+ if (sl is not None
2064
+ and live_lines == _content_lines(sl.src or "", sl.template_name)
2050
2065
  and live_notes == " ".join((sl.notes or "").split())):
2051
2066
  continue # local already carries the live edit
2052
2067
  out.append(sl.key if sl is not None else oid)
@@ -2178,8 +2193,9 @@ def cmd_sync(args):
2178
2193
  if sl.custom is not None:
2179
2194
  continue # pull-authoritative; drawings are captured by pull, not diffed
2180
2195
  live_lines, live_notes, base_src, marker = _live_state(s)
2181
- base = text_lines_md(base_src) if base_src is not None else None
2182
- status = classify_drift(base, text_lines_md(sl.src or ""), live_lines)
2196
+ base = _content_lines(base_src, marker.get("template"))
2197
+ local = _content_lines(sl.src or "", sl.template_name) or []
2198
+ status = classify_drift(base, local, live_lines)
2183
2199
  if status in ("clean", "converged"):
2184
2200
  continue
2185
2201
  if status == "local-edit":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: slidesync
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Bidirectional sync between a Slidev markdown deck and Google Slides as native, editable objects
5
5
  Author-email: Daniel Hails <slidesync@hails.info>
6
6
  License: MIT
@@ -22,7 +22,7 @@ Bidirectional sync between a [Slidev](https://sli.dev) markdown deck and **Googl
22
22
  Slides** — as native, editable objects (title/body/bullets/tables/positioned
23
23
  images, brand-styled text boxes), not pasted screenshots.
24
24
 
25
- Version: 0.4.0
25
+ Version: 0.4.1
26
26
 
27
27
  ```bash
28
28
  uvx slidesync --help # run without installing
@@ -290,3 +290,31 @@ def test_sync_recaptures_orphaned_comment_via_key_hash(env):
290
290
  _push(env) # re-render replaces the slide; the thread's page id now dangles
291
291
  _sync_cmd(env)
292
292
  assert "<!-- @Daniel Hails: anchored before the re-render -->" in env.path.read_text()
293
+
294
+
295
+ GRAPH_MD = MD + """
296
+ ---
297
+ template: graph
298
+ id: fig-placeholder
299
+ ---
300
+ ![[Bracketed placeholder alt that defeats IMAGE_RE]](../figures/missing.png)
301
+
302
+ <!-- caption comment -->
303
+ """
304
+
305
+
306
+ def test_graph_slides_with_unrenderable_text_stay_clean(tmp_path, monkeypatch):
307
+ # A graph/full slide is text-free: body text in the markdown (e.g. an image
308
+ # line whose bracketed alt breaks IMAGE_RE) can never render, so it must
309
+ # not register as drift. Regression: the live probe flagged placeholder
310
+ # graph slides as live-drift forever.
311
+ store, drive = FakeStore(), FakeDrive()
312
+ slides_api = FakeSlides(store)
313
+ monkeypatch.setattr(_sync, "get_services", lambda account: (slides_api, drive))
314
+ path = tmp_path / "deck.slidev.md"
315
+ path.write_text(GRAPH_MD)
316
+ push(slides_api, drive, DECK, load_slides(path), anchor=None, prune=False,
317
+ base_dir=tmp_path)
318
+ before = path.read_text()
319
+ cmd_sync(SimpleNamespace(source=path, deck=DECK, account=None))
320
+ assert path.read_text() == before # no write-back, no conflict, no churn
File without changes
File without changes
File without changes
File without changes