86 lines
2.7 KiB
Markdown
86 lines
2.7 KiB
Markdown
|
|
# Site-Info Documentation Templates
|
||
|
|
|
||
|
|
This directory contains the Tera templates used by the site-info system to generate documentation from code analysis.
|
||
|
|
|
||
|
|
## Structure
|
||
|
|
|
||
|
|
```
|
||
|
|
site-info/
|
||
|
|
├── documentation/ # Main page templates
|
||
|
|
│ ├── base.tera # Base layout template
|
||
|
|
│ ├── summary.tera # Summary pages with metrics
|
||
|
|
│ ├── reference.tera # Detailed reference docs
|
||
|
|
│ ├── automation.tera # Automation guide
|
||
|
|
│ └── top_level.tera # Top-level overview
|
||
|
|
├── partials/ # Reusable components
|
||
|
|
│ ├── route_table.tera # Route information table
|
||
|
|
│ ├── component_card.tera # Component display card
|
||
|
|
│ ├── source_link.tera # Source reference links
|
||
|
|
│ ├── metrics_summary.tera # Statistics summary
|
||
|
|
│ └── nav_breadcrumbs.tera # Navigation breadcrumbs
|
||
|
|
├── i18n/ # Language-specific templates
|
||
|
|
│ ├── en/ # English templates
|
||
|
|
│ └── es/ # Spanish templates
|
||
|
|
└── README.md # This file
|
||
|
|
```
|
||
|
|
|
||
|
|
## Configuration
|
||
|
|
|
||
|
|
Templates are configured in `config/site-info.toml`:
|
||
|
|
|
||
|
|
```toml
|
||
|
|
[templates]
|
||
|
|
engine = "tera"
|
||
|
|
templates_path = "site/templates/site-info"
|
||
|
|
default_language = "en"
|
||
|
|
supported_languages = ["en", "es"]
|
||
|
|
```
|
||
|
|
|
||
|
|
## Internationalization
|
||
|
|
|
||
|
|
Labels and text are loaded from FTL files in:
|
||
|
|
- `site/content/i18n/site-info/en/templates.ftl` (English)
|
||
|
|
- `site/content/i18n/site-info/es/templates.ftl` (Spanish)
|
||
|
|
|
||
|
|
## Template Context
|
||
|
|
|
||
|
|
Templates receive a `DocumentationContext` with:
|
||
|
|
|
||
|
|
- `doc.routes` - API route information
|
||
|
|
- `doc.components` - Component definitions
|
||
|
|
- `doc.pages` - Page route configurations
|
||
|
|
- `i18n.labels` - Localized text labels
|
||
|
|
- `summary` - Statistical information
|
||
|
|
- `metadata` - Generation metadata
|
||
|
|
- `theme` - Display configuration
|
||
|
|
|
||
|
|
## Custom Filters
|
||
|
|
|
||
|
|
Available Tera filters:
|
||
|
|
|
||
|
|
- `anchor` - Generate kebab-case anchors
|
||
|
|
- `source_link` - Format source reference links
|
||
|
|
- `pluralize` - Handle singular/plural forms
|
||
|
|
- `method_color` - HTTP method color coding
|
||
|
|
|
||
|
|
## Custom Functions
|
||
|
|
|
||
|
|
Available Tera functions:
|
||
|
|
|
||
|
|
- `toc(items)` - Generate table of contents
|
||
|
|
- `format_number(number)` - Format numbers with commas
|
||
|
|
|
||
|
|
## Environment Variables
|
||
|
|
|
||
|
|
- `SITE_TEMPLATES_PATH` - Base templates directory (default: "site/templates")
|
||
|
|
- `SITE_I18N_PATH` - I18n content directory (default: "site/content")
|
||
|
|
- `SITE_CONFIG_PATH` - Configuration directory (default: "config")
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
Templates are automatically loaded by the site-info build system. To customize:
|
||
|
|
|
||
|
|
1. Edit templates in this directory
|
||
|
|
2. Update FTL files for text changes
|
||
|
|
3. Modify `config/site-info.toml` for settings
|
||
|
|
4. Rebuild the project to regenerate documentation
|