-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunkit.js
36 lines (32 loc) · 921 Bytes
/
runkit.js
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
var markup = require("telemark/dist/telemark-html.min.js");
markup.html.init(this);
var wikipedia_url = 'https://en.wikipedia.org/wiki/';
// Create reusable components
markup.specify('brother', function (first_name) {
return a( href(wikipedia_url + first_name + '_Marx'), target('_blank'),
text(first_name)
)
});
var brothers = ['Groucho', 'Harpo', 'Chico'];
// Build markup with built-in methods for elements, iteration, conditionals etc.
section(
h1('Marx Brothers on Wikipedia'),
ol(
iterate( brothers, function (name) {
return li(
brother(name)
);
}),
li( $class('other'),
brother('Gummo')
),
when ( 0 > 1,
li(
brother('Karl')
)
),
li( $class('other'),
brother('Zeppo')
)
)
).make();