add one more check for the imported data

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46353 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-03-20 11:06:44 +00:00
parent d19c45c193
commit 88c3173d54
1 changed files with 10 additions and 8 deletions

View File

@ -42,7 +42,7 @@ export class CiteThisComponent {
this.parseData();
var Cite = require('citation-js');
this.cite = new Cite(this.data);
// this.cite.setData(this.data);
// this.cite.setData(this.data);
this.citationText = this.cite.get(this.citation.getOptionsBy(this.selectedStyle));
// });
}
@ -65,14 +65,16 @@ export class CiteThisComponent {
if(this.result.publisher){
citationData.publisher = this.result.publisher;
}
citationData.author = [];
for (var i =0 ;i < this.result.authors.length; i++){
if(this.result.authors[i].name && this.result.authors[i].name.indexOf(", ") !== -1){
citationData.author.push({given:this.result.authors[i].name.split(", ")[0], family:this.result.authors[i].name.split(", ")[1], 'parse-names':true});
}else{
citationData.author.push({given:"", family:this.result.authors[i].name, 'parse-names':true});
if( this.result.authors){
citationData.author = [];
for (var i =0 ;i < this.result.authors.length; i++){
if(this.result.authors[i].name && this.result.authors[i].name.indexOf(", ") !== -1){
citationData.author.push({given:this.result.authors[i].name.split(", ")[0], family:this.result.authors[i].name.split(", ")[1], 'parse-names':true});
}else{
citationData.author.push({given:"", family:this.result.authors[i].name, 'parse-names':true});
}
citationData.authors.push(this.result.authors[i].name);
}
citationData.authors.push(this.result.authors[i].name);
}
if(this.result.dateofacceptance != undefined){
citationData.issued = [];