Rust implementation of the DustJS template engine.
Go to file
Tom Alexander b8e8f19724
Implemented a new span to trim leading whitespace.
Through my experiements I have concluded that DustJS trims whitespace at the front of a line. To handle this, I implement a new parser that matches a newline followed by any amount of whitespace. This should allow me to trim whitespace at the head of the line because spans start immediately after a tag is closed. So, for example:

```
{foo}
  bar
{/foo}
```

Would be:

```
{foo}\n  bar{/foo}
     ^     ^
     \____/
      span
```

So while there is no magical "start of line" detector like in regular expressions, the first start of a line in a span will always be preceded with a newline character except for the opening of the document. For handling the opening of the document I am already trimming the whitespace in the `template()` parser.
2020-05-03 12:28:55 -04:00
js Add a test for whitespace inside the template. 2020-05-02 19:30:23 -04:00
src Implemented a new span to trim leading whitespace. 2020-05-03 12:28:55 -04:00
.gitignore Update gitignore for compliance tests 2020-04-12 21:19:28 -04:00
Cargo.toml
Dockerfile Support passing args to the dockerized test runner 2020-04-12 15:47:38 -04:00
LICENSE
README.md

README.md

duster

An implementation of the LinkedIn fork of DustJS written in rust.

NOT RECOMMENDED FOR PUBLIC USE

This code is available free and open source under the 0BSD, but it is a very early-stage project. You're welcome to use it, fork it, print it out and fold it into a hat, etc... but you will find that this project is not yet polished nor feature complete. While this repository uses the 0BSD license which does not require the inclusion of a copyright notice/text in any distribution, it depends on nom which is under the MIT license, the Rust standard library which is dual licensed, serde_json which is dual licensed, and serde which is dual licensed.