content: Phase 5 — rich inline text via structured runs (861/861)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 40s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 40s
CtText.text may be a list of runs (text marks href); CtHeading/CtQuote rich, CtCode verbatim. New runs.sx overrides render/markdown/text methods (byte- identical for plain strings, opt-in). 4 modes: HTML tags / markdown / nested SX / plain asText (drift-proof). find-replace per-run marks-preserving; search across run boundaries; CRDT block-granularity LWW; data+wire round-trip. Runs are a Smalltalk-renderable list (not a dict — substrate can't read dict fields under nested render dispatch). +36 tests (44 suites). Phase 6 (char- level inline CRDT) recorded as future. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,11 @@
|
||||
;; via content/find-replace and a word count over asText stay consistent.
|
||||
;; Immutable; case-sensitive.
|
||||
;;
|
||||
;; A text field may be a plain string OR a list of rich-text runs (Phase 5,
|
||||
;; run = (text marks href)). fr-rep-text rewrites per run, preserving each run's
|
||||
;; marks/href; a match that physically straddles two runs is not joined (the
|
||||
;; replacement would have no single mark set) — each run is rewritten in place.
|
||||
;;
|
||||
;; Requires (loaded by harness): block.sx, transform.sx (content/map-blocks),
|
||||
;; table.sx (CtTable ivars).
|
||||
|
||||
@@ -24,6 +29,23 @@
|
||||
|
||||
(define fr-rep (fn (s from to) (replace (str s) from to)))
|
||||
|
||||
;; rewrite a text-bearing field that is either a plain string or a runs list
|
||||
(define
|
||||
fr-rep-text
|
||||
(fn
|
||||
(v from to)
|
||||
(if
|
||||
(list? v)
|
||||
(map
|
||||
(fn
|
||||
(r)
|
||||
(list
|
||||
(fr-rep (nth r 0) from to)
|
||||
(nth r 1)
|
||||
(nth r 2)))
|
||||
v)
|
||||
(fr-rep v from to))))
|
||||
|
||||
;; Blocks whose prose content find/replace rewrites (matches asText's set).
|
||||
(define
|
||||
fr-has-text?
|
||||
@@ -66,7 +88,7 @@
|
||||
(if (list? r) (map (fn (c) (fr-rep c from to)) r) r))
|
||||
rs))
|
||||
b1))))
|
||||
(else (blk-set b "text" (fr-rep (blk-get b "text") from to)))))))
|
||||
(else (blk-set b "text" (fr-rep-text (blk-get b "text") from to)))))))
|
||||
|
||||
(define
|
||||
content/find-replace
|
||||
|
||||
Reference in New Issue
Block a user