-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
41 lines (29 loc) · 906 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Synth
-----
Generate HTML from minimal expressions.
These expressions look like CSS selectors, are multi-line,
and tab-indented. Any arrangment of \r\n is considered a newline,
while only \t is considered to be an indent.
Example:
html
head
meta[charset=utf-8]
title "Home Page"
body
div.container#main
p "Hello World"
Notice the parts that are not like CSS selectors: the strict
indentation, and the "quoted" text (which creates text nodes in the
output).
How To Use:
In NodeJS:
synth = require("synth-js/synth").synth
fragment = synth('a[href=/home] "Click here to win"')
In a browser:
<script src=".../synth.js"></script>
<script>
var fragment = synth("a[href=/home] 'Home Page'");
document.body.appendChild(fragment);
</script>
TODO / Future Work:
* It should follow the same indentation rules as python, so that it can support spaces or tabs as long as you are consistent.