1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! MiniEval: A lightweight Typst macro evaluator.
//!
//! This module implements a partial evaluator for Typst that can expand macros
//! (`#let`, `#for`, `#if`, function calls) without the overhead of the full
//! Typst compiler. It is designed for source-to-source transformation.
//!
//! # Architecture
//!
//! ```text
//! Source Code (with macros)
//! │
//! ▼
//! ┌───────────────┐
//! │ typst-syntax │ (AST parsing)
//! │ Parser │
//! └───────────────┘
//! │
//! ▼
//! ┌───────────────┐
//! │ MiniEval │ (This module)
//! │ Evaluator │
//! └───────────────┘
//! │
//! ▼
//! Expanded Source Code
//! │
//! ▼
//! ┌───────────────┐
//! │ Tylax │ (Existing converter)
//! │ Converter │
//! └───────────────┘
//! │
//! ▼
//! LaTeX
//! ```
//!
//! # Example
//!
//! ```ignore
//! use tylax::expand_macros;
//!
//! let input = r#"
//! #let n = 3
//! #for i in range(n) {
//! Item #(i + 1)
//! }
//! "#;
//!
//! let expanded = expand_macros(input)?;
//! // Result: "Item 1\nItem 2\nItem 3\n"
//! ```
pub use ;
pub use ;
pub use ;
pub use render_math_segments_to_typst_source;
pub use ;
pub use RealVfs;
pub use ;