mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-06 01:56:20 +00:00
8564602256
Get rid of the separate renderContext stack and instead have a parent pointer on renderer nodes. This lets us walk back up the render tree to resolve context references
36 lines
803 B
JavaScript
36 lines
803 B
JavaScript
/*\
|
|
title: $:/core/modules/rendertree/renderers/entity.js
|
|
type: application/javascript
|
|
module-type: wikirenderer
|
|
|
|
Entity renderer
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
/*
|
|
Entity renderer
|
|
*/
|
|
var EntityRenderer = function(renderTree,parentRenderer,parseTreeNode) {
|
|
// Store state information
|
|
this.renderTree = renderTree;
|
|
this.parentRenderer = parentRenderer;
|
|
this.parseTreeNode = parseTreeNode;
|
|
};
|
|
|
|
EntityRenderer.prototype.render = function(type) {
|
|
return type === "text/html" ? this.parseTreeNode.entity : $tw.utils.entityDecode(this.parseTreeNode.entity);
|
|
};
|
|
|
|
EntityRenderer.prototype.renderInDom = function() {
|
|
return document.createTextNode($tw.utils.entityDecode(this.parseTreeNode.entity));
|
|
};
|
|
|
|
exports.entity = EntityRenderer
|
|
|
|
})();
|