Upgraded highlight version to 9.1, removed highlight when sample is too long

This commit is contained in:
Anna Bodnia
2016-02-09 15:16:07 +02:00
parent 312eeef8e5
commit 14124c729b
17 changed files with 404 additions and 30 deletions

View File

@@ -1,4 +1,5 @@
'use strict';
/*jslint eqeq: true*/
Handlebars.registerHelper('sanitize', function(html) {
// Strip the script tags from the html, and return it as a Handlebars.SafeString
@@ -51,3 +52,27 @@ Handlebars.registerHelper('renderTextParam', function(param) {
}
return new Handlebars.SafeString(result);
});
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
switch (operator) {
case '==':
return (v1 == v2) ? options.fn(this) : options.inverse(this);
case '===':
return (v1 === v2) ? options.fn(this) : options.inverse(this);
case '<':
return (v1 < v2) ? options.fn(this) : options.inverse(this);
case '<=':
return (v1 <= v2) ? options.fn(this) : options.inverse(this);
case '>':
return (v1 > v2) ? options.fn(this) : options.inverse(this);
case '>=':
return (v1 >= v2) ? options.fn(this) : options.inverse(this);
case '&&':
return (v1 && v2) ? options.fn(this) : options.inverse(this);
case '||':
return (v1 || v2) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
});