Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/breuleux/quaint-earlgrey
Embed Earl Grey in Quaint markup
https://github.com/breuleux/quaint-earlgrey
earl-grey quaint
Last synced: 9 days ago
JSON representation
Embed Earl Grey in Quaint markup
- Host: GitHub
- URL: https://github.com/breuleux/quaint-earlgrey
- Owner: breuleux
- Created: 2015-08-22T03:36:50.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-02T05:33:50.000Z (almost 8 years ago)
- Last Synced: 2024-10-18T18:55:18.726Z (28 days ago)
- Topics: earl-grey, quaint
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
quaint-earlgrey
===============Allows inline
[Earl Grey](http://earl-grey.io)
code in
[Quaint](http://breuleux.github.io/quaint)
markup.Allows inline Earl Grey code in Quaint markup.
Expressions in curly brackets will be evaluated using Earl Grey's
interpreter.## Install
quaint --setup earlgrey
## Usage
```
2 + 2 is {2 + 2}
```### API
#### JavaScript
```javascript
var quaint = require("quaint");
var qeg = require("quaint-earlgrey");var q = quaint(qeg);
q.toHTML("2 + 3 = {2 + 3}");
// ==> "2 + 3 = 5"
```#### Earl Grey
```earlgrey
require: quaint, quaint-earlgrey as qegq = quaint(qeg)
q.toHTML("2 + 3 = {2 + 3}")
// ==> "2 + 3 = 5"
```## Functionality
In embedded Earl Grey, you can use the `%` operator to create HTML
elements programmatically.```javascript
q.toHTML("{a[.cls][#id] % [href = 'there', 'A', 'B']}");
// ==> 'AB'q.toHTML("{1..3 each i -> b % i * i}");
// ==> "149"
```Some additional documentation [here](http://earl-grey.io/doc.html#documentbuildingsyntax)
## Options
### `sandbox`
An object to use as the global object for `eval`. All the properties
you set on that object will be available as top level variables in
scripts.