Merge Angular 16 Irish Monitor to develop #33

Merged
k.triantafyllou merged 151 commits from angular-16-irish-monitor into develop 2024-02-13 09:32:41 +01:00
1 changed files with 10 additions and 4 deletions
Showing only changes of commit a2706af35d - Show all commits

View File

@ -194,7 +194,7 @@ export class Identifier {
pid = Identifier.getRawDOIValue(pid); pid = Identifier.getRawDOIValue(pid);
return {"class": "doi", "id": pid}; return {"class": "doi", "id": pid};
} else if (Identifier.isValidORCID(pid)) { } else if (Identifier.isValidORCID(pid)) {
return {"class": "ORCID", "id": pid}; return {"class": "ORCID", "id": Identifier.getRawORCID(pid)};
} else if (Identifier.isValidPMCID(pid)) { } else if (Identifier.isValidPMCID(pid)) {
return {"class": "pmc", "id": pid}; return {"class": "pmc", "id": pid};
} else if (Identifier.isValidPMID(pid)) { } else if (Identifier.isValidPMID(pid)) {
@ -237,9 +237,15 @@ export class Identifier {
public static isValidORCID(str: string): boolean { public static isValidORCID(str: string): boolean {
let exp = /\b\d{4}-\d{4}-\d{4}-(\d{3}X|\d{4})\b/g; let exp = /\b\d{4}-\d{4}-\d{4}-(\d{3}X|\d{4})\b/g;
return str.match(exp) != null; return str.match(exp) != null || this.getRawORCID(str).match(exp) != null;
} }
public static getRawORCID(id: string): string {
if(id.indexOf("orcid.org")!=-1 && id.split("orcid.org/").length > 1){
id = id.split("orcid.org/")[1];
}
return id;
}
public static isValidPMID(str: string): boolean { public static isValidPMID(str: string): boolean {
let exp = /^\d*$/g; let exp = /^\d*$/g;
return str.match(exp) != null; return str.match(exp) != null;
@ -279,7 +285,7 @@ export class StringUtils {
public static jsonRegex = /^[\],:{}\s]*$/; public static jsonRegex = /^[\],:{}\s]*$/;
public static urlPrefix(url: string): string { public static urlPrefix(url: string): string {
if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("//")) { if (!url || url.startsWith("http://") || url.startsWith("https://") || url.startsWith("//")) {
return ""; return "";
} else { } else {
return "//"; return "//";