A simple website for generating HTML out of S-Expressions (Lisp style) Try it out!
This page uses a Scheme implementation in JavaScript (Biwa Scheme) and a simple list manipulation script, to convert S-Expressions to plain HTML.
S-Expressions as markup can be:
- simpler to read
- easier/faster to write (especially in an early phase of rapid development and prototyping)
- less redundant (only one tag name)
It's pretty simple:
- Write your markup in S-Expressions
- Paste it into the first s-expression code-box
- Press the EVALUATE button
- Copy the output HTML and use it as markup
Every HTML tag is written in parenthesis like this: (div "Content...")
-
The tag-name is written on the beginning after the opening paren, the contents follow after it seperated by spaces until the closing paren.
-
Text is written in double quotes (to differentiate them from tag-names):
"..."
-
Tags can be in the contents of other tags (nested):
(div (h2 "Title...) (p "1st paragraph...") (p "2nd paragraph..."))
-
Attributes are written directly after the tag-name in parens with a
#
in front of it:
(div #(id= "first" class= "space center") "Text...")
To better distinguish them from tags, you can also use brackets
#[]
for attributes:
(div #[id= "first" class= "space center"] "Text...")
Also see the demo example as a reference on how to write HTML with it. Try it out and have fun!