Handlebars JS Example 1
HTML
<script src="http://www.fsfoo.com/js/vendor/handlebars-1.0.rc.2.js"></script>
<h1>Handlebars JS Example</h1>
<script id="some-template" type="text/x-handlebars-template"> <table>
<table rows=100 style="width:100%">
public enum ReleaseDataSources {
<tr><td>
{{#datasources}}</td>
<td>{{displayName}}</td><td>("{{displayName}}", "{{cvName}}", "{{description}}", "{{url}}"),
{{/datasources}} </td></tr>
public ReleaseDataSources(String displayName, String cvName, String description, String url){
}
}
</table>
</script>
JavaScript
var source = $("#some-template").html();
var template = Handlebars.compile(source);
var data = {
datasources: [
{ displayName:'UniProtKB/Swiss-Prot',
cvName:'UniProtKB',
url:'http://www.uniprot.org/',
description:'UniProt knowledgebase Swiss-Prot section' },
{ displayName:'BGee',
cvName:'BGee',
url:'http://bgee.unil.ch',
description:'Database for gene expression evolution' },
{ displayName:'COSMIC',
cvName:'Cosmic',
url:'http://www.sanger.ac.uk/genetics/CGP/cosmic/',
description:'Catalogue of somatic mutations in cancer' },
{ displayName:'Ensembl',
cvName:'Ensembl genome',
url:'http://www.ensembl.org/',
description:'Ensembl human genome browser' },
{ displayName:'ENZYME',
cvName:'UniProtKB enzyme classification',
url:'http://www.expasy.org/enzyme/',
description:'Enzyme nomenclature database' },
{ displayName:'GO',
cvName:'GO',
url:'http://www.geneontology.org/',
description:'Gene Ontology' },
{ displayName:'HPA',
cvName:'HPA',
url:'http://www.proteinatlas.org/',
description:'Human Protein Atlas' },
{ displayName:'IntAct',
cvName:'IntAct interactions',
url:'http://www.ebi.ac.uk/intact/',
description:'Molecular interaction database' },
{ displayName:'InterPro',
cvName:'InterPro',
url:'http://www.ebi.ac.uk/interpro/',
description:'Integrated resource of protein families, domains and functional sites' },
{ displayName:'MeSH',
cvName:'MeSH',
...