Skip to content

Commit

Permalink
Use callouts for tags, add tag info lines
Browse files Browse the repository at this point in the history
  • Loading branch information
p-l- committed Feb 2, 2023
1 parent 7612a11 commit 190e74e
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,15 @@ function flag_emoji(country_code: string): string {
String.fromCodePoint(127397 + char.charCodeAt(0))
);
}
function tag_emoji(tag: IvreTag): string | undefined {
function tag_type(tag: IvreTag): string {
switch (tag.type) {
case "info": {
return "ℹ️";
}
case "warning": {
return "⚠️";
}
case "info":
case "warning":
case "danger": {
return "🚨";
return tag.type.toUpperCase();
}
default: {
return undefined;
return "EXAMPLE";
}
}
}
Expand Down Expand Up @@ -577,9 +573,10 @@ class IvreSearchView extends IvreSearch {
let answer = "";
let tmp_answer = "";
(data.tags || []).forEach((tag: IvreTag) => {
tmp_answer += `${tag_emoji(tag)} #${tag.value.replace(
/ /g,
"_"
tmp_answer += `\n> [!${tag_type(tag)}]- ${
tag.value
}\n> #${tag.value.replace(/ /g, "_")}\n> ${tag.info.join(
"\n> "
)}\n`;
});
if (tmp_answer) {
Expand Down

0 comments on commit 190e74e

Please sign in to comment.