From: Raphaƫl Van Dyck Date: Mon, 3 Aug 2026 12:58:38 +0000 (+0200) Subject: make contents browsable X-Git-Url: http://evlambda.org/gitweb/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;p=evlambda.git make contents browsable --- diff --git a/system-files/BIBLIOGRAPHY b/system-files/BIBLIOGRAPHY index 66f1f37..5938c60 100644 --- a/system-files/BIBLIOGRAPHY +++ b/system-files/BIBLIOGRAPHY @@ -6,8 +6,8 @@ Bibliography - +

Bibliography

diff --git a/system-files/IMPLEMENTATION-NOTES b/system-files/IMPLEMENTATION-NOTES index 8e18b05..71dec28 100644 --- a/system-files/IMPLEMENTATION-NOTES +++ b/system-files/IMPLEMENTATION-NOTES @@ -6,8 +6,8 @@ Implementation Notes - +
diff --git a/system-files/LICENSE b/system-files/LICENSE index c9f4f33..ee80fe9 100644 --- a/system-files/LICENSE +++ b/system-files/LICENSE @@ -6,8 +6,8 @@ License - +

License

diff --git a/system-files/REFERENCE-MANUAL b/system-files/REFERENCE-MANUAL index 1330ec3..aa84dd5 100644 --- a/system-files/REFERENCE-MANUAL +++ b/system-files/REFERENCE-MANUAL @@ -6,8 +6,8 @@ Reference Manual - +
diff --git a/system-files/TUTORIAL b/system-files/TUTORIAL index 671efa6..84e4608 100644 --- a/system-files/TUTORIAL +++ b/system-files/TUTORIAL @@ -6,8 +6,8 @@ Tutorial - +

Tutorial

diff --git a/system-files/USER-MANUAL b/system-files/USER-MANUAL index 7064526..40456fc 100644 --- a/system-files/USER-MANUAL +++ b/system-files/USER-MANUAL @@ -6,8 +6,8 @@ User Manual - +

User Manual

diff --git a/system-files/common.js b/system-files/common.js index 08c3efc..804de9c 100644 --- a/system-files/common.js +++ b/system-files/common.js @@ -5,16 +5,17 @@ /* Event Handlers */ /******************/ -window.addEventListener('focus', event => { - window.parent.dispatchEvent(new CustomEvent('iframeFocus', {detail: windowId})); -}); - -window.addEventListener('keydown', event => { - if (event.ctrlKey && (event.altKey || event.metaKey)) { - window.parent.dispatchEvent(new CustomEvent('iframeKeyDown', {detail: event})); - event.preventDefault(); - } -}); +if (windowId !== -1) { + window.addEventListener('focus', event => { + window.parent.dispatchEvent(new CustomEvent('iframeFocus', {detail: windowId})); + }); + window.addEventListener('keydown', event => { + if (event.ctrlKey && (event.altKey || event.metaKey)) { + window.parent.dispatchEvent(new CustomEvent('iframeKeyDown', {detail: event})); + event.preventDefault(); + } + }); +} /***********/ /* MathJax */ diff --git a/system-files/evl2html.xslt b/system-files/evl2html.xslt index 9e47cdf..5e9f216 100644 --- a/system-files/evl2html.xslt +++ b/system-files/evl2html.xslt @@ -16,8 +16,8 @@ - +

diff --git a/webpack.config.js b/webpack.config.js index 0d7b6c3..dd459a3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -30,6 +30,83 @@ class ArchiveSystemFilesWebpackPlugin { } } +class PublishSystemFilesWebpackPlugin { + apply(compiler) { + compiler.hooks.done.tap( + 'Publish System Files Webpack Plugin', + (stats) => { + if (['production'].includes(stats.compilation.options.mode)) { + writeTOC(); + } + } + ); + } +} + +function copySystemFile(filename) { + fs.copyFileSync( + path.join(__dirname, 'system-files', filename), + path.join(__dirname, 'ide', 'contents', filename) + ); +} + +function writePreamble(stream, iframe) { + stream.write(''); + stream.write(''); + stream.write(''); + stream.write(''); + stream.write(''); + stream.write(''); + stream.write('
'); + stream.write(''); + stream.write(''); + if (iframe) { + stream.write('
'); + } else { + stream.write('
'); + } +} + +function writePostamble(stream) { + stream.write('
'); + stream.write(''); + stream.write('
'); + stream.write(''); + stream.write(''); +} + +function writeTOC() { + fs.mkdirSync(path.join(__dirname, 'ide', 'contents')); + copySystemFile('common.css'); + copySystemFile('common.js'); + const stream = fs.createWriteStream(path.join(__dirname, 'ide', 'contents', 'toc.php')); + writePreamble(stream); + stream.write('
    '); + addTOCEntry(stream, 'USER-MANUAL'); + addTOCEntry(stream, 'TUTORIAL'); + addTOCEntry(stream, 'REFERENCE-MANUAL'); + addTOCEntry(stream, 'IMPLEMENTATION-NOTES'); + addTOCEntry(stream, 'BIBLIOGRAPHY'); + addTOCEntry(stream, 'LICENSE'); + stream.write('
'); + writePostamble(stream); + stream.end(); +} + +function addTOCEntry(tocStream, filename) { + let contents = fs.readFileSync(path.join(__dirname, 'system-files', filename), {encoding: 'utf8'}); + contents = contents.replaceAll('___cssURL___', 'common.css'); + contents = contents.replaceAll('___jsURL___', 'common.js'); + contents = contents.replaceAll('___windowId___', -1); + fs.writeFileSync(path.join(__dirname, 'ide', 'contents', filename + '.html'), contents); + const stream = fs.createWriteStream(path.join(__dirname, 'ide', 'contents', filename + '.php')); + writePreamble(stream, true); + stream.write(``); + writePostamble(stream); + stream.end(); + tocStream.write(`
  • ${filename}
  • `); +} + class GenerateBOMWebpackPlugin { apply(compiler) { compiler.hooks.done.tap( @@ -189,6 +266,7 @@ export default { ] }), new ArchiveSystemFilesWebpackPlugin(), + new PublishSystemFilesWebpackPlugin(), new GenerateBOMWebpackPlugin() ], mode: 'development'