mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-03-01 09:20:02 +00:00
fix: macro in widget param
This commit is contained in:
parent
375df47b19
commit
53296a484c
@ -405,8 +405,15 @@ exports.serializeAttribute = function(node) {
|
|||||||
} else if(node.type === "substituted") {
|
} else if(node.type === "substituted") {
|
||||||
attributeString += "=`" + node.rawValue + "`";
|
attributeString += "=`" + node.rawValue + "`";
|
||||||
} else if(node.type === "macro") {
|
} else if(node.type === "macro") {
|
||||||
// Assuming macro serialization is complex and handled elsewhere
|
if(node.value && typeof node.value === "object" && node.value.type === "macrocall") {
|
||||||
attributeString += "=" + node.value.serialize();
|
var params = node.value.params.map(function(param) {
|
||||||
|
return param.value;
|
||||||
|
}).join(" ");
|
||||||
|
attributeString += "=<<" + node.value.name + " " + params + ">>";
|
||||||
|
} else {
|
||||||
|
// Unsupported macro structure
|
||||||
|
return null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Unsupported type
|
// Unsupported type
|
||||||
return null;
|
return null;
|
||||||
|
@ -197,9 +197,9 @@ exports.isLegalTag = function(tag) {
|
|||||||
|
|
||||||
exports.serialize = function(tree, serialize) {
|
exports.serialize = function(tree, serialize) {
|
||||||
var tag = tree.tag;
|
var tag = tree.tag;
|
||||||
var attributes = Object.keys(tree.attributes).map(function(key) {
|
var attributes = tree.orderedAttributes.map(function(attribute) {
|
||||||
return key + '="' + tree.attributes[key].value + '"';
|
return $tw.utils.serializeAttribute(attribute);
|
||||||
}).join("");
|
}).join(" ");
|
||||||
// Children
|
// Children
|
||||||
var children = tree.children ? serialize(tree.children) : "";
|
var children = tree.children ? serialize(tree.children) : "";
|
||||||
// Self-closing tag
|
// Self-closing tag
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
tags: $:/tags/wikitext-serialize-test-spec
|
||||||
|
title: Serialize/Attribute
|
||||||
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
|
<$macrocall $name="rpn" a=<<rpn 2 2 *>> b="pi" operation="*" decimals="4" />
|
Loading…
x
Reference in New Issue
Block a user