mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 13:29:56 +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
31 lines
772 B
JavaScript
31 lines
772 B
JavaScript
/*\
|
|
title: $:/core/modules/rendertree/renderers/macrodef.js
|
|
type: application/javascript
|
|
module-type: wikirenderer
|
|
|
|
Macro definition renderer
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
/*
|
|
Macro definition renderer
|
|
*/
|
|
var MacroDefRenderer = function(renderTree,parentRenderer,parseTreeNode) {
|
|
// Store state information
|
|
this.renderTree = renderTree;
|
|
this.parentRenderer = parentRenderer;
|
|
this.parseTreeNode = parseTreeNode;
|
|
// Save the macro definition into the context of the rendertree
|
|
this.renderTree.context.macroDefinitions = this.renderTree.context.macroDefinitions || {};
|
|
this.renderTree.context.macroDefinitions[this.parseTreeNode.name] = this.parseTreeNode;
|
|
};
|
|
|
|
exports.macrodef = MacroDefRenderer
|
|
|
|
})();
|