Capture multi-line macro definitions and mode conditionals
The preamble parser is line-oriented, so a multi-line \newcommand, \def or
\newenvironment contributed only its first line to the macro table while the
remaining body lines fell through to the document text. In the assembled arXiv
source that also swallowed the \begin{document} marker, so the whole class
preamble was laid out as one page of \NeedsTeXFormat/\fancyhf text.
Join definition bodies at balanced braces before stripping: comments are
removed, a `%` line continuation joins without adding a space, and a blank line
becomes \par. Definitions now reach the existing single-line capture whole.
Resolve \ifhmode as true and \ifvmode/\ifmmode as false for the text expansion
path, so class macros such as \and expand.
The arXiv fixture body no longer contains NeedsTeXFormat, fancyhf or ifhmode and
the project preview lays out four pages instead of one; unit tests cover a
multi-line \newcommand/\def and the arXiv preamble containment. Remaining
warnings are now body commands (\maketitle, \thanks, \lipsum, \addvspace and the
footnote machinery), which are separate work.
This commit is contained in:
1 parent
ebf2070295
commit
1b7baa0257
3 files changed
+150
-2
No files matched your search
@@ -48,7 +48,7 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`,
|
||||
`\bottomnumber`, `\totalnumber`), insertion classes (`\skip`, fraction and
|
||||
absolute limits, splitting), marks, Rust output hook, multi-page PDF, and the
|
||||
route-D service endpoints (`/api/route-d/preview|pdf|edit`, project preview and
|
||||
PDF opt-in with `?engine=route-d`). 969 workspace tests are green and no oracle
|
||||
PDF opt-in with `?engine=route-d`). 971 workspace tests are green and no oracle
|
||||
fixture is ignored. Preview JSON also carries a `warnings` array naming
|
||||
environments route-D cannot lay out and control words that survived layout, so
|
||||
unsupported source is reported instead of being silently typeset.
|
||||
|
||||
+7
-1
@@ -370,7 +370,7 @@ Math coverage includes fractions/roots, scripts, `\left...\right` with body-scal
|
||||
|
||||
Paragraph units carry a `ParagraphFont`; `Unit::paragraph_with_face` and `Unit::paragraph_with_style_and_face` select Roman, bold, italic, mono, or sans. The corresponding Computer Modern TFM (`cmr10`, `cmbx10`, `cmti10`, `cmbxti10`, `cmtt10`, `cmss10`, `cmssbx10`, `cmssi10`, `cmcsc10`) supplies advances, kerns, ligatures, and italic correction for layout, the display list selects the matching face, and the PDF writes Computer Modern Type1 outlines for each built-in face (`cmr10`/`cmbx10`/`cmti10`/`cmbxti10`/`cmtt10`/`cmss10`/`cmssbx10`/`cmssi10`/`cmcsc10`, plus `cmmi10` for mathematical italic letters, `cmsy10` for math symbols and `cmex10` for big operators), falling back to Liberation subsets only for characters the Type1 encodings cannot address; those fallback glyphs keep their Unicode text under PDF extraction, so accented and Greek words round-trip; Type1 faces carry a ToUnicode CMap built from the requested characters, so glyphs whose names are ambiguous in the Adobe Glyph List (capital Omega, which would otherwise extract as U+2126) keep their intended code points. `Engine::edit` preserves the face when reflowing an edited paragraph.
|
||||
|
||||
The crate currently has 434 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 969 tests (434 route-D unit, 347 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 60 server, 4 engine unit, 1 core unit), with none ignored. v1 remains the live server path.
|
||||
The crate currently has 434 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 971 tests (434 route-D unit, 349 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 60 server, 4 engine unit, 1 core unit), with none ignored. v1 remains the live server path.
|
||||
|
||||
### M0 incremental demo
|
||||
|
||||
@@ -482,6 +482,12 @@ deliberately open rather than approximated:
|
||||
`OutputRoutine::wants_break` remains a Rust hook for forcing a page break
|
||||
between units, insertion material is stacked by class from the page bottom,
|
||||
and the page box (`\box255`) exposes width/height/depth but not its content.
|
||||
Class files contribute multi-line `\newcommand`/`\def`/`\newenvironment`
|
||||
bodies: the source is joined at balanced braces and the whole definition is
|
||||
captured, while `\ifhmode`/`\ifvmode`/`\ifmmode` resolve as the
|
||||
horizontal/vertical/math approximations. The arXiv class preamble no longer
|
||||
leaks into the body: the template now previews as four pages instead of one
|
||||
page of `\NeedsTeXFormat`/`\fancyhf` text.
|
||||
- Page hashes cover rendered items/insertions/marks/floats, not source-dependency
|
||||
metadata, so replaying an earlier page cannot change its hash merely by
|
||||
re-attaching source hashes.
|
||||
|
||||
Reference in new issue
Block a user