[ADF-4013] Fixed anchor generation in ToC doc tool (#4263)

This commit is contained in:
Andy Stark
2019-02-04 19:13:59 +00:00
committed by Eugenio Romano
parent 3a5fe3fb92
commit 947c55fbeb
2 changed files with 6 additions and 2 deletions

View File

@@ -21,7 +21,7 @@
"toc" "toc"
], ],
"dev": [ "dev": [
"fileChecker" "toc"
] ]
}, },
"statusIcons": { "statusIcons": {

View File

@@ -135,7 +135,11 @@ function makeToc(tree) {
context.headings.push({ context.headings.push({
"level": heading.item.depth - 2, "level": heading.item.depth - 2,
"title": linkTitle, "title": linkTitle,
"anchor": "#" + linkTitle.toLowerCase().replace(/ /g, "-").replace(/[:;@\.,'"`$\(\)\/]/g ,"") //"anchor": "#" + linkTitle.toLowerCase().replace(/ /g, "-").replace(/[:;@\.,'"`$\(\)\/]/g ,"")
"anchor": "#" + linkTitle.toLowerCase()
.replace(/\W/g ,"-")
.replace(/-+/g, '-')
.replace(/-+$/, '')
}) })
}; };
}); });