Skip to content

Commit 7791bf4

Browse files
committed
keywords v2
1 parent e6ee92a commit 7791bf4

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

app/research/page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default function Research() {
114114
</div>
115115
<div className="paper_subtitle">
116116
<p>{author}. {journal}</p>
117-
</div>
117+
</div>
118118
</div>
119119
</div>
120120
{doi ? (

constants/publications.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

transformPublications.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ fs.readFile("constants/publications.bib", function(err, buf) {
99
lang: 'en-US',
1010
prepend (entry) {
1111
let {id, issued, DOI, type, title, volume, page, keyword} = entry;
12+
//keyword contains the research lines separated by comma, but sometimes it is empty
13+
if(!keyword){
14+
keyword = "";
15+
}
1216

1317
if (DOI && !DOI.match(/http/)) {
1418
DOI = "https://doi.org/" + DOI;
@@ -54,7 +58,16 @@ fs.readFile("constants/publications.bib", function(err, buf) {
5458
output = output.replace('<div class="csl-bib-body">',"");
5559
output = output.replace(/,([^,]*)$/,"$1");
5660
output = "["+output+"]";
57-
const str = JSON.parse(output).sort(function(a, b){
61+
//transform keyword from "keyword1,keyword2" to ["keyword1", "keyword2"]
62+
let jsonoutput = JSON.parse(output);
63+
jsonoutput = jsonoutput.map((item) => {
64+
if (item.keyword) {
65+
item.keyword = item.keyword.split(",");
66+
}
67+
return item;
68+
});
69+
70+
const str = jsonoutput.sort(function(a, b){
5871
if (a.date && b.date) {
5972
return b.date[0] - a.date[0]
6073
} else if (a.date) {

0 commit comments

Comments
 (0)