mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2026-03-11 17:21:56 -07:00
* fix: apply automatic eslint fixes * lint: allow hashbang comment for tiddlywiki.js * lint: first back of manual lint fixes for unused vars * lint: added more fixes for unused vars * lint: missed files * lint: updated eslint config with selected rules from #9669
21 lines
675 B
JavaScript
21 lines
675 B
JavaScript
/*\
|
|
title: $:/plugins/tiddlywiki/wikitext-serialize/rules/macrodef.js
|
|
type: application/javascript
|
|
module-type: wikiruleserializer
|
|
\*/
|
|
|
|
"use strict";
|
|
|
|
exports.name = "macrodef";
|
|
|
|
exports.serialize = function(tree,serialize) {
|
|
var name = tree.attributes.name.value;
|
|
var params = tree.params.map(function(param) {
|
|
return param.name + (param.default ? ":" + param.default : "");
|
|
}).join(",");
|
|
var definition = tree.attributes.value.value;
|
|
if(tree.isBlock) {
|
|
return "\\define " + name + "(" + params + ") " + definition + "\n\n" + serialize(tree.children);
|
|
}
|
|
return "\\define " + name + "(" + params + ")\n" + definition + "\n\\end\n\n" + serialize(tree.children);
|
|
};
|