Skip to content

Commit

Permalink
Finish convertGlossToSC
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvNC committed Jan 20, 2024
1 parent 011e6f2 commit 3fda848
Showing 1 changed file with 41 additions and 15 deletions.
56 changes: 41 additions & 15 deletions src/util/yomitan/convertGlossToSC.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { languages } from '../../constants';
import { isStringSentence } from '../textHandling/textUtils';

const examplePhrase = '配詞 / 用法';
const exampleSentence = '例句';
const examplePhraseText = '配詞 / 用法';
const exampleSentenceText = '例句';
const examplePhraseEmoji = '💬';
const exampleSentenceEmoji = '📝';

Expand Down Expand Up @@ -50,20 +50,46 @@ function convertGlossToSC(gloss) {
{
tag: 'div',
data: {
wordshk: 'phrase',
wordshk: 'examples',
},
content: phrases.map((phrase) => {
return convertLanguageDataToUlSC(phrase, true);
}),
},
{
tag: 'div',
data: {
wordshk: 'sentence',
},
content: sentences.map((sentence) => {
return convertLanguageDataToUlSC(sentence, false);
}),
content: [
{
tag: 'div',
data: {
wordshk: 'phrase',
},
content: [
{
tag: 'span',
content: examplePhraseText,
style: {
listStyleType: `"${examplePhraseEmoji}"`,
},
},
...phrases.map((phrase) => {
return convertLanguageDataToUlSC(phrase, true);
}),
],
},
{
tag: 'div',
data: {
wordshk: 'sentence',
},
content: [
{
tag: 'span',
content: exampleSentenceText,
style: {
listStyleType: `"${exampleSentenceEmoji}"`,
},
},
...sentences.map((sentence) => {
return convertLanguageDataToUlSC(sentence, false);
}),
],
},
],
},
],
};
Expand Down

0 comments on commit 3fda848

Please sign in to comment.