Solve multiple spaces and max chars

This commit is contained in:
Jasey Waegebaert 2022-07-02 09:35:50 +02:00
parent 405f34dd89
commit 382150261d

View File

@ -14,12 +14,11 @@ export class SPService {
private static GetAnchorUrl(headingValue: string): string { private static GetAnchorUrl(headingValue: string): string {
let anchorUrl = `#${headingValue let anchorUrl = `#${headingValue
.toLowerCase() .toLowerCase()
.trim() .replace(/[{}|\[\]\<\>#@"'^%`?;:\/=~\\\s\s+]/g, " ")
.replace(/[{}|\[\]\<\>#@"'^%`?;:/=~\\]/g, " ") .replace(/^(-|\s)*|(-|\s)*$/g, "")
.replace(/^\-*|\-*$/g, "")
.trim()
.replace(/\'|\?|\\|\/| |\&/g, "-") .replace(/\'|\?|\\|\/| |\&/g, "-")
.replace(/--+/g, "-")}`; .replace(/-+/g, "-")
.substring(0, 128)}`;
let counter = 1; let counter = 1;
this.allUrls.forEach(url => { this.allUrls.forEach(url => {