ctrl-kd 1.1.3__tar.gz → 1.1.4__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: ctrl-kd
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: Convert WordStar 4-7 documents and print-to-disk files to text, Markdown, HTML, RTF, or PDF. ^KD: save and done.
5
5
  Author: Jon Michaels
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ctrl-kd"
7
- version = "1.1.3"
7
+ version = "1.1.4"
8
8
  description = "Convert WordStar 4-7 documents and print-to-disk files to text, Markdown, HTML, RTF, or PDF. ^KD: save and done."
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ctrl-kd
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: Convert WordStar 4-7 documents and print-to-disk files to text, Markdown, HTML, RTF, or PDF. ^KD: save and done.
5
5
  Author: Jon Michaels
6
6
  License: MIT
@@ -4,7 +4,7 @@ from .emit import (emit_text, emit_markdown, emit_html, emit_rtf,
4
4
  emitter, get_emitter, formats, load_plugins)
5
5
  from .pdf import emit_pdf # registers the 'pdf' format
6
6
 
7
- __version__ = '1.1.3'
7
+ __version__ = '1.1.4'
8
8
 
9
9
  def convert(data: bytes, to: str = 'markdown', mode: str = 'modern',
10
10
  encoding: str = 'cp437', **options) -> str:
@@ -92,7 +92,12 @@ def _md_span(s):
92
92
  lead = esc[:len(esc) - len(esc.lstrip())]
93
93
  trail = esc[len(esc.rstrip()):]
94
94
  core = esc.strip()
95
- for st in s.styles:
95
+ # sorted: frozenset iteration order varies with hash seed, which made multi-style
96
+ # nesting order (e.g. bold+strike) nondeterministic BETWEEN RUNS. Alphabetical
97
+ # order happens to nest delimiter styles (b, i, strike) inside tag styles
98
+ # (sub, sup, u), which is also what the Swift port documents. Found by the
99
+ # ctrlkd-swift port's pre-vector determinism check (2026-07-29).
100
+ for st in sorted(s.styles):
96
101
  if st in _MD:
97
102
  core = f'{_MD[st]}{core}{_MD[st]}'
98
103
  elif st in _MD_HTML:
@@ -276,3 +276,11 @@ def test_pdf_chapter_drop_survives():
276
276
  ys = [float(m) for m in re.findall(rb'([0-9.]+) Td \(Chapter', pdf)]
277
277
  y2 = [float(m) for m in re.findall(rb'([0-9.]+) Td \(Second', pdf)]
278
278
  assert ys and y2 and ys[0] < y2[0] # page-1 text starts LOWER than page-2 text
279
+
280
+ def test_md_multistyle_span_is_deterministic():
281
+ # frozenset iteration made bold+strike nesting vary across runs (hash seed);
282
+ # found by the Swift port. sorted() pins it: delimiters inside, tags outside.
283
+ from ctrlkd.emit import _md_span
284
+ from ctrlkd.core import Span
285
+ assert _md_span(Span('w', frozenset({'b', 'strike'}))) == '~~**w**~~'
286
+ assert _md_span(Span('w', frozenset({'b', 'u'}))) == '<u>**w**</u>'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes