Skip noalign material in halign sources
This commit is contained in:
1 parent
3639dc0f20
commit
cd0ec782d5
2 files changed
+21
No files matched your search
@@ -243,6 +243,14 @@ impl Unit {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let mut raw_row = raw_row.trim();
|
let mut raw_row = raw_row.trim();
|
||||||
|
if let Some(rest) = raw_row.strip_prefix(r"\noalign") {
|
||||||
|
let rest = rest.trim_start();
|
||||||
|
if let Some(body) = rest.strip_prefix('{') {
|
||||||
|
if let Some((_, tail)) = body.split_once('}') {
|
||||||
|
raw_row = tail.trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
let mut rule = false;
|
let mut rule = false;
|
||||||
if let Some(rest) = raw_row.strip_prefix(r"\hline") {
|
if let Some(rest) = raw_row.strip_prefix(r"\hline") {
|
||||||
rule = true;
|
rule = true;
|
||||||
@@ -1221,6 +1229,17 @@ mod tests {
|
|||||||
let engine = Engine::layout(&document);
|
let engine = Engine::layout(&document);
|
||||||
assert_eq!(engine.pages().len(), 2);
|
assert_eq!(engine.pages().len(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn halign_skips_noalign_material() {
|
||||||
|
let unit = Unit::halign_from_source(1, r"A & B \\ \noalign{\vskip 4pt} C & D", 2, 10);
|
||||||
|
let VerticalItem::Halign(table) = &unit.items[0] else {
|
||||||
|
panic!("expected halign")
|
||||||
|
};
|
||||||
|
assert_eq!(table.rows.len(), 2);
|
||||||
|
assert_eq!(table.rows[1].cells[0].text, "C");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn halign_template_centers_and_right_aligns_cells() {
|
fn halign_template_centers_and_right_aligns_cells() {
|
||||||
let unit = Unit::halign_from_source_with_template(1, "lcr", r"A & B & C", 10);
|
let unit = Unit::halign_from_source_with_template(1, "lcr", r"A & B & C", 10);
|
||||||
|
|||||||
@@ -198,3 +198,5 @@ add filled rules to the vertical list; rules consume page height like boxes.
|
|||||||
|
|
||||||
`\not` becomes `MathAtom::Negated`, preserving the base atom's geometry
|
`\not` becomes `MathAtom::Negated`, preserving the base atom's geometry
|
||||||
for a later overlaid slash.
|
for a later overlaid slash.
|
||||||
|
|
||||||
|
`\noalign{...}` material in a halign source is skipped while rows are scanned.
|
||||||
Reference in new issue
Block a user