margo icon indicating copy to clipboard operation
margo copied to clipboard

Handlebars templating support

Open woubuc opened this issue 5 months ago • 0 comments

This PR replaces the hard-coded embedded HTML with a Handlebars template system.

See the module docs in src/template.rs for more information on how templates are organised.

I also refactored a lot of the code into modules from the original single-file codebase, to find my way around the code while working on it.

This is a first effort to implement a solution I needed, as well as an answer to #30. My primary question is: do you want to merge this into the upstream codebase, or will this remain just a fork for my own use case?

  • [x] The basic handlebars template implementation is done. It can render the classic template to achieve a similar output as before.
  • [x] I've updated the config format to reflect these changes, and implemented an automatic conversion from the v1 config. I have also updated the CLI args accordingly.
  • [x] The handlebars templates now provide additional crate metadata, along with a rendered readme if one exists in the packaged crate.
  • [x] I added an additional template for out-of-the-box variety and to showcase what can be done with some of the new metadata.
  • [ ] Someone else might want to sanity check the implementation; there are no doubt still things that can be improved.
  • [ ] Do we want to expose additional metadata from the crates to the templates?
  • [ ] Several conformance test currently fail for reasons I'm not quite clear on.
  • [ ] The old gui files as well as the integration tests are still in the repository. There are currently no integration tests for the new templates and we'd have to consider how we would approach this.

woubuc avatar Aug 14 '25 19:08 woubuc