fix links

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

View file

@ -14,14 +14,14 @@ Walter Higgins
* [The lib directory](#the-lib-directory)
* [plugins sub-directories](#plugins-sub-directories)
* [Global variables](#global-variables)
* [__plugin variable](#plugin-variable)
* [__plugin variable](#__plugin-variable)
* [server variable](#server-variable)
* [self variable](#self-variable)
* [config variable](#config-variable)
* [events variable](#events-variable)
* [Module variables](#module-variables)
* [__filename variable](#filename-variable)
* [__dirname variable](#dirname-variable)
* [__filename variable](#__filename-variable)
* [__dirname variable](#__dirname-variable)
* [Global functions](#global-functions)
* [echo function](#echo-function)
* [require() function](#require-function)
@ -99,7 +99,7 @@ Walter Higgins
* [Drone.sphere0() method](#dronesphere0-method)
* [Drone.hemisphere() method](#dronehemisphere-method)
* [Drone.hemisphere0() method](#dronehemisphere0-method)
* [Drone.spiral_stairs() method](#dronespiralstairs-method)
* [Drone.spiral_stairs() method](#dronespiral_stairs-method)
* [Example Plugin #1 - A simple extension to Minecraft.](#example-plugin-1---a-simple-extension-to-minecraft)
* [Usage:](#usage)
* [Example Plugin #2 - Making extensions available for all players.](#example-plugin-2---making-extensions-available-for-all-players)

View file

@ -13,24 +13,24 @@ while ( (line = br.readLine()) != null){
}
br.close();
var createLink = function(text){
var result = text.replace(/_/g,'_');
result = result.replace(/[^a-zA-Z0-9 _\-]/g,'');
result = result.replace(/ /g,'-');
return result.toLowerCase();
};
println('## Table of Contents');
for (var i = 0; i < contents.length; i++){
line = contents[i];
if (line.match(/^##\s+/)){
var h2 = line.match(/^##\s+(.*)/)[1].trim();
var link = h2.replace(/&#95;/g,'');
link = link.replace(/[^a-zA-Z0-9 \-]/g,'');
link = link.replace(/ /g,'-');
link = link.toLowerCase();
var link = createLink(h2);
println (' * [' + h2 + '](#' + link + ')');
}
if (line.match(/^###\s+/)){
var h3 = line.match(/^###\s+(.*)/)[1].trim();
var link = h3.replace(/&#95;/g,'');
link = link.replace(/[^a-zA-Z0-9 \-]/g,'');
var link = link.replace(/ /g,'-');
link = link.toLowerCase();
var link = createLink(h3);
println (' * [' + h3 + '](#' + link + ')');
}
}