Consume FloatBarrier and balance
\FloatBarrier (placeins) and \balance (balance) were unsupported and could leak into the body. Both are now removed in the body pass: flush requests are a no-op because floats are already placed in source order, and column balancing has no meaning in the single-column engine. A preview test puts both commands between two paragraphs and checks the text with no warnings or leaked commands.
This commit is contained in:
1 parent
c89f972a25
commit
c14c374d5d
4 files changed
+30
-6
No files matched your search
@@ -6481,6 +6481,7 @@ fn geometry_and_body_with_images(
|
||||
geometry.skip_registers = skip_registers;
|
||||
body = expand_links(&body);
|
||||
body = strip_inline_marks(&body, &mut geometry);
|
||||
body = body.replace("\\FloatBarrier", "").replace("\\balance", "");
|
||||
body = strip_scaled_boxes(&body);
|
||||
let today = today_string();
|
||||
body = expand_today(&body, &today);
|
||||
@@ -17510,6 +17511,29 @@ A definition.
|
||||
assert!(text.contains("D"), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn float_barrier_and_balance_are_consumed() {
|
||||
let source = "\\documentclass{article}\n\\begin{document}\n\nAlpha.\n\n\\FloatBarrier\n\n\\balance\n\nBeta.\n\n\\end{document}\n";
|
||||
let json = preview_json(source).expect("preview");
|
||||
let value: serde_json::Value = serde_json::from_str(&json).expect("JSON");
|
||||
assert_eq!(
|
||||
value["warnings"].as_array().map(Vec::len),
|
||||
Some(0),
|
||||
"{}",
|
||||
value["warnings"]
|
||||
);
|
||||
let svg = value["pages"][0]["svg"].as_str().expect("svg");
|
||||
let text: String = svg
|
||||
.split('>')
|
||||
.filter_map(|piece| piece.split('<').next())
|
||||
.collect::<String>()
|
||||
.split_whitespace()
|
||||
.collect();
|
||||
assert!(text.contains("Alpha.Beta."), "{text}");
|
||||
assert!(!text.contains("FloatBarrier"), "{text}");
|
||||
assert!(!text.contains("balance"), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn colorlet_aliases_colors_for_textcolor() {
|
||||
let source = "\\definecolor{accent}{HTML}{336699}\n\\colorlet{link}{accent}\n\n\\textcolor{link}{Deep}";
|
||||
|
||||
Reference in new issue
Block a user