Compare commits
3
Commits
2c8d5e12d8
...
a798221817
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a798221817 | ||
|
|
6d4aa37189 | ||
|
|
1b0ce27ed3 |
No files matched your search
@@ -298,10 +298,11 @@ block.
|
||||
The `center` environment is a block: its content wraps at the text width and
|
||||
every line is centered without justification (natural spaces), so
|
||||
`\begin{center}\url{...}\end{center}` and centered short text match LaTeX.
|
||||
`\centering` inside a paragraph is still a no-op. `\raggedright` and
|
||||
`\raggedleft` are paragraph-level declarations: the affected runs use natural
|
||||
space widths, the declaration is scoped by groups and the `raggedright`/
|
||||
`raggedleft` environments, and the final line is not stretched to the margin.
|
||||
`\centering`, `\raggedright`, and `\raggedleft` are paragraph-level
|
||||
declarations: the affected runs use natural space widths, the declaration is
|
||||
scoped by groups and the matching environments, centered lines are offset by
|
||||
half the leftover width, and ragged-left/right lines are not stretched to the
|
||||
margin.
|
||||
|
||||
`\rule[raise]{width}{height}` is rendered as a filled rectangle in both the
|
||||
PDF and the SVG preview, including raised and dropped rules; a zero-thickness
|
||||
@@ -485,11 +486,11 @@ advisory breaks, starred `\vspace`/`\hspace`, `center`, `\hrule`, `\fbox`,
|
||||
| --- | --- | --- |
|
||||
| Boxes | `\rule`, inline framed `\fbox`, block `\parbox`/`\minipage`, `\vbox`/`\vtop` (as full-width block), inline `\mbox`/`\makebox`, `\raisebox`, `center`, `\hrule` | true nested VBox material |
|
||||
| Fonts | serif/sans/mono faces, bold/italic/mono/sans declarations, group scoping, true scaled small caps | — |
|
||||
| Paragraphs | Knuth-Plass breaking, TeX hyphenation, justification, centering, `\raggedright`/`\raggedleft`, `\parindent` (17pt default), `\hfill`/`\hfil` | `\centering` in running text |
|
||||
| Paragraphs | Knuth-Plass breaking, TeX hyphenation, justification, `\centering`/`\raggedright`/`\raggedleft`, `\parindent` (17pt default), `\hfill`/`\hfil` | — |
|
||||
| Notes/floats | footnotes with page-bottom insertion area, title/author `\thanks`, figure/table `[htbp]` placement (top/bottom/page/here approximations) | deferred float queue, `\textfraction` |
|
||||
| Contents | `\tableofcontents`, `\listoffigures`, `\listoftables` generated from numbered headings and captions, page numbers resolved after pagination | dotted leaders, per-chapter book/report contents |
|
||||
| Contents | `\tableofcontents`, `\listoffigures`, `\listoftables` generated from numbered headings and captions, dotted leaders, page numbers resolved after pagination | per-chapter book/report contents |
|
||||
| Pages | A4/Letter/... page sizes, margins/geometry, automatic pagination, `\newpage`, `\pagebreak`, plain/fancy page styles, `\thispagestyle`, fancyhdr L/C/R headers and footers | — |
|
||||
| Classes/packages | built-in + local classes, option protocol, local package options, base font sizes 10/11/12pt | class-specific section formatting |
|
||||
| Classes/packages | built-in + local classes, option protocol, local package options, base font sizes 10/11/12pt, chapter headings and numbering | class-specific formatting (automatic chapter page breaks) |
|
||||
| Live preview | incremental paragraph cache, page-hash diffing, SVG refresh | — |
|
||||
|
||||
The compatibility layer also covers spacing macros, text symbols/letters, style
|
||||
|
||||
@@ -167,6 +167,9 @@ pub struct PageStyleOverride {
|
||||
|
||||
/// Marker character used by `\thepage` inside header/footer runs; the page
|
||||
/// renderer substitutes the concrete page number before measuring and painting.
|
||||
/// Private-use marker for a dotted leader in generated contents lines.
|
||||
pub const CONTENTS_LEADER_MARKER: char = '\u{F6000}';
|
||||
|
||||
pub const PAGE_NUMBER_MARKER: char = '\u{F5000}';
|
||||
|
||||
pub fn page_number_marker_text() -> String {
|
||||
@@ -321,6 +324,7 @@ pub enum ParagraphAlignment {
|
||||
Justified,
|
||||
RaggedRight,
|
||||
RaggedLeft,
|
||||
Centered,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash)]
|
||||
|
||||
@@ -427,6 +427,9 @@ fn contents_kind(block: &Block) -> Option<ContentsKind> {
|
||||
fn contents_line_runs(title: &[Run], target: usize) -> Vec<Run> {
|
||||
let mut runs = title.to_vec();
|
||||
trim_run_end(&mut runs);
|
||||
runs.push(Run::plain(
|
||||
crate::document::CONTENTS_LEADER_MARKER.to_string(),
|
||||
));
|
||||
let mut filler = Run::plain(String::new());
|
||||
filler.glue = Some(TeXGlue {
|
||||
width: common::Scaled::ZERO,
|
||||
@@ -457,7 +460,8 @@ struct Parser {
|
||||
text_style_stack: Vec<(expanded::TextStyle, bool, bool, bool, bool, bool)>,
|
||||
style_declarations: Vec<(usize, expanded::TextStyle)>,
|
||||
group_depth: usize,
|
||||
section_numbers: [u32; 3],
|
||||
section_numbers: [u32; 4],
|
||||
has_chapters: bool,
|
||||
equation_number: u32,
|
||||
figure_number: u32,
|
||||
table_number: u32,
|
||||
@@ -515,7 +519,8 @@ impl Parser {
|
||||
text_style_stack: Vec::new(),
|
||||
style_declarations: Vec::new(),
|
||||
group_depth: 0,
|
||||
section_numbers: [0; 3],
|
||||
section_numbers: [0; 4],
|
||||
has_chapters: false,
|
||||
equation_number: 0,
|
||||
figure_number: 0,
|
||||
table_number: 0,
|
||||
@@ -1254,7 +1259,10 @@ impl Parser {
|
||||
fn start_heading(&mut self, level: u8, numbered: bool) {
|
||||
self.flush_paragraph();
|
||||
self.finish_heading();
|
||||
let level = level.clamp(1, 3);
|
||||
let level = level.min(3);
|
||||
if level == 0 {
|
||||
self.has_chapters = true;
|
||||
}
|
||||
let runs = if numbered {
|
||||
let number = self.next_section_number(level);
|
||||
self.current_reference = number.clone();
|
||||
@@ -1938,10 +1946,19 @@ impl Parser {
|
||||
}
|
||||
|
||||
fn next_section_number(&mut self, level: u8) -> String {
|
||||
let index = usize::from(level.saturating_sub(1).min(2));
|
||||
let index = usize::from(level.min(3));
|
||||
self.section_numbers[index] += 1;
|
||||
self.section_numbers[index + 1..].fill(0);
|
||||
self.section_numbers[..=index]
|
||||
if level == 0 {
|
||||
self.has_chapters = true;
|
||||
return self.section_numbers[0].to_string();
|
||||
}
|
||||
let start = if self.has_chapters && self.section_numbers[0] > 0 {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
};
|
||||
self.section_numbers[start..=index]
|
||||
.iter()
|
||||
.map(u32::to_string)
|
||||
.collect::<Vec<_>>()
|
||||
|
||||
+4
-8
@@ -9,8 +9,9 @@ family and true scaled small caps; inline box geometry (`\fbox`, `\makebox`,
|
||||
footnotes/`\thanks`; figure/table `[htbp]` placement approximations; page
|
||||
styles (plain/fancy, `\thispagestyle`, fancyhdr headers/footers, `\thepage`);
|
||||
geometry-aware `\textwidth`/`\textheight` named length registers; table of
|
||||
contents and figure/table lists; native PDF rectangles; unified pagination;
|
||||
`\raggedright`/`\raggedleft` declarations and environments
|
||||
contents and figure/table lists with dotted leaders; native PDF rectangles; unified pagination;
|
||||
`\centering`/`\raggedright`/`\raggedleft` declarations and environments;
|
||||
chapter headings with chapter-prefixed section numbering
|
||||
(`build_positioned_pages` is the only page builder and no separate break
|
||||
planner remains).
|
||||
|
||||
@@ -26,12 +27,7 @@ planner remains).
|
||||
needs a vertical-material capture with its own natural width, baseline, and
|
||||
nested line/box children in the positioned renderer.
|
||||
|
||||
## 3. Contents leaders (remaining)
|
||||
|
||||
- TOC/list entries use infinite glue for right-aligned page numbers. Dotted
|
||||
leaders require a glue item that repeats a character across its stretch.
|
||||
|
||||
## 4. Custom title blocks (remaining)
|
||||
## 3. Custom title blocks (remaining)
|
||||
|
||||
- Let a document-level `\renewcommand{\maketitle}` contribute a real title
|
||||
block once the engine's title model can run box material.
|
||||
+10
-7
@@ -20,7 +20,7 @@ the source changes; the SVG preview is refreshed per page.
|
||||
declarations with group scoping, grouped text-style commands, true small caps
|
||||
(lowercase uppercase glyphs at 80% size), and sans/serif/mono small caps.
|
||||
- Paragraphs: Knuth-Plass breaking, TeX hyphenation patterns, justification,
|
||||
centering, `\raggedright`/`\raggedleft` declarations and environments,
|
||||
`\centering`/`\raggedright`/`\raggedleft` declarations and environments,
|
||||
first-line `\parindent` (17pt default, group-scoped, `\setlength`/
|
||||
`\addtolength`/`\noindent` aware), and `\hfill`/`\hfil` infinite glue.
|
||||
- Pages: A4/A5/B5/Letter/Legal/Executive, landscape, geometry margins and
|
||||
@@ -34,8 +34,11 @@ the source changes; the SVG preview is refreshed per page.
|
||||
- Notes: `\footnote{...}` page-bottom insertion area with separator rule,
|
||||
superscript markers, and title/author `\thanks`.
|
||||
- Contents: `\tableofcontents`, `\listoffigures`, and `\listoftables`
|
||||
generate headings plus entries from numbered sections and captioned
|
||||
figures/tables; page numbers are resolved after pagination.
|
||||
generate headings plus entries from numbered chapters/sections and captioned
|
||||
figures/tables, with dotted leaders and page numbers resolved after
|
||||
pagination.
|
||||
- Chapters: `\chapter` is a level-0 heading; chapter numbers prefix section
|
||||
numbers (`1.1`, `1.1.1`) and reset lower counters.
|
||||
- Class sizes: 10pt/11pt/12pt set the body size and propagate through
|
||||
headings, title material, lists, tables, block boxes, footnotes, and the
|
||||
default paragraph indent (10/12pt use 15pt; 11pt uses 17pt).
|
||||
@@ -62,9 +65,9 @@ See `docs/ROADMAP.md` for concrete implementation plans.
|
||||
- Notes: footnotes inside captions, floats, or arbitrary boxes are not
|
||||
collected; the insertion area currently follows the page where the paragraph
|
||||
ends rather than the exact reference line.
|
||||
- Contents: entries use infinite glue instead of dotted leaders and only
|
||||
numbered headings plus captions are listed; per-chapter contents in
|
||||
book/report are not distinguished.
|
||||
- Contents: chapter headings are listed with chapter-prefixed section
|
||||
numbers, but contents are not split per chapter and `\chapter` does not
|
||||
force a page break.
|
||||
- Miscellaneous: a document-level `\renewcommand{\maketitle}` is ignored in
|
||||
favor of the engine title block.
|
||||
|
||||
@@ -72,7 +75,7 @@ See `docs/ROADMAP.md` for concrete implementation plans.
|
||||
|
||||
- `examples/hello.tex`, `examples/boxes.tex`, `examples/compat.tex` compile to
|
||||
one A4 page each; the arXiv template project compiles to 3 Letter pages.
|
||||
- `cargo fmt --check` passes; `cargo test --offline` (35 tests: 31 compiler
|
||||
- `cargo fmt --check` passes; `cargo test --offline` (37 tests: 33 compiler
|
||||
integration tests + 4 server tests) covers the three examples, the arXiv
|
||||
fixture, floats/newpage, page styles and `\thispagestyle`, SVG/PDF output,
|
||||
project API, static frontend assets, path traversal, the legacy
|
||||
|
||||
@@ -31,7 +31,6 @@ const PRELUDE: &str = r#"
|
||||
\def\hfil{\hskip0pt plus 1fil\relax}
|
||||
\def\allowbreak{\penalty0}
|
||||
\def\nobreak{\penalty10000}
|
||||
\def\centering{}
|
||||
\def\bibliographystyle#1{}
|
||||
\def\textbf#1{\texrrastylestart{bold}#1\texrrastyleend{bold}}
|
||||
\def\emph#1{\texrrastylestart{italic}#1\texrrastyleend{italic}}
|
||||
|
||||
+26
-5
@@ -37,6 +37,8 @@ use self::layout::{
|
||||
// from the article class's 14.4pt setting to 14pt.
|
||||
fn article_heading_font_size(level: u8, base: u8) -> u8 {
|
||||
match (base, level) {
|
||||
(12, 0) => 24,
|
||||
(_, 0) => 20,
|
||||
(12, 1) => 17,
|
||||
(_, 1) => 14,
|
||||
(12, 2) => 14,
|
||||
@@ -1228,6 +1230,18 @@ fn boxworks_line_break(
|
||||
previous_font_id = None;
|
||||
}
|
||||
for character in run.text.chars() {
|
||||
if character == texrra_core::document::CONTENTS_LEADER_MARKER {
|
||||
horizontal.push(
|
||||
ds::Char {
|
||||
char: character,
|
||||
font: null_font_id,
|
||||
}
|
||||
.into(),
|
||||
);
|
||||
previous_character = None;
|
||||
previous_font_id = None;
|
||||
continue;
|
||||
}
|
||||
if inline_markers.contains_key(&character) {
|
||||
horizontal.push(
|
||||
ds::Char {
|
||||
@@ -1423,9 +1437,14 @@ fn boxworks_line_break(
|
||||
}
|
||||
}
|
||||
let mut line_items = Vec::new();
|
||||
let mut leader_pending = false;
|
||||
for item in &line_box.list {
|
||||
match item {
|
||||
ds::Horizontal::Char(character) => {
|
||||
if character.char == texrra_core::document::CONTENTS_LEADER_MARKER {
|
||||
leader_pending = true;
|
||||
continue;
|
||||
}
|
||||
if let Some(marker) = inline_markers.get(&character.char) {
|
||||
match marker {
|
||||
InlineMarker::RaiseStart(raise) => {
|
||||
@@ -1472,11 +1491,13 @@ fn boxworks_line_break(
|
||||
}
|
||||
}
|
||||
ds::Horizontal::Glue(glue) => {
|
||||
line_items.push(text_layout::LineItem::Glue(paragraph_glue_width(
|
||||
&glue.value,
|
||||
line_box.glue_order,
|
||||
ratio,
|
||||
)));
|
||||
let width = paragraph_glue_width(&glue.value, line_box.glue_order, ratio);
|
||||
if leader_pending {
|
||||
leader_pending = false;
|
||||
line_items.push(text_layout::LineItem::Leader(width));
|
||||
} else {
|
||||
line_items.push(text_layout::LineItem::Glue(width));
|
||||
}
|
||||
}
|
||||
ds::Horizontal::Kern(kern) => {
|
||||
line_items.push(text_layout::LineItem::Kern(kern.width));
|
||||
|
||||
@@ -1392,6 +1392,7 @@ pub(super) fn build_positioned_pages(
|
||||
|
||||
let paragraph_alignment = runs.iter().find_map(|run| run.alignment);
|
||||
let ragged = paragraph_alignment.is_some();
|
||||
let centered = paragraph_alignment == Some(ParagraphAlignment::Centered);
|
||||
let x = match (paragraph_alignment, &line.content) {
|
||||
(
|
||||
Some(ParagraphAlignment::RaggedLeft),
|
||||
@@ -1420,7 +1421,7 @@ pub(super) fn build_positioned_pages(
|
||||
content: line.content,
|
||||
y: cursor,
|
||||
x,
|
||||
centered: false,
|
||||
centered,
|
||||
ragged,
|
||||
}));
|
||||
cursor = cursor.saturating_add(line_height);
|
||||
|
||||
@@ -1738,6 +1738,18 @@ fn ragged_left_primitive(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn centering_primitive(
|
||||
token: token::Token,
|
||||
input: &mut vm::ExecutionInput<CompilerState>,
|
||||
) -> texlang::prelude::Result<()> {
|
||||
write_event(
|
||||
input,
|
||||
token,
|
||||
FrontendEventKind::ParagraphAlignment(texrra_core::document::ParagraphAlignment::Centered),
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn table_of_contents_primitive(
|
||||
token: token::Token,
|
||||
input: &mut vm::ExecutionInput<CompilerState>,
|
||||
@@ -5820,6 +5832,13 @@ fn heading_start_primitive(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn chapter_primitive(
|
||||
token: token::Token,
|
||||
input: &mut vm::ExecutionInput<CompilerState>,
|
||||
) -> texlang::prelude::Result<()> {
|
||||
heading_primitive(token, input, 0)
|
||||
}
|
||||
|
||||
fn section_primitive(
|
||||
token: token::Token,
|
||||
input: &mut vm::ExecutionInput<CompilerState>,
|
||||
@@ -6801,6 +6820,10 @@ fn built_in_commands() -> HashMap<&'static str, texlang::command::BuiltIn<Compil
|
||||
"raggedleft",
|
||||
texlang::command::BuiltIn::new_execution(ragged_left_primitive),
|
||||
);
|
||||
built_ins.insert(
|
||||
"centering",
|
||||
texlang::command::BuiltIn::new_execution(centering_primitive),
|
||||
);
|
||||
built_ins.insert(
|
||||
"pagestyle",
|
||||
texlang::command::BuiltIn::new_execution(page_style_primitive),
|
||||
@@ -7187,6 +7210,10 @@ fn built_in_commands() -> HashMap<&'static str, texlang::command::BuiltIn<Compil
|
||||
"texrraend",
|
||||
texlang::command::BuiltIn::new_execution(end_environment_primitive),
|
||||
);
|
||||
built_ins.insert(
|
||||
"chapter",
|
||||
texlang::command::BuiltIn::new_execution(chapter_primitive),
|
||||
);
|
||||
built_ins.insert(
|
||||
"section",
|
||||
texlang::command::BuiltIn::new_execution(section_primitive),
|
||||
|
||||
@@ -42,6 +42,7 @@ pub(super) enum LineItem {
|
||||
},
|
||||
Kern(Scaled),
|
||||
Glue(Scaled),
|
||||
Leader(Scaled),
|
||||
}
|
||||
|
||||
struct TextSpan {
|
||||
@@ -105,6 +106,7 @@ enum TextLineItem {
|
||||
},
|
||||
Kern(Mm),
|
||||
Glue(Mm),
|
||||
Leader(Mm),
|
||||
}
|
||||
|
||||
pub(super) struct PositionedRule {
|
||||
@@ -245,6 +247,18 @@ impl TextLine {
|
||||
);
|
||||
items.push(TextLineItem::Glue(scaled_to_mm(*width)));
|
||||
}
|
||||
LineItem::Leader(width) => {
|
||||
flush_text(
|
||||
&mut items,
|
||||
&mut text,
|
||||
&mut text_style,
|
||||
cjk_family,
|
||||
monospace_family,
|
||||
sans_family,
|
||||
font_size,
|
||||
);
|
||||
items.push(TextLineItem::Leader(scaled_to_mm(*width)));
|
||||
}
|
||||
LineItem::Kern(width) => {
|
||||
flush_text(
|
||||
&mut items,
|
||||
@@ -311,6 +325,7 @@ impl TextLine {
|
||||
}
|
||||
TextLineItem::Glue(_) if index < last_content => x += natural_space,
|
||||
TextLineItem::Glue(_) => {}
|
||||
TextLineItem::Leader(width) => x += *width,
|
||||
TextLineItem::Kern(width) => x += *width,
|
||||
TextLineItem::Rule { width, .. } => x += *width,
|
||||
TextLineItem::Frame { width, .. } => x += *width,
|
||||
@@ -393,6 +408,32 @@ impl TextLine {
|
||||
natural_space
|
||||
};
|
||||
}
|
||||
TextLineItem::Leader(width) => {
|
||||
let style = Style::new().with_font_size(self.font_size);
|
||||
let dot = style.str_width(fonts, ".");
|
||||
let space = style.str_width(fonts, " ");
|
||||
let unit = f64::from(dot + space);
|
||||
let width_mm = f64::from(*width);
|
||||
let count = ((width_mm / unit).floor() as usize).max(1);
|
||||
let mut leader = String::new();
|
||||
for index in 0..count {
|
||||
if index > 0 {
|
||||
leader.push(' ');
|
||||
}
|
||||
leader.push('.');
|
||||
}
|
||||
let text_width = style.str_width(fonts, &leader);
|
||||
spans.push(PositionedSpan {
|
||||
text: leader,
|
||||
style,
|
||||
x,
|
||||
y_offset: Mm::from(0.0),
|
||||
});
|
||||
x += text_width;
|
||||
if text_width < *width {
|
||||
x += *width - text_width;
|
||||
}
|
||||
}
|
||||
TextLineItem::Kern(width) => x += *width,
|
||||
}
|
||||
}
|
||||
|
||||
+54
-1
@@ -804,12 +804,12 @@ Beta paragraph.
|
||||
assert_eq!(value["status"], "ok", "{value}");
|
||||
assert_eq!(pages(&value).len(), 2, "{value}");
|
||||
let svg = page_svg(&value, 0);
|
||||
eprintln!("{svg}");
|
||||
assert!(svg.contains(">Contents</text>"), "missing contents heading");
|
||||
assert!(svg.contains(">Alpha</text>"), "missing first entry");
|
||||
assert!(svg.contains(">Beta</text>"), "missing second entry");
|
||||
assert!(svg.contains(">1</text>"), "missing first page number");
|
||||
assert!(svg.contains(">2</text>"), "missing second page number");
|
||||
assert!(svg.contains(". . ."), "missing dotted leader: {svg}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -924,3 +924,56 @@ fn ragged_alignment_declarations_are_honoured() {
|
||||
"raggedright still justified the line: ragged={ragged_beta}, justified={justified_beta}\nRAGGED={ragged_svg}\nJUSTIFIED={justified_svg}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn centering_declaration_centers_a_paragraph() {
|
||||
let prefix = r"\documentclass{article}
|
||||
\usepackage[margin=6.5cm]{geometry}
|
||||
\begin{document}
|
||||
";
|
||||
let centered_source =
|
||||
format!("{prefix}{{\\centering alpha beta}}\n\nplain paragraph\n\\end{{document}}");
|
||||
let left_source = format!("{prefix}alpha beta\n\nplain paragraph\n\\end{{document}}");
|
||||
let centered = fresh_preview(¢ered_source, "centered.tex");
|
||||
let left = fresh_preview(&left_source, "left.tex");
|
||||
let centered_svg = page_svg(¢ered, 0);
|
||||
let left_svg = page_svg(&left, 0);
|
||||
let centered_alpha = text_x(¢ered_svg, "alpha");
|
||||
let left_alpha = text_x(&left_svg, "alpha");
|
||||
assert!(
|
||||
centered_alpha > left_alpha + 10.0,
|
||||
"centering did not move the line: centered={centered_alpha}, left={left_alpha}\n{centered_svg}"
|
||||
);
|
||||
let plain_alpha = text_x(¢ered_svg, "plain");
|
||||
let left_plain = text_x(&left_svg, "plain");
|
||||
assert!(
|
||||
(plain_alpha - left_plain).abs() < 0.5,
|
||||
"centering leaked into the following paragraph: centered={plain_alpha}, left={left_plain}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn chapter_headings_number_sections_and_enter_contents() {
|
||||
let source = r#"\documentclass{book}
|
||||
\begin{document}
|
||||
\tableofcontents
|
||||
\chapter{First Chapter}
|
||||
\section{Alpha}
|
||||
\subsection{Beta}
|
||||
\chapter{Second Chapter}
|
||||
\section{Gamma}
|
||||
\end{document}
|
||||
"#;
|
||||
let value = fresh_preview(source, "chapters.tex");
|
||||
assert_eq!(value["status"], "ok", "{}", value["message"]);
|
||||
let svg = page_svg(&value, 0);
|
||||
for needle in [
|
||||
"Contents", "First", "Chapter", "Alpha", "Beta", "Gamma", "1.1", "1.1.1", "2.1",
|
||||
] {
|
||||
assert!(svg.contains(needle), "chapter numbering is missing : {svg}");
|
||||
}
|
||||
assert!(
|
||||
!svg.contains("0.1"),
|
||||
"section was numbered under chapter zero: {svg}"
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user