How tinted-theming/ribboncurls works
Main Components
• ribboncurls (Library crate)
• Modules:
– token.rs (lexical tokens)
– syntax_tree.rs & syntax_tree/* (AST and tree utilities)
– utils.rs (helper routines)
– lib.rs (public API surface, orchestrates parsing+rendering)
• Build script (build.rs)
• Tests (ribboncurls/tests/* using spec files)
• ribboncurls-cli (Binary crate)
• cli.rs (argument parsing via Clap or similar)
• operations/render.rs (invokes library renderer)
• main.rs (entry point ties CLI → operations → library)
• Tests/fixtures (sample templates + data)
• External Dependencies (from Cargo.toml)
• Mustache spec conformance data
• CLI-helper crates (e.g., Clap)
• Serde or YAML parser for test fixtures
• CI/CD & Packaging
• GitHub workflows (.github/workflows/*.yml) for lint, test, release
• scripts/package_build for custom packaging
• Documentation & Metadata
• README.md files for each crate
• LICENSE, THIRD_PARTY_LICENSES
• CONTRIBUTING.md, CODEOWNERS, .gitignore
Relationships & Data Flow
• User invokes Ribboncurls CLI →
CLI parses flags/files →
calls operations/render →
which calls ribboncurls::render(template, data) →
library tokenizes & parses into AST →
library traverses AST to produce final output →
returns string to CLI →
CLI writes to stdout or file.
• Tests exercise both crates independently against Mustache spec fixtures.
• CI workflows trigger on commits/PRs to:
• Run tests for both crates
• Lint code
• Publish crates to crates.io
Architectural Patterns & Design Principles
• Modular Crate Architecture: separation of core logic (library) from user‐facing binary (CLI).
• Layered Pipeline:
1. Lexing → 2. Parsing → 3. AST Transformation → 4. Rendering.
• Single Responsibility: each module handles one stage of Mustache processing.
• Test‐Driven Design: Mustache spec compliance via spec fixtures.
9. Test fixtures connected to both library and CLI test suites.