https://github.com/patriziobruno/mochatemplate
MochaTemplate is a template library inspired by Adobe Sightly. It leverages the power of server-side Javascript to clearly separate presentation and logic concerns.
https://github.com/patriziobruno/mochatemplate
adobe javascript servlet sightly template-engine
Last synced: 5 months ago
JSON representation
MochaTemplate is a template library inspired by Adobe Sightly. It leverages the power of server-side Javascript to clearly separate presentation and logic concerns.
- Host: GitHub
- URL: https://github.com/patriziobruno/mochatemplate
- Owner: patriziobruno
- License: apache-2.0
- Created: 2016-12-20T12:15:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-22T19:24:52.000Z (almost 9 years ago)
- Last Synced: 2026-01-11T13:56:06.835Z (5 months ago)
- Topics: adobe, javascript, servlet, sightly, template-engine
- Language: Java
- Homepage:
- Size: 102 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mochatemplate
[](https://raw.githubusercontent.com/patriziobruno/mochatemplate/master/LICENSE)
[](https://travis-ci.org/patriziobruno/mochatemplate)
[](https://coveralls.io/github/patriziobruno/mochatemplate?branch=master)
[](https://scan.coverity.com/projects/patriziobruno/mochatemplate)
A template library inspired by Adobe Sightly (https://docs.adobe.com/ddc/en/gems/introduction-to-sightly.html).
It makes use of:
- jsoup (https://jsoup.org/) for HTML parsing
- Reflections (https://github.com/ronmamo/reflections) for runtime loading of template-nodes interpreters
- JDK native script engine (Nashorn for JDK8, Rhino for JDK7)
To use the library in your application you can either instantiate MochaTemplateEngine from your servlet or add net.desertconsulting.mochatemplate.servlet.MainServlet to your web.xml.
### Test
To run unit tests:
```bash
$ mvn test
```
To run a jetty instance serving the included example:
```bash
$ mvn jetty:run
```
### Example template
```html
var Person = importClass(Packages.examples.Person);
var query = request.getParameter('search');
${person.FullName}
```