This repository has been archived by the owner on May 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathindex.html
380 lines (328 loc) · 10.7 KB
/
index.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Try Handlebars.js in your web browser</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="stylesheet" href="css/main.css">
<!-- dev >
<script src="jspm_packages/system.js"></script>
<script src="config.js"></script>
<script>
System.import('js/script');
</script>
<!-- prod -->
<script src="jspm_packages/system.js"></script>
<script src="config.js"></script>
<script src="build.js"></script>
<script id ="getting-started-1" type="text/x-handlebars-template">
<div class="entry">
<h1>{{title}}</h1>
<div class="body">
{{body}}
</div>
</div>
</script>
<script id ="getting-started-1-context" type="text/x-handlebars-template">
{
title: "My New Post",
body: "This is my first post!"
}
</script>
<script id ="getting-started-2" type="text/x-handlebars-template">
<div class="entry">
<h1>{{title}}</h1>
<div class="body">
{{{body}}}
</div>
</div>
</script>
<script id ="getting-started-2-context" type="text/x-handlebars-template">
{
title: "All about <p> Tags",
body: "<p>This is a post about <p> tags</p>"
}
</script>
<script id ="block-expressions-1" type="text/x-handlebars-template">
{{#list people}}{{firstName}} {{lastName}}{{/list}}
</script>
<script id ="block-expressions-1-context" type="text/x-handlebars-template">
{
people : [
{ firstName: "Yehuda", lastName: "Katz" },
{ firstName: "Carl", lastName: "Lerche" },
{ firstName: "Alan", lastName: "Johnson" }
]
}
</script>
<script id ="block-expressions-1-helpers" type="text/x-handlebars-template">
Handlebars.registerHelper('list', function(items, options) {
var out = "<ul>";
for(var i=0, l=items.length; i<l; i++) {
out = out + "<li>" + options.fn(items[i]) + "</li>";
}
out = out + "</ul>";
return out;
});
</script>
<script id ="built-in-block-helpers-1" type="text/x-handlebars-template">
<ul class="people_list">
{{#each people}}
<li>{{this}}</li>
{{/each}}
</ul>
</script>
<script id ="built-in-block-helpers-1-context" type="text/x-handlebars-template">
{
people: [
"Yehuda Katz",
"Alan Johnson",
"Charles Jolley"
]
}
</script>
<script id ="built-in-block-helpers-2" type="text/x-handlebars-template">
<div class="entry">
{{#if author}}
<h1>{{firstName}} {{lastName}}</h1>
{{/if}}
</div>
</script>
<script id ="built-in-block-helpers-2-context" type="text/x-handlebars-template">
{}
</script>
<script id ="built-in-block-helpers-3" type="text/x-handlebars-template">
<div class="entry">
{{#if author}}
<h1>{{firstName}} {{lastName}}</h1>
{{/if}}
</div>
</script>
<script id ="built-in-block-helpers-3-context" type="text/x-handlebars-template">
{
author: true,
firstName: 'eric',
lastName: 'blair'
}
</script>
<script id ="built-in-block-helpers-4" type="text/x-handlebars-template">
<div class="entry">
{{#if author}}
<h1>{{firstName}} {{lastName}}</h1>
{{else}}
<h1>Unknown Author</h1>
{{/if}}
</div>
</script>
<script id ="built-in-block-helpers-5" type="text/x-handlebars-template">
<div class="entry">
{{#unless license}}
<h3 class="warning">WARNING: This entry does not have a license!</h3>
{{/unless}}
</div>
</script>
<script id ="built-in-block-helpers-6" type="text/x-handlebars-template">
<div class="entry">
{{#unless license}}
<h3 class="warning">WARNING: This entry does not have a license!</h3>
{{/unless}}
<h3>License Exists!</h3>
</div>
</script>
<script id ="built-in-block-helpers-6-context" type="text/x-handlebars-template">
{ license: true }
</script>
<script id ="paths-1" type="text/x-handlebars-template">
<p>{{name}}</p>
</script>
<script id ="paths-1-context" type="text/x-handlebars-template">
{ name: 'John Denver' }
</script>
<script id ="paths-2" type="text/x-handlebars-template">
<div class="entry">
<h1>{{title}}</h1>
<h2>By {{author/name}}</h2>
<div class="body">
{{body}}
</div>
</div>
</script>
<script id ="paths-2-context" type="text/x-handlebars-template">
{
title: "My First Blog Post!",
author: {
id: 47,
name: "Yehuda Katz"
},
body: "My first post. Wheeeee!"
}
</script>
<script id ="paths-3" type="text/x-handlebars-template">
<h1>Comments</h1>
<div id="comments">
{{#each comments}}
<h2><a href="/posts/{{../permalink}}#{{id}}">{{title}}</a></h2>
<div>{{body}}</div>
{{/each}}
</div>
</script>
<script id ="paths-3-context" type="text/x-handlebars-template">
{
comments: [
{ id: 1, title: 'wow what a great site'},
{ id: 2, title: 'i really love handlebars js'}
],
body: "Try Handlebars JS!",
permalink: "try-handlebars-js-today",
}
</script>
<script id ="paths-4" type="text/x-handlebars-template">
<p>{{this.content}}</p>
<p>{{this.[10]}}</p>
</script>
<script id ="paths-4-context" type="text/x-handlebars-template">
{ content: 'how can i access a numeric key?', '10':'with brackets!' }
</script>
<script id ="helpers-1" type="text/x-handlebars-template">
<div class="post">
<h1>By {{fullName author}}</h1>
<div class="body">{{body}}</div>
<h1>Comments</h1>
{{#each comments}}
<h2>By {{fullName author}}</h2>
<div class="body">{{body}}</div>
{{/each}}
</div>
</script>
<script id ="helpers-1-context" type="text/x-handlebars-template">
{
author: {firstName: "Alan", lastName: "Johnson"},
body: "I Love Handlebars",
comments: [{
author: {firstName: "Yehuda", lastName: "Katz"},
body: "Me too!"
}]
}
</script>
<script id ="helpers-1-helpers" type="text/x-handlebars-template">
Handlebars.registerHelper('fullName', function(person) {
return person.firstName + " " + person.lastName;
});
</script>
<script id ="helpers-2" type="text/x-handlebars-template">
<ul>
{{#each items}}
{{{agree_button}}}
{{/each}}
</ul>
</script>
<script id ="helpers-2-context" type="text/x-handlebars-template">
{
items: [
{name: "Handlebars", emotion: "love"},
{name: "Mustache", emotion: "enjoy"},
{name: "SproutCore", emotion: "want to learn"}
]
}
</script>
<script id ="helpers-2-helpers" type="text/x-handlebars-template">
Handlebars.registerHelper('agree_button', function() {
return "<button>I agree. I " + this.emotion + " " + this.name + "</button>";
});
</script>
</head>
<body style="background-color:orange;">
<div id="container">
<a href="https://github.com/jblotus/Try-Handlebars.js"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<section class="stripe padding--all" style="background-color:orange;">
<h1 style="color:black;">Try Handlebars.js right now in your browser</h1>
<p>
<a href="http://www.handlebarsjs.com">Handlebars.js</a> is a sweet javascript library for building clean logicless templates
based on the
<a href="http://mustache.github.com/">Mustache Templating Language</a>.
</p>
</section>
<div id="main" role="main" class="borderradius">
<div class="padding--all">
<div class="spreadable atLarge_spreadable--spread">
<div class="spreadable-item spreadable-item--shrink try-hbs--select-label spreadable-item--label row-item--alignMiddle">
<label for="examples" class="try-hbs--label">Examples</label>
</div>
<div class="spreadable-item">
<select id="example"></select>
</div>
</div>
<div class="spreadable atLarge_spreadable--spread">
<div class="spreadable-item spreadable-item--shrink try-hbs--select-label spreadable-item--label row-item--alignMiddle">
<label for="engine" class="try-hbs--label try-hbs--select-label">Engine</label>
</div>
<div class="spreadable-item">
<select id="engine">
<option value="hbs403">Handlebars v4.0.3</option>
<option value="hbs303">Handlebars v3.0.3</option>
<option value="hbs200">Handlebars v2.0.0</option>
<option value="hbs130">Handlebars v1.3.0</option>
<option value="mustache213">Mustache v2.1.3</option>
<option value="mustache120">Mustache v1.2.0</option>
</select>
</div>
</div>
</div>
<div class="spreadable atLarge_spreadable--spread padding--all border--top">
<div class="spreadable-item">
<label for="source" class="try-hbs--label">Handlebars Template</label>
<textarea id="source" type="textarea" spellcheck="false">{{source}}</textarea>
</div>
<div class="spreadable-item">
<label for="context" class="try-hbs--label">Context (JavaScript literal or JSON) </label>
<textarea id="context" type="textarea" spellcheck="false">{{context}}</textarea>
</div>
<div id="helpersWrap" class="spreadable-item">
<label for="helpers" class="try-hbs--label">Register Helper functions (if any)</label>
<textarea id="helpers" type="textarea" spellcheck="false">{{helpers}}</textarea>
</div>
</div>
<div>
<input class="compile" type="submit" value="Compile Handlebars Template" />
<p class="errors padding--left padding--right"><span></span></p>
</div>
<div class="output spreadable atLarge_spreadable--spread padding--all">
<div class="spreadable-item">
<p>HTML Source Output</p>
<textarea id="output-window">{{output}}</textarea>
</div>
<div class="spreadable-item">
<p>HTML Preview</p>
<div id="output-window-html">{{{output}}}</div>
</div>
</div>
</div>
<footer style="background-color:orange;" class="padding--all">
<p>Site by <a href="http://www.jblotus.com">James Fuller</a> Twitter: <a href="https://twitter.com/j_blotus">@j_blotus</a></p>
<p>and <a href="http://mattki.me">Matthew Kime</a> Twitter: <a href="https://twitter.com/matt_kime">@matt_kime</a></p>
<p>
Want to add something? <a href="https://github.com/jblotus/Try-Handlebars.js">Fork this on GitHub</a> and send me a pull request.
</p>
</footer>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23515515-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>