Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marianoguerra/emel
generate HTML (or XML) using CSS-like selectors in erlang
https://github.com/marianoguerra/emel
Last synced: about 2 months ago
JSON representation
generate HTML (or XML) using CSS-like selectors in erlang
- Host: GitHub
- URL: https://github.com/marianoguerra/emel
- Owner: marianoguerra
- Created: 2012-03-12T07:35:50.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-03-16T16:47:27.000Z (over 12 years ago)
- Last Synced: 2024-07-19T22:44:13.644Z (2 months ago)
- Language: Erlang
- Homepage: http://marianoguerra.com.ar
- Size: 213 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rest
Awesome Lists containing this project
README
emel - generate HTML with CSS-like selectors
============================================emel is an erlang module that allows to generate complex HTML (or XML) using
a syntax that is similar to CSS selectors.emel is inspired by zen-coding: https://code.google.com/p/zen-coding/
get it
------::
git clone https://github.com/marianoguerra/emel
build it
--------::
cd emel
./rebar compiletest it
-------::
./rebar eunit
use it
------::
1> emel:gen("span[type=\"text\"]#asd.foo.bar.baz").
{ok,""}2> {ok, S} = emel:gen("span[type=\"text\"]#asd.foo.bar.baz").
{ok,""}3> io:format("~s~n", [S]).
oktry it interactively
--------------------run the following command::
erl -run emel shell -run init stop -noshell -pa ebin
play with an interactive console::
emel console Ctrl + d to exit
>>> p
{ok,[{node,1,p,[],[],[]}],[]}
>>> p{hi}
{ok,[{node,1,p,[],[],"hi"}],[]}
hi
>>> li*3
{ok,[{times,1,{node,1,li,[],[],[]},3}],[]}
author
------
Mariano Guerra
license
-------
BSD (+ optional beer to the author)
examples
--------
input::
p
output::
input::
p#id
output::
input::
p.class
output::
input::
p#id.class
output::
input::
p#foo.bar.baz
output::
input::
p#id-$ * 3
output::
input::
{hello}
output::
hello
input::
p{hello}
output::
hello
input::
h1#title.important {hi}
output::
hi
input::
ul > li * 3
output::
input::
ul.list > li#item-$.list-item * 3
output::
input::
.username > (span.first-name{Mariano} + { } + span.last-name{Guerra})
output::
Mariano Guerra
input::
p * 3 > a{asd}
output::
input::
p > ({Click } + a{here} + { to continue})
output::
Click here to continue