Start work on embedding docs

This commit is contained in:
Austen Adler 2023-03-14 00:23:14 -04:00
parent 90e5ab4643
commit b4c2e09df1
11 changed files with 63 additions and 15 deletions

View File

@ -17,7 +17,7 @@ docs-build:
COPY ./README.adoc docs/index.adoc COPY ./README.adoc docs/index.adoc
COPY --dir ./docs . COPY --dir ./docs .
RUN asciidoctor -r asciidoctor-mathematical -- ./docs/*.adoc RUN asciidoctor -r asciidoctor-mathematical --embedded -- ./docs/*.adoc
RUN \ RUN \
find docs -type f -not -iname '*.html' -not -iname '*.png' -not -iname '*.svg' -delete && \ find docs -type f -not -iname '*.html' -not -iname '*.png' -not -iname '*.svg' -delete && \
: :

View File

@ -7,7 +7,7 @@ include::common.adoc.template[]
The goal of this document is to define the algorithm. The goal of this document is to define the algorithm.
If you want to see the steps to get to this definition, go to link:/docs/DESIGN.html[DESIGN]. If you want to see the steps to get to this definition, go to link:design[DESIGN].
== Data format == Data format

View File

@ -8,7 +8,7 @@ include::common.adoc.template[]
The goal of this document is to walk through how the design was chosen. The goal of this document is to walk through how the design was chosen.
If you want to see the algorithm definition, go to link:/docs/ALGORITHM.html[ALGORITHM]. If you want to see the algorithm definition, go to link:algorithm[ALGORITHM].
== 10,000 meter view == 10,000 meter view
@ -559,7 +559,7 @@ image::./annotated_wordlist_example.png[Screenshot of docs/annotated_words.ods a
==== Wordlist generation ==== Wordlist generation
The final wordlist can be generated by running the scripts in `./wordlist/`, which brings together the full list of words, nltk lemmatized words, and manual annotated words into one list. The final wordlist can be generated by running the scripts in `./wordlist/`, which brings together the full list of words, nltk lemmatized words, and manual annotated words into one list.
See link:WORDLIST.html[WORDLIST] for more information See link:wordlist[WORDLIST] for more information
The output is of the format: The output is of the format:

View File

@ -6,9 +6,9 @@ include::common.adoc.template[]
== Pages == Pages
* link:/docs/ALGORITHM.html[ALGORITHM] - Algorithm definition * link:algorithm[ALGORITHM] - Algorithm definition
* link:/docs/DESIGN.html[DESIGN] - Algorithm design documentation * link:design[DESIGN] - Algorithm design documentation
* link:/docs/WORDLIST.html[WORDLIST] - Wordlist design and implementation * link:wordlist[WORDLIST] - Wordlist design and implementation
++++ ++++
<style> <style>

View File

@ -26,12 +26,12 @@ js-build: output-clean wasm-build docs-build
rsync -ha ./web-frontend/build/ ./build/ rsync -ha ./web-frontend/build/ ./build/
output-clean: output-clean:
rm -vrf ./build/ ./web-frontend/build/ ./web-frontend/static/docs/ rm -vrf ./build/ ./web-frontend/build/ ./web-frontend/src/lib/docs/
mkdir -p ./build/ ./web-frontend/static/docs/ mkdir -p ./build/ ./web-frontend/src/lib/docs/
docs-build: output-clean docs-build: output-clean
earthly +docs earthly +docs
rsync --stats -ha ./build/docs/ ./web-frontend/static/docs/ rsync --stats -ha ./build/docs/ ./web-frontend/src/lib/docs/
cargo doc --all cargo doc --all
# TODO: Clippy # TODO: Clippy

View File

@ -4,8 +4,8 @@
.env.* .env.*
!.env.example !.env.example
node_modules node_modules
/package /package/
/static/docs/ src/lib/docs/
/.svelte-kit /.svelte-kit
vite.config.js.timestamp-* vite.config.js.timestamp-*
vite.config.ts.timestamp-* vite.config.ts.timestamp-*

View File

@ -1,3 +1,5 @@
/src/lib/docs/*
.DS_Store .DS_Store
node_modules node_modules
/build /build

View File

@ -30,10 +30,9 @@
<div class="text-sm"> <div class="text-sm">
<a href="/" class="block inline-block text-white hover:text-gray-500 mr-4 p-2">Home</a> <a href="/" class="block inline-block text-white hover:text-gray-500 mr-4 p-2">Home</a>
<a <a
href="/docs/index.html" href="/docs"
rel="external"
class="block inline-block text-white hover:text-gray-500 mr-4 p-2" class="block inline-block text-white hover:text-gray-500 mr-4 p-2"
data-sveltekit-reload>Docs</a >Docs</a
> >
<a href="/app" class="block inline-block text-white hover:text-gray-500 mr-4 p-2">App</a> <a href="/app" class="block inline-block text-white hover:text-gray-500 mr-4 p-2">App</a>
</div> </div>

View File

@ -0,0 +1,9 @@
<a href="/docs/algorithm" class="block inline-block text-white hover:text-gray-500 mr-4 p-2"
>Algorithm</a
>
<a href="/docs/design" class="block inline-block text-white hover:text-gray-500 mr-4 p-2"
>Design</a
>
<a href="/docs/wordlist" class="block inline-block text-white hover:text-gray-500 mr-4 p-2"
>Wordlist</a
>

View File

@ -0,0 +1,33 @@
import { error } from '@sveltejs/kit';
import algorithmDocs from '$lib/docs/ALGORITHM.html?raw';
import designDocs from '$lib/docs/DESIGN.html?raw';
import wordlistDocs from '$lib/docs/WORDLIST.html?raw';
/** @type {import('./$types').PageLoad} */
export async function load({ params }) {
switch (params.slug) {
case 'algorithm':
return {
content: algorithmDocs
};
break;
case 'design':
return {
content: designDocs
};
break;
case 'wordlist':
return {
content: wordlistDocs
};
break;
default:
console.error(`Slug ${params.slug} not found`);
throw error(404, 'Not found');
}
}
// if (params.slug === 'hello-world') {
// return {
// content: 'Welcome to our blog. Lorem ipsum dolor sit amet...'
// };
// }

View File

@ -0,0 +1,5 @@
<script>
export let data;
</script>
{@html data.content}