5

examples · v0.1.0 · Simon / djinn · GitLab

 4 years ago
source link: https://gitlab.com/sarneaud/djinn/-/tree/v0.1.0/examples
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
examples · v0.1.0 · SimonChange Djinn syntax
Simon authored 1 day ago
I copied Jinja2 syntax for my PoC, but Jinja2 and D both use curly
braces a lot, making templates hard to read when they're mixed together.

The new syntax comes from balancing the following criteria:

* Easy to read when mixed with D code
* Easy to remember
* Easy to type for common cases
* Rare syntax collisions with common use cases (i.e, templating D,
  YAML/JSON, XML-like languages, etc)

Some collisions are bound to happen.  [< can be confused with common CDATA
usage.  [: can be confused with IPv6 addresses and a common regex character
class syntax not used in D.  `raw` and `endraw` will need to be used in
these cases.  I hope there aren't any seriously annoying cases.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK