Highlight plugin: add static demo

Also clean up some coding style issues
print-window-tiddler
Jermolene 2015-09-11 22:36:30 +01:00
rodzic c80db86b67
commit 3592a9560b
2 zmienionych plików z 10 dodań i 5 usunięć

Wyświetl plik

@ -11,6 +11,11 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","highlightdemo.html","text/plain"]
"--rendertiddler","$:/core/save/all","highlightdemo.html","text/plain"],
"static": [
"--rendertiddler","$:/core/templates/static.template.html","static.html","text/plain",
"--rendertiddler","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
"--rendertiddlers","[!is[system]]","$:/core/templates/static.tiddler.html","static","text/plain",
"--rendertiddler","$:/core/templates/static.template.css","static/static.css","text/plain"]
}
}

Wyświetl plik

@ -23,14 +23,14 @@ CodeBlockWidget.prototype.postRender = function() {
if($tw.browser && this.document !== $tw.fakeDocument && this.language) {
domNode.className = this.language.toLowerCase();
hljs.highlightBlock(domNode);
} else if(!$tw.browser && this.language && this.language.indexOf("/") == -1 ){
try{
} else if(!$tw.browser && this.language && this.language.indexOf("/") === -1 ){
try {
domNode.className = this.language.toLowerCase() + " hljs";
domNode.children[0].innerHTML = hljs.fixMarkup(hljs.highlight(this.language, this.getAttribute("code")).value);
}
catch(err) {
//can't easily tell if a language is registered or not in the packed version of hightlight.js
//so we silently fail and the codeblock remains unchanged
// Can't easily tell if a language is registered or not in the packed version of hightlight.js,
// so we silently fail and the codeblock remains unchanged
}
}
};