problems with links in toc

This commit is contained in:
walterhiggins 2014-01-04 20:17:49 +00:00
parent d742c5ae44
commit 5239709fcf
2 changed files with 4 additions and 4 deletions

View file

@ -20,8 +20,8 @@ Walter Higgins
* [config variable](#config-variable)
* [events variable](#events-variable)
* [Module variables](#module-variables)
* [__filename variable](#9595filename-variable)
* [__dirname variable](#9595dirname-variable)
* [__filename variable](#filename-variable)
* [__dirname variable](#dirname-variable)
* [Global functions](#global-functions)
* [echo function](#echo-function)
* [require() function](#require-function)

View file

@ -19,7 +19,7 @@ for (var i = 0; i < contents.length; i++){
line = contents[i];
if (line.match(/^##\s+/)){
var h2 = line.match(/^##\s+(.*)/)[1].trim();
var link = '' + java.net.URLDecoder.decode(h2,"UTF-8");
var link = h2.replace(/&#95;/g,'');
link = link.replace(/[^a-zA-Z0-9 \-]/g,'');
link = link.replace(/ /g,'-');
link = link.toLowerCase();
@ -27,7 +27,7 @@ for (var i = 0; i < contents.length; i++){
}
if (line.match(/^###\s+/)){
var h3 = line.match(/^###\s+(.*)/)[1].trim();
var link = '' + java.net.URLDecoder.decode(h3,"UTF-8");
var link = h3.replace(/&#95;/g,'');
link = link.replace(/[^a-zA-Z0-9 \-]/g,'');
var link = link.replace(/ /g,'-');
link = link.toLowerCase();