Skip to content

Commit

Permalink
Syn/Ants: Improve styling, add header, use lists
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvNC committed Feb 4, 2024
1 parent 23821e8 commit 1845701
Showing 1 changed file with 44 additions and 8 deletions.
52 changes: 44 additions & 8 deletions src/util/yomitan/convertEntryToSynAntsSC.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// const synonymEmoji = ;
// const antonymEmoji = '🚫';

const types = {
sim: {
emoji: '🔗',
text: '近義',
},
ant: {
emoji: '🚫',
text: '反義',
},
};

/**
* Converts an entry to a ul list of the element's synonyms and antonyms.
* @param {DictionaryEntry} entry
Expand Down Expand Up @@ -37,21 +51,43 @@ function convertEntryToSCType(entry, type) {
exists: false,
};
}
let tagString = typeTags.map((tag) => tag.value).join('・');
// let tagString = typeTags.map((tag) => tag.value).join('・');
return {
SC: {
tag: 'ul',
data: {
wordshk: `${type}-list`,
},
lang: 'yue',
content: {
tag: 'li',
data: {
wordshk: type,
content: [
{
tag: 'li',
style: {
listStyleType: `"${types[type].emoji}"`,
fontWeight: 'bold',
},
data: {
wordshk: `${type}-header`,
},
content: types[type].text,
},
content: tagString,
},
{
tag: 'ul',
/**
* @type {import('yomichan-dict-builder/dist/types/yomitan/termbank').StructuredContent[]}
*/
content: typeTags.map((tag) => ({
tag: 'li',
data: {
wordshk: `${type}-entry`,
},
content: tag.value,
lang: 'yue',
style: {
fontSize: '1.2em',
},
})),
},
],
},
exists: true,
};
Expand Down

0 comments on commit 1845701

Please sign in to comment.