better build script

This commit is contained in:
2023-02-02 17:59:52 +01:00
parent 54838a64f2
commit abfdebf43b
6 changed files with 53 additions and 8 deletions

View File

@@ -13,7 +13,7 @@
<a class="navitem" id="gettingStarted" href="/docs/gettingStarted.html">Getting Started</a> <a class="navitem" id="gettingStarted" href="/docs/gettingStarted.html">Getting Started</a>
<a class="navitem" id="referenceNav" onclick="toggleList( 'reference' );">API reference</a> <a class="navitem" id="referenceNav" onclick="toggleList( 'reference' );">API reference</a>
<div class="dropdown" id="reference"> <div class="dropdown" id="reference">
<a class="nav-subitem" id="root" href="/docs/reference">Home</a><a class="nav-subitem" id="CSS.html" href="/docs/reference/CSS.html.html">CSS.html</a><a class="nav-subitem" id="HTML.html" href="/docs/reference/HTML.html.html">HTML.html</a><a class="nav-subitem" id="JavaScript.html" href="/docs/reference/JavaScript.html.html">JavaScript.html</a><a class="nav-subitem" id="Plugins.html" href="/docs/reference/Plugins.html.html">Plugins.html</a></div> <a class="nav-subitem" id="root" href="/docs/reference">Home</a><a class="nav-subitem" id="CSS.html" href="/docs/reference/CSS.html">CSS.html</a><a class="nav-subitem" id="HTML.html" href="/docs/reference/HTML.html">HTML.html</a><a class="nav-subitem" id="JavaScript.html" href="/docs/reference/JavaScript.html">JavaScript.html</a><a class="nav-subitem" id="Plugins.html" href="/docs/reference/Plugins.html">Plugins.html</a></div>
<a class="navitem" id="pluginsNav" onclick="toggleList( 'plugins' );">Plugins</a> <a class="navitem" id="pluginsNav" onclick="toggleList( 'plugins' );">Plugins</a>
<div class="dropdown" id="plugins"> <div class="dropdown" id="plugins">
<a class="nav-subitem" id="autoplay" href="/docs/plugins/autoplay.html">autoplay</a><a class="nav-subitem" id="blackout" href="/docs/plugins/blackout.html">blackout</a><a class="nav-subitem" id="extras" href="/docs/plugins/extras.html">extras</a><a class="nav-subitem" id="form" href="/docs/plugins/form.html">form</a><a class="nav-subitem" id="fullscreen" href="/docs/plugins/fullscreen.html">fullscreen</a><a class="nav-subitem" id="goto" href="/docs/plugins/goto.html">goto</a><a class="nav-subitem" id="help" href="/docs/plugins/help.html">help</a><a class="nav-subitem" id="impressConsole" href="/docs/plugins/impressConsole.html">impressConsole</a><a class="nav-subitem" id="media" href="/docs/plugins/media.html">media</a><a class="nav-subitem" id="mobile" href="/docs/plugins/mobile.html">mobile</a><a class="nav-subitem" id="mouse-timeout" href="/docs/plugins/mouse-timeout.html">mouse-timeout</a><a class="nav-subitem" id="navigation" href="/docs/plugins/navigation.html">navigation</a><a class="nav-subitem" id="navigation-ui" href="/docs/plugins/navigation-ui.html">navigation-ui</a><a class="nav-subitem" id="progress" href="/docs/plugins/progress.html">progress</a><a class="nav-subitem" id="rel" href="/docs/plugins/rel.html">rel</a><a class="nav-subitem" id="resize" href="/docs/plugins/resize.html">resize</a><a class="nav-subitem" id="skip" href="/docs/plugins/skip.html">skip</a><a class="nav-subitem" id="stop" href="/docs/plugins/stop.html">stop</a><a class="nav-subitem" id="substep" href="/docs/plugins/substep.html">substep</a><a class="nav-subitem" id="toolbar" href="/docs/plugins/toolbar.html">toolbar</a><a class="nav-subitem" id="touch" href="/docs/plugins/touch.html">touch</a></div> <a class="nav-subitem" id="autoplay" href="/docs/plugins/autoplay.html">autoplay</a><a class="nav-subitem" id="blackout" href="/docs/plugins/blackout.html">blackout</a><a class="nav-subitem" id="extras" href="/docs/plugins/extras.html">extras</a><a class="nav-subitem" id="form" href="/docs/plugins/form.html">form</a><a class="nav-subitem" id="fullscreen" href="/docs/plugins/fullscreen.html">fullscreen</a><a class="nav-subitem" id="goto" href="/docs/plugins/goto.html">goto</a><a class="nav-subitem" id="help" href="/docs/plugins/help.html">help</a><a class="nav-subitem" id="impressConsole" href="/docs/plugins/impressConsole.html">impressConsole</a><a class="nav-subitem" id="media" href="/docs/plugins/media.html">media</a><a class="nav-subitem" id="mobile" href="/docs/plugins/mobile.html">mobile</a><a class="nav-subitem" id="mouse-timeout" href="/docs/plugins/mouse-timeout.html">mouse-timeout</a><a class="nav-subitem" id="navigation" href="/docs/plugins/navigation.html">navigation</a><a class="nav-subitem" id="navigation-ui" href="/docs/plugins/navigation-ui.html">navigation-ui</a><a class="nav-subitem" id="progress" href="/docs/plugins/progress.html">progress</a><a class="nav-subitem" id="rel" href="/docs/plugins/rel.html">rel</a><a class="nav-subitem" id="resize" href="/docs/plugins/resize.html">resize</a><a class="nav-subitem" id="skip" href="/docs/plugins/skip.html">skip</a><a class="nav-subitem" id="stop" href="/docs/plugins/stop.html">stop</a><a class="nav-subitem" id="substep" href="/docs/plugins/substep.html">substep</a><a class="nav-subitem" id="toolbar" href="/docs/plugins/toolbar.html">toolbar</a><a class="nav-subitem" id="touch" href="/docs/plugins/touch.html">touch</a></div>

