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:
parent
22aa1292f8
commit
9949893bf0
4 changed files with 17 additions and 9 deletions
2
blog.js
2
blog.js
|
@ -6,7 +6,7 @@ options = {
|
||||||
};
|
};
|
||||||
|
|
||||||
program
|
program
|
||||||
.version('0.1.1')
|
.version('0.1.2')
|
||||||
.option('-t, --title [title]', 'give blog a title')
|
.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('-s, --subtitle [subtitle]', 'give blog a subtitle', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.')
|
||||||
.option('-p, --pagetitle [pagetitle]', 'give page a title')
|
.option('-p, --pagetitle [pagetitle]', 'give page a title')
|
||||||
|
|
20
build.js
20
build.js
|
@ -8,7 +8,7 @@ options = {
|
||||||
};
|
};
|
||||||
|
|
||||||
program
|
program
|
||||||
.version('0.1.1')
|
.version('0.1.2')
|
||||||
.option('-n, --name [username]', 'get username')
|
.option('-n, --name [username]', 'get username')
|
||||||
.option('-d, --dark', 'enable dark mode')
|
.option('-d, --dark', 'enable dark mode')
|
||||||
.option('-b, --background [background]', 'set background image')
|
.option('-b, --background [background]', 'set background image')
|
||||||
|
@ -47,14 +47,22 @@ if (program.background) {
|
||||||
populateCSS();
|
populateCSS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function convertToEmoji(text){
|
function convertToEmoji(text){
|
||||||
if (text == null) return;
|
if (text == null) return;
|
||||||
text = text.toString();
|
text = text.toString();
|
||||||
if(text.match(/\:(.*)\:/) != null){
|
if(text.match(/(?<=:\s*).*?(?=\s*:)/gs) != null){
|
||||||
var str = text.match(/\:(.*)\:/)[1];
|
var str = text.match(/(?<=:\s*).*?(?=\s*:)/gs);
|
||||||
var output = emoji.of(str);
|
str = str.filter(function(arr) {
|
||||||
var emojiImage = output.url.replace("assets-cdn.github", "github.githubassets");
|
return /\S/.test(arr);
|
||||||
text = text.replace(/\:(.*)\:/, `<img src="${emojiImage}" class="emoji">`);
|
});
|
||||||
|
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;
|
return text;
|
||||||
}else{
|
}else{
|
||||||
return text;
|
return text;
|
||||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "gitfolio",
|
"name": "gitfolio",
|
||||||
"version": "1.0.0",
|
"version": "0.1.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "gitfolio",
|
"name": "gitfolio",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"description": "portfolio website for showcasing your work",
|
"description": "portfolio website for showcasing your work",
|
||||||
"main": "build.js",
|
"main": "build.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue