refactor(mtext): parse MTEXT via acadrust, drop OCS's own parser
OCS maintained a second MTEXT inline-code parser that duplicated acadrust's `mtext_format::parse_mtext`. Replace it with an adapter (`adapt_mtext_paragraphs`) that maps acadrust's structured MTextDocument onto the existing layout types (`MTextLine`/`RunState`); the layout engine (`layout_mtext`, `mtext_line_count`, and their callers) is unchanged. Removed the hand-rolled `parse_mtext_paragraphs*` and its helpers. Validated during migration by a differential test (adapter vs the old parser matched byte-for-byte over a 20-case corpus) and confirmed rendering identically in the app; the differential test is replaced with adapter-only unit tests. Relies on acadrust's new `MTextScalar` to tell absolute `\H` from relative `\Hx` (bumped the acadrust pin). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
896b6c385c
commit
b88e5e4ad5
2 changed files with 205 additions and 399 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -71,7 +71,7 @@ checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"
|
|||
[[package]]
|
||||
name = "acadrust"
|
||||
version = "0.4.0"
|
||||
source = "git+https://github.com/HakanSeven12/acadrust?branch=main#4d519473ee1c03275be87d9c3bda4ddc53db45b0"
|
||||
source = "git+https://github.com/HakanSeven12/acadrust?branch=main#eae0ec3ca1777c1a89d78374fe56a1edc130e5ed"
|
||||
dependencies = [
|
||||
"ahash 0.8.12",
|
||||
"anyhow",
|
||||
|
|
@ -3160,7 +3160,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "0b577e2d69827c4740cba2b52efaad1c4cc7c73042860b199710b3575c68438d"
|
||||
dependencies = [
|
||||
"bytecount",
|
||||
"memchr 1.0.2",
|
||||
"memchr 2.8.2",
|
||||
"nom 8.0.0",
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue