mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-09 11:29:58 +00:00
d338a54370
This is a half-way through a big refactoring of the parsing and rendering infrastructure. The main change is to separate the parse and render trees, which makes the code a lot cleaner. The new parser isn't yet functional enough to replace the existing parser so for the moment you have to manually invoke it with `$tw.testNewParser()` in your browser console. I really ought to use branches for this kind of thing...
38 lines
734 B
JavaScript
38 lines
734 B
JavaScript
/*\
|
|
title: $:/core/modules/rendertree/renderers/raw.js
|
|
type: application/javascript
|
|
module-type: wikirenderer
|
|
|
|
Raw HTML renderer
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
/*
|
|
Raw HTML renderer
|
|
*/
|
|
var RawRenderer = function(renderTree,renderContext,parseTreeNode) {
|
|
// Store state information
|
|
this.renderTree = renderTree;
|
|
this.renderContext = renderContext;
|
|
this.parseTreeNode = parseTreeNode;
|
|
};
|
|
|
|
RawRenderer.prototype.render = function(type) {
|
|
return this.parseTreeNode.html;
|
|
};
|
|
|
|
RawRenderer.prototype.renderInDom = function() {
|
|
var domNode = document.createElement("div");
|
|
domNode.innerHTML = this.parseTreeNode.html;
|
|
return domNode;
|
|
};
|
|
|
|
exports.raw = RawRenderer
|
|
|
|
})();
|