Plugin information (please complete the following information):
- OS: Windows 10
- Templater version: 2.18.1
- Obsidian version: 1.12.7
- Templater settings: Template folder location: "/_templater"
Describe the bug
Every separator displays the same label as the first one, regardless of its actual value.
Expected behavior
Each separator should display its own correct label (e.g. ── Grid ──, ── Standard ──).
Screenshots
I verified the displayList array in the console and confirmed the values are correct
Additional context
Code below.
<%*
selection = tp.file.selection()
const groups = [
{
label: '── Grid ──',
items: {
'grid|col-2': ' ƒ grid (2 column in default, option: 3, 4)',
'grid|25%': ' ƒ two non-even column grid (25% column in default, option: 33%, 75%)',
}
},
{
label: '── Standard ──',
items: {
Note: '🟦 Note',
Info: '🟦 Info',
Todo: '🟦 Todo',
Summary: '💧 Summary/Abstract',
Tip: '💧 Tip/Hint/Important',
Check: '🟩 Success, Check, Done',
FAQ: '🟧 Question, Help, FAQ',
Caution: '🟧 Caution, Attention',
Fail: '🟥 Failure, Fail, Missing',
Danger: '🟥 Danger',
Bug: '🟥 Bug',
Example: '🟪 Example',
Cite: '⬛ Quote, Cite',
}
},
]
let num = 0; //number of all callouts
const displayList = []
const valueList = []
// Flatten
for (const group of groups) { //change to let not affect result
displayList.push(group.label)
valueList.push(null)
for (const [key, desc] of Object.entries(group.items)) { //converts an object into an array of `[key, value]` pairs
displayList.push(desc);
valueList.push(key);
num++;
}
}
console.log(displayList)
let type = null
while (!type) {
type = await tp.system.suggester(displayList, valueList, true, 'Select callout type. (' + num + ' options)')
}
if (type.includes("grid")) {
return ">[!" + type + "]\n>>\n>\n>>"
} else {
return ">[!" + type + "]\n>"
}
-%>
Plugin information (please complete the following information):
Describe the bug
Every separator displays the same label as the first one, regardless of its actual value.
Expected behavior
Each separator should display its own correct label (e.g. ── Grid ──, ── Standard ──).
Screenshots
I verified the
displayListarray in the console and confirmed the values are correctAdditional context
Code below.