Creating and testing macro

This commit is contained in:
David Masad
2021-02-20 21:11:19 -05:00
parent 5ac02040bd
commit e1e8932207
7 changed files with 108 additions and 54 deletions

View File

@ -63,4 +63,22 @@ StoryManager.getStorylets = function(n=null, tag=null, respect_interrupt=true) {
return selectedStorylets;
}
// Set up macros
Macro.add("getStoryletLinks", {
handler: function() {
let n, tag;
[n=null, tag=null] = this.args;
State.temporary.nextStorylets = StoryManager.getStorylets(n, tag);
$(this.output).wiki(`
<<for _storylet range _nextStorylets>> \
<<capture _storylet>> \
[[_storylet.description|_storylet.passage][$currentStorylet=_storylet]]<br>
<</capture>> \
<</for>> \
`);
}
})
window.SM = StoryManager;