Exercise a warning-free article and close inline table ends
This commit is contained in:
1 parent
d362d189ac
commit
09b6c2b810
3 files changed
+37
-3
No files matched your search
+35
-1
@@ -1920,7 +1920,16 @@ fn strip_page_geometry(source: &str) -> (String, PageGeometry) {
|
||||
for line in source.lines() {
|
||||
let trimmed = line.trim();
|
||||
if let Some((_, text, environment, _)) = tabular.as_mut() {
|
||||
if trimmed == format!("\\end{{{environment}}}") {
|
||||
let end = format!("\\end{{{environment}}}");
|
||||
let closed = trimmed.strip_suffix(&end);
|
||||
if let Some(prefix) = closed {
|
||||
let prefix = prefix.trim();
|
||||
if !prefix.is_empty() {
|
||||
if !text.is_empty() {
|
||||
text.push('\n');
|
||||
}
|
||||
text.push_str(prefix);
|
||||
}
|
||||
let (template, text, _, target) = tabular.take().unwrap();
|
||||
geometry
|
||||
.tabular
|
||||
@@ -10373,6 +10382,31 @@ a & b
|
||||
assert_eq!(geometry.macros.len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compatibility_sample_document_is_warning_free() {
|
||||
let source = concat!(
|
||||
"\\documentclass{article}\n",
|
||||
"\\title{A Sample}\n",
|
||||
"\\author{Ada}\n",
|
||||
"\\begin{document}\n",
|
||||
"\\maketitle\n\n",
|
||||
"\\begin{abstract}\nShort abstract.\n\\end{abstract}\n\n",
|
||||
"\\tableofcontents\n\n",
|
||||
"\\section{One}\n\\label{sec:one}\n\n",
|
||||
"Some \\textbf{bold} text with $x^2$ math.\n\n",
|
||||
"\\begin{equation}\n a = b\n\\end{equation}\n\n",
|
||||
"\\begin{figure}[t]\n\\rule{100pt}{40pt}\n\\caption{Cap}\n\\label{fig:a}\n\\end{figure}\n\n",
|
||||
"\\begin{table}[h]\n\\begin{tabular}{lc}\n\\hline A & B \\\\\n\\hline\\end{tabular}\n\\caption{Tab}\n\\end{table}\n\n",
|
||||
"A note\\footnote{Note text.} and see \\ref{sec:one} on page \\pageref{fig:a}.\n\n",
|
||||
"\\begin{thebibliography}{1}\n\\bibitem{a} Entry.\n\\end{thebibliography}\n",
|
||||
"\\end{document}\n"
|
||||
);
|
||||
let json = preview_json(source).expect("preview");
|
||||
assert!(json.contains("\"warnings\":[]"), "warnings: {}", json);
|
||||
assert!(json.contains(">O</text>"));
|
||||
assert!(json.contains(">C</text>"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ifcat_compares_character_categories() {
|
||||
let letters = "\\ifcat a b same\\else diff\\fi";
|
||||
|
||||
Reference in new issue
Block a user