Indent quote blocks in the route-D preview

This commit is contained in:
gloamxun committed 2026-10-20 22:04:50 +08:00
1 parent 4772985ffe
commit ccda740476
3 files changed
+32 -2

No files matched your search

+2 -2
View File
@@ -232,7 +232,7 @@ for a later overlaid slash.
| M4 math | partial | atoms, scripts, fractions, roots, delimiters, accents, operators, classes, braces, boxed, negated; no math painter/shrink wrapping | | M4 math | partial | atoms, scripts, fractions, roots, delimiters, accents, operators, classes, braces, boxed, negated; no math painter/shrink wrapping |
| M5 NFSS/TFM | partial | runtime `cmr10.tfm` widths/heights/depths/kern pairs and ff/fi/fl/ffi/ffl ligatures; all five text faces embed Liberation Serif/Mono as Type0 CID fonts with Identity-H, ToUnicode and `/W` glyph widths; no Base-14 dependency; SVG carries family/weight/style | | M5 NFSS/TFM | partial | runtime `cmr10.tfm` widths/heights/depths/kern pairs and ff/fi/fl/ffi/ffl ligatures; all five text faces embed Liberation Serif/Mono as Type0 CID fonts with Identity-H, ToUnicode and `/W` glyph widths; no Base-14 dependency; SVG carries family/weight/style |
| M6 specials/XObject | partial | raw specials, RGB image XObjects, URI link annotations; class/package execution absent | | M6 specials/XObject | partial | raw specials, RGB image XObjects, URI link annotations; class/package execution absent |
| M7 incremental integration | partial | route-D preview/PDF/edit endpoints with content-based page hashes and basic section/emphasis/display-math/itemize/enumerate/description mapping; editor integration pending | | M7 incremental integration | partial | route-D preview/PDF/edit endpoints with content-based page hashes and basic section/emphasis/display-math/itemize/enumerate/description/quote mapping; editor integration pending |
v1 remains the production renderer; the route-D core is additive and tested independently. v1 remains the production renderer; the route-D core is additive and tested independently.
@@ -262,7 +262,7 @@ M3 (partial): `Unit::halign` normalizes column widths, intercolumn gaps, row hei
Math coverage includes fractions/roots, scripts, `\left...\right` with body-scaled delimiters, `\middle`, `\big`/`\Big`/`\bigg`/`\Bigg` and their `l`/`r` forms, control-sequence delimiters, accents (dot/check/breve/acute/grave/ring), `\text`/`\mathrm`, `\overbrace`/`\underbrace`, `\overset`/`\underset`, `\binom`, `\cancel`/`\bcancel`/`\xcancel`, `\bmod`/`\pmod`, fence symbols, `\operatorname*` and `\mathop` limits. Math coverage includes fractions/roots, scripts, `\left...\right` with body-scaled delimiters, `\middle`, `\big`/`\Big`/`\bigg`/`\Bigg` and their `l`/`r` forms, control-sequence delimiters, accents (dot/check/breve/acute/grave/ring), `\text`/`\mathrm`, `\overbrace`/`\underbrace`, `\overset`/`\underset`, `\binom`, `\cancel`/`\bcancel`/`\xcancel`, `\bmod`/`\pmod`, fence symbols, `\operatorname*` and `\mathop` limits.
The crate currently has 138 unit tests plus one route-D integration test. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 228 tests (138 route-D unit, 1 route-D integration, 71 v1 integration, 13 server, 4 v1 unit, 1 doctest). v1 remains the live server path. The crate currently has 138 unit tests plus one route-D integration test. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 229 tests (138 route-D unit, 1 route-D integration, 71 v1 integration, 14 server, 4 v1 unit, 1 doctest). v1 remains the live server path.
### M0 incremental demo ### M0 incremental demo
+15
View File
@@ -137,6 +137,21 @@ fn parse_blocks(raw: &str) -> Vec<SourceParagraph> {
return items; return items;
} }
} }
if let Some(body) = raw
.strip_prefix("\\begin{quote}")
.and_then(|text| text.strip_suffix("\\end{quote}"))
{
let text = body.trim();
if !text.is_empty() {
return vec![SourceParagraph {
text: text.to_string(),
font: ParagraphFont::Roman,
line_height: 12,
math: false,
left_skip: 12,
}];
}
}
if let Some(body) = raw if let Some(body) = raw
.strip_prefix("\\begin{description}") .strip_prefix("\\begin{description}")
.and_then(|text| text.strip_suffix("\\end{description}")) .and_then(|text| text.strip_suffix("\\end{description}"))
+15
View File
@@ -474,6 +474,21 @@ fn route_d_renders_description_lists() {
assert!(svg.contains(">M</text>")); assert!(svg.contains(">M</text>"));
} }
#[test]
fn route_d_renders_quote_blocks() {
let server = TestServer::start("route-d-quote");
let response = server.request(
"POST",
"/api/route-d/preview",
b"\\begin{quote}Quoted text\\end{quote}",
"text/plain",
);
assert_eq!(response.status, 200, "{}", response.text());
let value: Value = serde_json::from_slice(&response.body).expect("route-D JSON");
let svg = value["pages"][0]["svg"].as_str().unwrap();
assert!(svg.contains(">Q</text>"));
}
#[test] #[test]
fn edits_route_d_preview_pages() { fn edits_route_d_preview_pages() {
let server = TestServer::start("route-d-edit"); let server = TestServer::start("route-d-edit");