Funny pug remake in zig
| src | remove unused util.zig, add contributing section to readme | |
| .gitignore | initial commit | |
| build.zig | initial commit | |
| build.zig.zon | finishing touches | |
| LICENSE | finishing touches | |
| README.md | remove unused util.zig, add contributing section to readme | |
pugza - a funny pug remake in Zig
Another templating language, yay.. Inspired by Jetpack Compose and obviously Pug.
Syntax
# There are no comments in the language itself but I'm gonna add them anyway for readability.
# Pugza uses curly braces for indentation because I didn't feel like writing a parser for indents in Zig because of prior experience writing it in other languages, and also because I wanted a refresher from all the tabs in other templating languages.
html {
head {
# First off, "Hello, world!" is content, which is everything after a tag.
title Hello, world!
# "charset" is an attribute here.
meta(charset = "utf-8")
}
body {
# Here, we are combining attributes with content, nothing out of the usual.
div(style = "color: red") Hi, I'm red!
# Now pug-style class and id
div.foo#bar I'm foo and bar
# Small detour, multiline tags!
div#bigcontent: {
Write normal text here, it gets copied into the output HTML as-is.
\p Now we can escape a tag into here with a backslash.
\div: {
We can nest even more!
\p AND MORE!
}
}
}
}
Running
Just zig build run.
After making changes, zig build test to run the (currently tiny) test suite.
Contributing
I don't know why you'd be contributing to this monstrosity, but if you want to, just make a pull request.
Only rule for PRs is that your commit messages aren't garbage (I know some of mine certainly are...). They aren't required to follow some convention or style, just make them make sense.
Oh, and also run the test suite before pushing.