collaboration editor update fix, use closure for compression

This commit is contained in:
Matthew Scragg 2013-10-10 10:38:30 -05:00
parent 88fdf6b2ca
commit ccbf8336ea
9 changed files with 1313 additions and 86 deletions

33
realms/static/js/main.js Normal file
View file

@ -0,0 +1,33 @@
// Init highlight JS
hljs.initHighlightingOnLoad();
// Markdown Renderer
MDR = {
doc: null,
callback: WMD.convert,
sanitize: null, // Override
convert: function(md, sanitize){
if (this.sanitize !== null) {
sanitize = this.sanitize;
}
this.doc = this.callback(md);
var html = this.doc.html;
if (sanitize) {
// Causes some problems with inline styles
html = html_sanitize(html);
}
html = this.hook(html);
return html;
},
hook: function(html) {
if (!this.doc.metadata) {
return html;
}
try {
var template = Handlebars.compile(html);
return template(this.doc.metadata);
} catch(e) {
return html;
}
}
};