-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Currently, all of the SVG generation (which is basically what the PerceptronApparatus.Renderable
protocol is all about) is just done with building up & concatenating normal Elixir strings. This happens throughout the whole codebase.
It would be much nicer if instead these SVG fragments were built up using HEEx templates, and only rendered out to a string (or an iolist) at the very last moment. This would give error checking around malformed HTML/SVG, as well as nicer composability.
While HEEx templates are usually associated with the Phoenix web framework, it is possible to just import the ~H
sigil like so:
import Phoenix.Component, only: [sigil_H: 2]
and then the various module functions in this repo could instead be function components.
The final SVG output files would be the same as before, but working with this library will be much nicer when this change is implemented.