1. Very often I get leading and trailing spaces which could be automatically trimmed
2. It also happens, that multiple spaces are seen within the text, so another option would be fine to reduce these to a single space
3. sometimes, two headings are combined to a single bookmark entry, like "1.0 Headline 1.1 Sub headline ". Not sure, if such effects could be eliminated as well
I made a workaround for cases 1 and 2 by writing a javascript code. It's not perfect as I saw I need to start it multiple times because it reduces only one occurence of multiple spaces each time. Another point is, that "Undefined" appears at the end of the console output - don't know, why this will be displayed.
Code: Select all
function OptimizeBookmark(bkm,depth)
{
if (depth>0 && bkm.name.length>0)
{
bkm.name=bkm.name.trim().replace(/ {2,}/," ");
var z=bkm.name.substring(0,1);
console.println(z+": "+bkm.name);
}
if (bkm.children != null)
for (var i = 0; i < bkm.children.length; i++)
OptimizeBookmark(bkm.children[i],depth+1);
}
console.clear(); console.show();
console.println("Optimizing bookmarks...");
OptimizeBookmark(this.bookmarkRoot,0);
console.println("All done.");