Theme Conversion Utilities
Ghost to RaveCMS Handlebars Converter
This tool automates the conversion of standard Ghost Handlebars templates to the format required by our Rust implementation.
Features
- Layout Conversion: Converts
{{!< default}}to{{#*inline "body"}}...{{/inline}}. - Partial Paths: Automatically prepends
partials/to partial references. - Global Variables: Strips the
@prefix from global data (@site->site), while protecting loop variables like@first. - Context Blocks: Converts
{{#post}}to{{#with post}}. - Parent Context: Automatically adds
../to global variable references inside context blocks. - Content Escaping: Ensures
{{{content}}}is used for HTML output. - Author Expansion: Expands
{{authors}}to a logic-safeforeachloop. - Manual Markers: Identifies unsupported features like
{{#get}}and flags them for manual review.
Usage
Conversion
python3 convert_theme.py /path/to/ghost-theme /path/to/output-dir
Dry Run
To see what would happen without writing files:
python3 convert_theme.py /path/to/ghost-theme /path/to/output-dir --dry-run
Comparison
To compare the original theme with the converted output:
python3 compare_themes.py /path/to/ghost-theme /path/to/output-dir
To see detailed diffs for each file:
python3 compare_themes.py /path/to/ghost-theme /path/to/output-dir --diff
Manual Review Items
The tool will print warnings for items it cannot automatically convert:
- Complex nested context might need manual
../verification. - Custom helpers not implemented in the Rust engine.