mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 00:50:28 +00:00
Refactor the dumpvariables macro as wikitext
Making it easier to customise
This commit is contained in:
parent
754c1251a9
commit
37ea659bf0
@ -1,41 +0,0 @@
|
||||
/*\
|
||||
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");
|
||||
};
|
||||
|
||||
})();
|
13
core/wiki/macros/dumpvariables.tid
Normal file
13
core/wiki/macros/dumpvariables.tid
Normal file
@ -0,0 +1,13 @@
|
||||
title: $:/core/macros/dumpvariables
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\define dumpvariables()
|
||||
<ul>
|
||||
<$list filter="[variables[]]" variable="varname">
|
||||
<li>
|
||||
<strong><code><$text text=<<varname>>/></code></strong>:<br/>
|
||||
<$codeblock code={{{ [<varname>getvariable[]] }}}/>
|
||||
</li>
|
||||
</$list>
|
||||
</ul>
|
||||
\end
|
Loading…
Reference in New Issue
Block a user