Auto-magically generate html tables from case classes
Insta-auto-magically generate a scalatags table from a Seq[A]
(case classes).
with scala-cli
//> using lib "io.github.quafadas::scautable:0.0.5"
@main def testThis =
import scautable.{*,given}
case class Easy(s: String, d: Double)
println(scautable(Seq(Easy("thing", 1.2)))).toString()
Pimp your html table with https://datatables.net
It cross compiles, and gives you back a scalatags table
Unclear. But I wanted to play with Mirrors.
And have a "real" library to test build cross building stuff, GHA etc on.
I aggressively copy pasted everything from here and poked it with a sharp stick until it did what I wanted. https://blog.philipp-martini.de/blog/magic-mirror-scala3/
See tests;
- Formatting is implied by the type. To format your own types, you'll need to write a given for it.
- Extension is through the type system, have a look at the JVM tests for an example if writing a given for your own custom type
- As I don't really understand how it works, it's unlikely to get extended further...
- Extending it further is probably a really bad idea anyway