wip
This commit is contained in:
parent
def7767b94
commit
8ad4302ec8
13 changed files with 3902 additions and 4 deletions
38
scripts/generate-emojis.js
Normal file
38
scripts/generate-emojis.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
try {
|
||||
console.error('Downloading emoji-test.txt...');
|
||||
const response = await fetch('https://unicode.org/Public/emoji/latest/emoji-test.txt');
|
||||
const text = await response.text();
|
||||
const emojis = extractEmojis(text);
|
||||
console.error(`Extracted ${emojis.length} fully-qualified emojis.`);
|
||||
console.log(`
|
||||
namespace Femto.Modules.Blog.Emoji;
|
||||
|
||||
internal static partial class AllEmoji
|
||||
{
|
||||
public static readonly string[] Emojis = [\n${emojis.map(e => `"${e}"`).join(',\n')}\n];
|
||||
}
|
||||
`)
|
||||
} catch (err) {
|
||||
console.error('Error:', err);
|
||||
}
|
||||
|
||||
|
||||
function extractEmojis(text) {
|
||||
const lines = text.split('\n');
|
||||
const emojis = [];
|
||||
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('#') || line.trim() === '') continue;
|
||||
|
||||
const [codePart, descPart] = line.split(';');
|
||||
if (!descPart || !descPart.includes('fully-qualified')) continue;
|
||||
|
||||
const match = line.match(/#\s+(.+?)\s+E\d+\.\d+/);
|
||||
if (match) {
|
||||
emojis.push(match[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return emojis;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue