Skip to content

jldailey/synth-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Generate HTML from minimal expressions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published