diff --git a/website/docs/plugins/extras.html b/website/docs/plugins/extras.html index a13b288..403ccdb 100644 --- a/website/docs/plugins/extras.html +++ b/website/docs/plugins/extras.html @@ -19,7 +19,7 @@
The Extras plugin will initialize the optional addon plugins from -extras/ directory, if they were loaded.
+extras/ directory, if they were loaded.Generally, for an extras plugin to have been loaded, 2 things must have happened:
Element attribut title is used for select option content if available, it uses element id if no title is provided.
The navigation controls are visible if the toolbar plugin is enabled. To add the toolbar to your -presentations, see toolbar plugin README.
+presentations, see toolbar plugin README.Henrik Ingo (@henrikingo), 2016
rel.js plugin completely. You can either:
Remove rel.js from /build.js and recompile impress.js with: npm build
Remove rel.js from /build.js and recompile impress.js with: npm build
Just open [/js/impress.js] in an editor and delete the rel.js code.
If you're writing a plugin and would like to add a widget to the toolbar, see -the top of the source file for further instructions.
+the top of the source file for further instructions.Henrik Ingo (@henrikingo), 2016
diff --git a/website/docs/src/build.js b/website/docs/src/build.js index 07f35f1..3a1d1e9 100644 --- a/website/docs/src/build.js +++ b/website/docs/src/build.js @@ -29,8 +29,7 @@ for ( let item in plugins ) { parseJS( path.join( pluginsPath + '/' + plugins[item] ) ); } else { let html = md2html.render( '' + data ); - findLinks( html, path.join( pluginsPath + '/' + plugins[item] + '/README.md' ) ); - storeHTML( html, plugins[item] ); + storeHTML( findLinks( html, path.join( pluginsPath + '/' + plugins[item] ) ), plugins[item] ); }; } ); } @@ -44,33 +43,63 @@ function parseJS ( filepath ) { } function findLinks ( html, path ) { + let returnHTML = html; for ( let letter in html ) { if ( html[letter] === '<' ) { if ( html.slice( parseInt( letter ), parseInt( letter ) + 9 ) === ''; + } else if ( link.slice( 0, 2 ) === '..' ) { + // here we map the relative path to an absolute path that can be used with the GitHub repo. + while ( link.slice( pos, pos + 3 ) === '../' ) { + pos += 3; + let pathPos = 1; + while ( filepath.slice( parseInt( filepath.length ) - pathPos, parseInt( filepath.length ) - pathPos + 1 ) !== '/' ) { + pathPos += 1; }; - } else if ( link.slice( 0, 1 ) !== '.' && link.slice( 0, 1 ) !== '/' ) { - console.log( 'relative path in same folder' ); - } else { - throw Error( 'Invalid link found! Link is: "' + link + '" in file: ' + path ); - } + filepath = filepath.slice( 0, parseInt( filepath.length ) - pathPos + 1 ); + }; + + // Here we find the impress.js root in the filepath to remove it and finish the link generation + let fsPos = 0; + while ( filepath.slice( parseInt( filepath.length ) - fsPos - 10, parseInt( filepath.length ) - fsPos ) !== 'impress.js' ) { + fsPos += 1; + }; + let fpSlice = filepath.slice( parseInt( filepath.length ) - fsPos, parseInt( filepath.length ) ); + let linkSlice = link.slice( pos, link.length ); + + // now let's assemble a link and add it back into the html + return ''; + } else if ( link.slice( 0, 1 ) !== '.' && link.slice( 0, 1 ) !== '/' ) { + let fsPos = 0; + while ( filepath.slice( parseInt( filepath.length ) - fsPos - 10, parseInt( filepath.length ) - fsPos ) !== 'impress.js' ) { + fsPos += 1; + }; + let fpSlice = filepath.slice( parseInt( filepath.length ) - fsPos, parseInt( filepath.length ) ); + return ''; + } else if ( link.slice( 0, 7 ) === 'http://' || link.slice( 0, 8 ) === 'https://' ) { + console.log( 'hi' ); + return ''; + } else { + throw Error( 'Invalid link found! Link is: "' + link + '" in file: ' + filepath + '/README.md' ); }; };