1
0
Fork
You've already forked pugza
0
Funny pug remake in zig
  • Zig 97.6%
  • HTML 2.4%
2024年02月14日 21:01:44 +03:00
src remove unused util.zig, add contributing section to readme 2024年02月14日 21:01:44 +03:00
.gitignore initial commit 2024年02月13日 21:31:00 +03:00
build.zig initial commit 2024年02月13日 21:31:00 +03:00
build.zig.zon finishing touches 2024年02月14日 20:52:55 +03:00
LICENSE finishing touches 2024年02月14日 20:52:55 +03:00
README.md remove unused util.zig, add contributing section to readme 2024年02月14日 21:01:44 +03:00

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.