View File

@@ -49,7 +49,7 @@
opacity: 1 opacity: 1
} }
</code></pre> </code></pre>
<p>At the same time, the <code>impress-on-*</code> class is added to the body element, the class name represents the active <a href="#step-element">Step Element</a> id. This allows for custom global styling, since you can't match a CSS class backwards from the active <a href="#step-element">Step Element</a> to the <code>body</code>.</p> <p>At the same time, the <code>impress-on-*</code> class is added to the body element, the class name represents the active <a href="#step-element">Step Element</a> id. This allows for custom global styling, since you can't match a CSS class backwards from the active <a href="#step-elementStep Element</a> to the <code>body</code>.</p>
<p><strong>Example:</strong></p> <p><strong>Example:</strong></p>
<pre><code class="language-CSS">.impress-on-overview .step { <pre><code class="language-CSS">.impress-on-overview .step {
opacity: 1; opacity: 1;

View File

@@ -184,7 +184,7 @@ the value of the previous slide. This means, you need to explicitly set these va
</code></pre> </code></pre>
<h4>3D Rotation Order (data-rotate-order)</h4> <h4>3D Rotation Order (data-rotate-order)</h4>
<p>The order in which the CSS <code>rotateX(), rotateY(), rotateZ()</code> transforms are applied matters. This is because each rotation is relative to the then current position of the element.</p> <p>The order in which the CSS <code>rotateX(), rotateY(), rotateZ()</code> transforms are applied matters. This is because each rotation is relative to the then current position of the element.</p>
<p>By default the rotation order is <code>data-rotate-order=&quot;xyz&quot;</code>. For some advanced uses you may need to change it. The demo presentation <a href="examples/3D-rotations/index.html">3D rotations</a> sets this attribute to rotate some steps into positions that are impossible to reach with the default order.</p> <p>By default the rotation order is <code>data-rotate-order=&quot;xyz&quot;</code>. For some advanced uses you may need to change it. The demo presentation <a href="/demo/examples/3D-rotations/index.html3D rotations</a> sets this attribute to rotate some steps into positions that are impossible to reach with the default order.</p>
</div> </div>
</div> </div>
<div id="footer"></div> <div id="footer"></div>

View File

@@ -104,7 +104,7 @@ rootElement.addEventListener( &quot;impress:stepleave&quot;, function(event) {
}); });
</code></pre> </code></pre>
<h1>Improve The Docs</h1> <h1>Improve The Docs</h1>
<p>Did you find something that can be improved? Then <a href="https://github.com/impress/impress.js/issues/new">create an issue</a> so that we can discuss it!</p> <p>Did you find something that can be improved? Then <a href="https://github.com/impress/impress.js/issues/newcreate an issue</a> so that we can discuss it!</p>
</div> </div>
</div> </div>
<div id="footer"></div> <div id="footer"></div>

View File

