(OP here.) Indeed, Slab is a templating language, just like Pug or Haml are. Slab was initially a reimplementation of Pug, but it evolved a bit.
In particular, I tried to respect a principle often found in programming languages: user-defined elements (fragments) are no different than builtin ones. For example notice how `page` (which is user-defined) is used in the same way as as `body` (which is builtin) in the first code snippet of the introduction[1].
(In the future, I hope that instead of providing builtins, Slab will instead use libraries of elements. There is an undocumented feature to define elements[2].)
In Pug, to reuse bits of HTML, you can define mixins, but they are called with a `+` sign in front of their name. I also believe mixins can have expression arguments, but not other blocks of HTML. To pass blocks of HTML as "arguments", Pug provides the `extends` keyword, but I think it can only be used at the toplevel of a template. In Slab, the concept of fragments is a bit more uniform: a fragment can be used with expression arguments, and block arguments.
In particular, I tried to respect a principle often found in programming languages: user-defined elements (fragments) are no different than builtin ones. For example notice how `page` (which is user-defined) is used in the same way as as `body` (which is builtin) in the first code snippet of the introduction[1].
(In the future, I hope that instead of providing builtins, Slab will instead use libraries of elements. There is an undocumented feature to define elements[2].)
In Pug, to reuse bits of HTML, you can define mixins, but they are called with a `+` sign in front of their name. I also believe mixins can have expression arguments, but not other blocks of HTML. To pass blocks of HTML as "arguments", Pug provides the `extends` keyword, but I think it can only be used at the toplevel of a template. In Slab, the concept of fragments is a bit more uniform: a fragment can be used with expression arguments, and block arguments.
[1]: https://slab-lang.org/reference.html#introduction
[2]: https://github.com/hypered/slab/blob/main/examples/el.slab