Syntax: Compatibility with Pug
Expug retains most of Pug/Jade’s features, adds some Elixir’isms, and drops the features that don’t make sense.
- Multiline attributes are supported. As long as you use balanced braces, Expug is smart enough to know when to count the next line as part of an expression.
button.btn( role='btn' class=( get_classname(@button) ) )= get_text "Submit"
- Multiline codeb blocks are also supported. See code for rules on how this works.
= render( App.MyView, "index.html", conn: @conn)
Comments are done using
-#as well as
-//, following Elixir conventions. The old
-//syntax is supported for increased compatibility with text editor syntax highlighting.
Text attributes need to have double-quoted strings (
"). Single-line strings will translate to Elixir char lists, which is likely not what you want.
Statements with blocks like
= if .. do…
- endshould start with
=, and end in
-. This is the same as you would do in EEx.
The following features are not available due to the limitations of EEx.
The following syntactic sugars, are not implemented, simply because they’re not idiomatic Elixir. There are other ways to accomplish them.
The following are still unimplemented, but may be in the future.
The following are unimplemented, just because I don’t want to implement them.
- Doctype shorthands are limited to only
xml. The XHTML shorthands were not implemented to discourage their use.
- Indent sensitivity rules of Pug/Jade have been preserved. This means you can do:
html head title This is indented with 4 spaces