@@ -18,7 +18,7 @@
<div id="docPage"> <div id="docPage">
<div id="doc-container"> <div id="doc-container">
<h2>Plugins</h2> <h2>Plugins</h2>
<p>Many new features are implemented as plugins. The <a href="src/plugins/README.md">Plugins documentation</a> is the starting place to learn about those, as well as the README.md of <a href="src/plugins/">each plugin</a>.</p> <p>Many new features are implemented as plugins. The <a href="src/plugins/README.md">Plugins documentation</a> is the starting place to learn about those, as well as the README.md of <a href="https://github.com/impress/impress.js/src/plugins/each plugin</a>.</p>
</div> </div>
</div> </div>
<div id="footer"></div> <div id="footer"></div>

View File

@@ -122,6 +122,10 @@ function checkLinks ( link, fpath ) {
}; };
}; };
/*
This function generates & stores the HTML in the correct directory
*/
function storeHTML ( html, path, type ) { function storeHTML ( html, path, type ) {
let fileOut = `<!DOCTYPE html> let fileOut = `<!DOCTYPE html>
<html> <html>
@@ -152,7 +156,9 @@ function storeHTML ( html, path, type ) {
fs.writeFileSync( docRoot + '/' + type + '/' + path + '.html', fileOut ); fs.writeFileSync( docRoot + '/' + type + '/' + path + '.html', fileOut );
}; };
/*
This function, as the name implies, generates the navbar on the side in the docs.
*/
function generateNav () { function generateNav () {
let fileStruct = `<!DOCTYPE html> let fileStruct = `<!DOCTYPE html>
<html> <html>
@@ -171,7 +177,7 @@ function generateNav () {
<div class="dropdown" id="reference"> <div class="dropdown" id="reference">
<a class="nav-subitem" id="root" href="/docs/reference">Home</a>` <a class="nav-subitem" id="root" href="/docs/reference">Home</a>`
for ( let item in docPages ) { for ( let item in docPages ) {
fileStruct += `<a class="nav-subitem" id="${ docPages[item] }" href="/docs/reference/${ docPages[item] }.html">${ docPages[item] }</a>`; fileStruct += `<a class="nav-subitem" id="${ docPages[item] }" href="/docs/reference/${ docPages[item] }">${ docPages[item] }</a>`;
}; };
fileStruct += `</div> fileStruct += `</div>
<a class="navitem" id="pluginsNav" onclick="toggleList( 'plugins' );">Plugins</a> <a class="navitem" id="pluginsNav" onclick="toggleList( 'plugins' );">Plugins</a>
@@ -217,6 +223,45 @@ function parseDocumentationMD () {
break; break;
}; };
}; };
storeHTML( md2html.render( doc.slice( parseInt( posArray[parseInt( item )] ), parseInt( posArray[parseInt( item ) + 1] ) || parseInt( doc.length ) ) ), title, 'reference' );
let page = md2html.render( doc.slice( parseInt( posArray[parseInt( item )] ), parseInt( posArray[parseInt( item ) + 1] ) || parseInt( doc.length ) ) );
let updatedPage = page;
for ( let letter in page ) {
if ( page[letter] === '<' ) {
if ( page.slice( parseInt( letter ), parseInt( letter ) + 9 ) === '<a href="' ) {
let i = 9;
while ( page.slice( parseInt( letter ) + i, parseInt( letter ) + i + 1 ) !== '"' ) {
i += 1;
};
let link = '' + page.slice( parseInt( letter ) + 9, parseInt( letter ) + i );
let updatedLink = '';
if ( link.slice( 0, 8 ) === 'https://' || link.slice( 0, 7 ) === 'http://' || link.slice( 0, 1 ) === '#' ) {
updatedLink = link;
} else {
if ( link.slice( 0, 12 ) === 'src/plugins/' ) {
if ( link.slice( link.length - 9, link.length ) === 'README.md' ) {
updatedLink = '/docs/' + link.slice( 4, link.length - 9 );
} else {
updatedLink = 'https://github.com/impress/impress.js/' + link;
}
} else if ( link.slice( 0, 9 ) === 'examples/' ) {
updatedLink = '/demo/' + link;
} else {
updatedLink = 'https://github.com/impress/impress.js/' + link;
};
console.log( updatedLink + ' at: ' + posArray[item] );
updatedPage = page.slice( 0, parseInt( letter ) + 9 ) + updatedLink + page.slice( parseInt( letter ) + i + 2, parseInt( page.length ) );
}
} else if ( page.slice( parseInt( letter ), parseInt( letter ) + 4 ) === '<h1>' ) {
let i = 9;
while ( page.slice( parseInt( letter ) + i, parseInt( letter ) + i + 1 ) !== '<' ) {
i += 1;
};
let heading = '' + page.slice( parseInt( letter ) + 9, parseInt( letter ) + i );
}
};
storeHTML( updatedPage, title, 'reference' );
}
} }
} }