1
0
Fork 0
mirror of https://github.com/dilllxd/gitfolio.git synced 2024-08-14 22:28:09 +00:00

fixed emoji issue

emoijs weren't showing up if description of repo or bio had more than one emoji + if the emoji was missing from github-emoji
This commit is contained in:
imfunny 2019-05-10 12:38:05 +05:30 committed by GitHub
parent 22aa1292f8
commit 9949893bf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 9 deletions

View file

@ -6,7 +6,7 @@ options = {
};
program
.version('0.1.1')
.version('0.1.2')
.option('-t, --title [title]', 'give blog a title')
.option('-s, --subtitle [subtitle]', 'give blog a subtitle', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.')
.option('-p, --pagetitle [pagetitle]', 'give page a title')

View file

@ -8,7 +8,7 @@ options = {
};
program
.version('0.1.1')
.version('0.1.2')
.option('-n, --name [username]', 'get username')
.option('-d, --dark', 'enable dark mode')
.option('-b, --background [background]', 'set background image')
@ -47,14 +47,22 @@ if (program.background) {
populateCSS();
}
function convertToEmoji(text){
if (text == null) return;
text = text.toString();
if(text.match(/\:(.*)\:/) != null){
var str = text.match(/\:(.*)\:/)[1];
var output = emoji.of(str);
var emojiImage = output.url.replace("assets-cdn.github", "github.githubassets");
text = text.replace(/\:(.*)\:/, `<img src="${emojiImage}" class="emoji">`);
if(text.match(/(?<=:\s*).*?(?=\s*:)/gs) != null){
var str = text.match(/(?<=:\s*).*?(?=\s*:)/gs);
str = str.filter(function(arr) {
return /\S/.test(arr);
});
for(i=0;i<str.length;i++){
if(emoji.URLS[str[i]] != undefined){
var output = emoji.of(str[i]);
var emojiImage = output.url.replace("assets-cdn.github", "github.githubassets");
text = text.replace(`:${str[i]}:`, `<img src="${emojiImage}" class="emoji">`);
}
}
return text;
}else{
return text;

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "gitfolio",
"version": "1.0.0",
"version": "0.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "gitfolio",
"version": "0.1.1",
"version": "0.1.2",
"description": "portfolio website for showcasing your work",
"main": "build.js",
"scripts": {