mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-13 19:00:27 +00:00
Fix invocation of JS macros
This commit is contained in:
parent
e50101322f
commit
ec1ec8ccd8
@ -200,8 +200,8 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
|||||||
$tw.utils.each(srcVariable.params,function(param) {
|
$tw.utils.each(srcVariable.params,function(param) {
|
||||||
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],param.name,param["default"])
|
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],param.name,param["default"])
|
||||||
});
|
});
|
||||||
} else if(srcVariable.isMacroDefinition) {
|
} else {
|
||||||
// For macros, wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
|
// For macros and ordinary variables, wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
|
||||||
parser = {
|
parser = {
|
||||||
tree: [
|
tree: [
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,8 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
|||||||
}
|
}
|
||||||
// If the variable doesn't exist in the parent widget then look for a macro module
|
// If the variable doesn't exist in the parent widget then look for a macro module
|
||||||
return {
|
return {
|
||||||
text: this.evaluateMacroModule(name,actualParams,options.defaultValue)
|
text: this.evaluateMacroModule(name,actualParams,options.defaultValue),
|
||||||
|
srcVariable: {}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
title: Transclude/Macro/JavaScript
|
||||||
|
description: Transcluding a javascript macro
|
||||||
|
type: text/vnd.tiddlywiki-multiple
|
||||||
|
tags: [[$:/tags/wiki-test-spec]]
|
||||||
|
|
||||||
|
title: Output
|
||||||
|
|
||||||
|
\whitespace trim
|
||||||
|
|
||||||
|
<<makedatauri text:"Wildebeest" type:"text/plain">>
|
||||||
|
|
||||||
|
<$macrocall $name="makedatauri" text="Wildebeest" type="text/plain"/>
|
||||||
|
|
||||||
|
+
|
||||||
|
title: ExpectedResult
|
||||||
|
|
||||||
|
<p><a class="tc-tiddlylink-external" href="data:text/plain,Wildebeest" rel="noopener noreferrer" target="_blank">data:text/plain,Wildebeest</a></p><p><a class="tc-tiddlylink-external" href="data:text/plain,Wildebeest" rel="noopener noreferrer" target="_blank">data:text/plain,Wildebeest</a></p>
|
Loading…
Reference in New Issue
Block a user