mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-28 11:00:27 +00:00
Add dumpvariables macro
This commit is contained in:
parent
7f9c7b441f
commit
f16d1832aa
41
core/modules/macros/dumpvariables.js
Normal file
41
core/modules/macros/dumpvariables.js
Normal 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");
|
||||
};
|
||||
|
||||
})();
|
27
editions/tw5.com/tiddlers/macros/dumpvariables.tid
Normal file
27
editions/tw5.com/tiddlers/macros/dumpvariables.tid
Normal 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 `''''`.
|
||||
|
Loading…
Reference in New Issue
Block a user