1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-12-16 13:48:07 +00:00

Clean up the highlight plugin

Fixing various issues that were preventing language specifiers from
working.
This commit is contained in:
Jermolene
2014-02-10 13:51:38 +00:00
parent e003889171
commit ecba4f71ea
4 changed files with 32 additions and 50 deletions

View File

@@ -30,16 +30,12 @@ CodeBlockWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent;
this.computeAttributes();
this.execute();
var codeNode = this.document.createElement("code");
if(this.getAttribute("language")) {
codeNode.setAttribute("class",this.getAttribute("language"));
}
var domNode = this.document.createElement("pre");
var codeNode = this.document.createElement("code"),
domNode = this.document.createElement("pre");
codeNode.appendChild(this.document.createTextNode(this.getAttribute("code")));
domNode.appendChild(codeNode);
parent.insertBefore(domNode,nextSibling);
this.domNodes.push(domNode);
if(this.postRender) {
this.postRender();
}
@@ -49,7 +45,7 @@ CodeBlockWidget.prototype.render = function(parent,nextSibling) {
Compute the internal state of the widget
*/
CodeBlockWidget.prototype.execute = function() {
// Nothing to do for a text node
this.language = this.getAttribute("language");
};
/*