diff --git a/docs/ucode.css b/docs/ucode.css index 966228a6..5787ae75 100644 --- a/docs/ucode.css +++ b/docs/ucode.css @@ -1,34 +1,3 @@ -#sidebar > .sidebar-items-container { - margin-top: 1rem; -} - -h1 { - display: flex; -} - -h3[id].name:not(h2 + h3) { - margin-top: 2.5rem; - border-top: 1px solid #292929; - padding-top: 1.5rem; -} - -h3[id].name:not(h2 + h3) .link-anchor { - top: 1.5rem; -} - -.light h3[id].name { - border-color: #ccc; -} - -html body { - line-height: 1.5; -} - -article .description > ul, -article .description > ol { - list-style: initial; -} - .navbar-item.github-home a { background-image: url("data:image/svg+xml,%3Csvg width='98' height='96' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z' fill='%2324292f'/%3E%3C/svg%3E"); background-repeat: no-repeat; @@ -36,66 +5,3 @@ article .description > ol { background-position: 1rem center; padding-left: 3rem; } - -section table td:first-child, -section .params td:first-child, -section table thead th:first-child, -section .params thead th:first-child, -section .props thead th:first-child { - border-top-left-radius: .5rem; - border-bottom-left-radius: .5rem; -} - -section table td:last-child, -section .params td:last-child, -section table thead th:last-child, -section .params thead th:last-child, -section .props thead th:last-child { - border-top-right-radius: .5rem; - border-bottom-right-radius: .5rem; -} - -section .params td, -section .params th, -section .props td, -section .props th, -section th, -section td, -section .details .details-item-container { - padding: .5rem 1rem; -} - -section ul, -section ol { - padding-left: 1.5rem; -} - -section ul li, -section ol li { - padding: .25rem 0; -} - -section p { - margin: .75rem 0; -} - -section .details { - border-radius: .5rem; -} - -section .pre-div { - margin: 1rem 0; - border-radius: .5rem; -} - -.param-type { - font-family: "code"; -} - -.signature-attributes { - font-variant: sub; -} - -.method-member-container > strong + dl.param-type > dt { - display: none; -} diff --git a/docs/ucode.js b/docs/ucode.js deleted file mode 100644 index 2377c7ed..00000000 --- a/docs/ucode.js +++ /dev/null @@ -1,39 +0,0 @@ -document.addEventListener('DOMContentLoaded', (ev) => { - const accordionState = window.localStorage.getItem('accordion-id'); - - if (accordionState == null || accordionState == '{}') - document.querySelectorAll('[data-isopen="false"]') - .forEach(item => item.setAttribute('data-isopen', 'true')); - - const moduleName = location.pathname.match(/\/module-(.+)\.html$/)?.[1]; - - if (moduleName) { - const modulePrefix = `module:${moduleName}.`; - - document.querySelectorAll(`a[href^="module-${CSS.escape(moduleName)}."]`).forEach(a => { - if (a.text?.indexOf(modulePrefix) == 0) - a.text = a.text.substring(modulePrefix.length); - }); - } - - document.querySelectorAll('.param-type, .type-signature').forEach(span => { - let replaced; - do { - replaced = false; - span.innerHTML = span.innerHTML.replace(/\b(Object|Array)\.<((?:(?!&[lg]t;).)+)>/, - (m, t, st) => { - replaced = true; - - if (t == 'Object') - return `Object<${st.replace(/,\s*/, ': ')}>`; - else - return `${st}[]`; - }); - } while (replaced); - }); - - document.querySelectorAll('.type-signature').forEach(span => { - span.innerHTML = span.innerHTML.replace(/\(nullable\) (.+)$/, - '$1nullable'); - }); -}); diff --git a/jsdoc/c-transpiler.js b/jsdoc/c-transpiler.js index 55bc6178..3360c7e0 100644 --- a/jsdoc/c-transpiler.js +++ b/jsdoc/c-transpiler.js @@ -18,6 +18,20 @@ 'use strict'; +function isCommentStart(source, offset) { + if (source[offset++] != '\n') + return false; + + while (source[offset] == ' ' || source[offset] == '\t') + offset++; + + return ( + source[offset++] == '/' && + source[offset++] == '*' && + source[offset++] == '*' + ); +} + exports.handlers = { beforeParse: function(e) { if (!e.filename.match(/\.(c|h)$/)) @@ -28,7 +42,7 @@ exports.handlers = { let i = 0; for (i = 0; i < e.source.length; i++) { - if (!chunk.comment && e.source[i] == '\n' && e.source[i+1] == '/' && e.source[i+2] == '*' && e.source[i+3] == '*') { + if (!chunk.comment && isCommentStart(e.source, i)) { chunk.end = i; chunk = { start: i, end: -1, comment: true }; chunks.push(chunk); diff --git a/jsdoc/conf.json b/jsdoc/conf.json index e1487eb3..3a52e8fd 100644 --- a/jsdoc/conf.json +++ b/jsdoc/conf.json @@ -26,7 +26,7 @@ "idInHeadings": true }, "opts": { - "template": "node_modules/clean-jsdoc-theme", + "template": "node_modules/ucode-jsdoc-theme", "destination": "docs", "recurse": true, "readme": "docs/README.md", @@ -41,9 +41,6 @@ "include_css": [ "docs/ucode.css" ], - "include_js": [ - "docs/ucode.js" - ], "menu": [ { "title": "GitHub Project Page", diff --git a/package.json b/package.json index b52247fa..04c74716 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "doc": "LC_ALL=C jsdoc -c jsdoc/conf.json" }, "devDependencies": { - "clean-jsdoc-theme": "^4.2.9", + "ucode-jsdoc-theme": "https://github.com/jow-/ucode-jsdoc-theme.git", "jsdoc": "^4.0.2" } }