Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doughsay/fml
Functional Markup Language
https://github.com/doughsay/fml
Last synced: about 1 month ago
JSON representation
Functional Markup Language
- Host: GitHub
- URL: https://github.com/doughsay/fml
- Owner: doughsay
- Created: 2012-04-27T13:25:36.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-04-27T13:37:42.000Z (over 12 years ago)
- Last Synced: 2024-04-14T22:12:37.620Z (7 months ago)
- Language: JavaScript
- Size: 89.8 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
FML: Functional Markup Language
===============================FML is a functional representation of HTML or more generally, XML. It's meant
to be used in place of a templating engine, either client-side or server-side
using Node.js or anything supporting CommonJS modules.Examples
--------All tags have corresponding functions, and they all follow a similar pattern.
br()
// ->div()
// ->div("Hello, World!")
// ->Hello, World!divC("foo", "Bar!")
// ->Bar!divI("Foo", "Hello!")
// ->Hello!divA({'class': 'box', style: 'width: 100px;'}, "Hello again!")
// ->Hello again!In actuality, to output a string of HTML you need to pass the outputs of these
functions through fml.render(). The functions are easily composed, mapped,
passed around, whatever!function person(p) {
return fml.liC('person',
fml.helpers.a(p.link, p.name)
);
}function people(ps) {
return fml.ulI('People', ps.map(person));
}var ps = [
{name: 'Chris', link: 'http://google.com'},
{name: 'John', link: 'http://example.com'}
];var output = fml.render(people(ps));
/* ->
*/
More documentation to come!