1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-28 11:00:27 +00:00

Add dumpvariables macro

This commit is contained in:
Jermolene 2014-09-08 15:06:48 +01:00
parent 7f9c7b441f
commit f16d1832aa
2 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,41 @@
/*\
title: $:/core/modules/macros/dumpvariables.js
type: application/javascript
module-type: macro
Macro to dump all active variable values
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "dumpvariables";
exports.params = [
];
/*
Run the macro
*/
exports.run = function() {
var output = ["|!Variable |!Value |"],
variables = [], variable;
for(variable in this.variables) {
variables.push(variable);
}
variables.sort();
for(var index=0; index<variables.length; index++) {
var variable = variables[index];
output.push("|" + variable + " |<input size=50 value=<<" + variable + ">>/> |")
}
return output.join("\n");
};
})();

View File

@ -0,0 +1,27 @@
created: 20140908104107181
modified: 20140908104107181
tags: macros
title: DumpVariablesMacro
type: text/vnd.tiddlywiki
The dumpvariables macro displays a table containing the values of all the variables defined at that location in the widget tree. It can be useful for exploring the mechanisms of TiddlyWiki and for debugging.
! Parameters
The dumpvariables macro does not require any parameters
! Examples
```
<<dumpvariables>>
```
Returns:
<<dumpvariables>>
The results returned by the dumpvariables macro will depend upon where it is used.
Note that the values displayed for macros are displayed with all the parameters and variable subsitutions set to an empty string. So, a macro defined as `\define myMacro(text) ''$text$''` will display as `''''`.