wiki

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit a1fe525ffd4d7114a72f21bdb18a3f6ac2a0b53b
parent ae2457d3986dc3d704b73227c40e968d191beb21
Author: al1-ce <al1-ce@null.net>
Date:   Wed, 13 Aug 2025 09:20:54 +0300

redo how pages work

Diffstat:
Mindex-pages.sh | 8++++----
Mindex.js | 15+++++++++++++--
Mpublic/all_pages.md | 11++++++-----
Mpublic/index.html | 8+++++---
Mpublic/index.md | 2+-
Rpublic/meta/maintenance.md -> public/m/maintenance.md | 0
Apublic/m/markdown_flavour.md | 48++++++++++++++++++++++++++++++++++++++++++++++++
Rpublic/meta/options.md -> public/m/options.md | 0
Rpublic/meta/style_guidelines.md -> public/m/style_guidelines.md | 0
Apublic/m/style_test.md | 165+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dpublic/meta/markdown_flavour.md | 48------------------------------------------------
Dpublic/meta/style_test.md | 166-------------------------------------------------------------------------------
Rpublic/wiki/aa.md -> public/w/aa.md | 0
Rpublic/wiki/ayashii_world.md -> public/w/ayashii_world.md | 0
Rpublic/wiki/html_entities.md -> public/w/html_entities.md | 0
Apublic/w/html_furigana.md | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rpublic/wiki/japanese_onomatopeia.md -> public/w/japanese_onomatopeia.md | 0
Rpublic/wiki/kagai_nihongo.md -> public/w/kagai_nihongo.md | 0
Rpublic/wiki/kana_sounds.md -> public/w/kana_sounds.md | 0
Rpublic/wiki/make.md -> public/w/make.md | 0
Rpublic/wiki/oekaki.md -> public/w/oekaki.md | 0
Rpublic/wiki/recursion.md -> public/w/recursion.md | 0
Rpublic/wiki/vim_digraphs.md -> public/w/vim_digraphs.md | 0
Rpublic/wiki/web_browsers.md -> public/w/web_browsers.md | 0
Dpublic/wiki/html_furigana.md | 81-------------------------------------------------------------------------------
25 files changed, 323 insertions(+), 310 deletions(-)

diff --git a/index-pages.sh b/index-pages.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -WIKI_PAGES="$(ls public/wiki --color=never -1 | grep ".md")" -WIKI_PAGES="$(echo "$WIKI_PAGES" | sed -r 's|(.*)\.md$|[\1](wiki/\0)|')" +WIKI_PAGES="$(ls public/w --color=never -1 | grep ".md")" +WIKI_PAGES="$(echo "$WIKI_PAGES" | sed -r 's|(.*)\.md$|[\1](w/\0)|')" -META_PAGES="$(ls public/meta --color=never -1 | grep ".md")" -META_PAGES="$(echo "$META_PAGES" | sed -r 's|(.*)\.md$|[\1](meta/\0)|')" +META_PAGES="$(ls public/m --color=never -1 | grep ".md")" +META_PAGES="$(echo "$META_PAGES" | sed -r 's|(.*)\.md$|[\1](m/\0)|')" PAGES="$(echo -e "[index](/)\n$WIKI_PAGES\n$META_PAGES")" diff --git a/index.js b/index.js @@ -12,8 +12,15 @@ app.use(express.static( path.join(__dirname, "public"), { extensions: ["html", " // app.get("/", (req, res) => res.send("Express test")); +function startsWithAny(path, arr) { + for (let i = 0; i < arr.length; ++i) { + if (path.startsWith(arr[i])) return true; + } + return false; +} + app.all("*", (req, res) => { - let mdpath = path.join(__dirname, "public", req.baseUrl + req.path + ".md"); + // let mdpath = path.join(__dirname, "public", req.baseUrl + req.path + ".md"); // console.log(mdpath); // res.status(404).send( @@ -23,7 +30,11 @@ app.all("*", (req, res) => { // " " + mdpath + // " " + (fs.existsSync(mdpath) ? "true" : "false") // ); - if (fs.existsSync(mdpath)) { + + // reroutes wiki pages to index to show 404 + // does not reroute wiki pages markdown files + // does not reroute non-wiki pages + if (startsWithAny(req.path, ["/w/", "/m/"]) && !req.path.endsWith(".md")) { res.sendFile(path.join(__dirname, "public/index.html")); } else { res.status(404).sendFile(path.join(__dirname, "public/404.html")); diff --git a/public/all_pages.md b/public/all_pages.md @@ -1,7 +1,8 @@ |||| |:-|:-|:-| -|[aa](wiki/aa.md)|[kagai_nihongo](wiki/kagai_nihongo.md)|[recursion](wiki/recursion.md)| -|[html_entities](wiki/html_entities.md)|[kana_sounds](wiki/kana_sounds.md)|[style_guidelines](meta/style_guidelines.md)| -|[html_furigana](wiki/html_furigana.md)|[maintenance](meta/maintenance.md)|[style_test](meta/style_test.md)| -|[index](/)|[markdown_flavour](meta/markdown_flavour.md)|[vim_digraphs](wiki/vim_digraphs.md)| -|[japanese_onomatopeia](wiki/japanese_onomatopeia.md)|[options](meta/options.md)|[web_browsers](wiki/web_browsers.md)| +|[aa](w/aa.md)|[kagai_nihongo](w/kagai_nihongo.md)|[options](m/options.md)| +|[ayashii_world](w/ayashii_world.md)|[kana_sounds](w/kana_sounds.md)|[recursion](w/recursion.md)| +|[html_entities](w/html_entities.md)|[maintenance](m/maintenance.md)|[style_guidelines](m/style_guidelines.md)| +|[html_furigana](w/html_furigana.md)|[make](w/make.md)|[style_test](m/style_test.md)| +|[index](/)|[markdown_flavour](m/markdown_flavour.md)|[vim_digraphs](w/vim_digraphs.md)| +|[japanese_onomatopeia](w/japanese_onomatopeia.md)|[oekaki](w/oekaki.md)|[web_browsers](w/web_browsers.md)| diff --git a/public/index.html b/public/index.html @@ -279,6 +279,7 @@ loadSidebar: true, // logo: "https://avatars.githubusercontent.com/u/60989682?s=48&v=4", hideSidebar: false, + notFoundPage: "_404.md", routerMode: 'history', homepage: 'index.md', loadNavbar: false, // !!!!!!! @@ -394,10 +395,11 @@ // Invoked on each page load after new markdown has been transformed to HTML. // Supports asynchronous tasks (see afterEach documentation for details). // hook.afterEach(function (html) {return html;}); - + // Invoked on each page load after new HTML has been appended to the DOM hook.doneEach(function() { document.title += ' - wiki@al1-ce'; + console.log(vm.route) var urlNew = 'https://github.com/al1-ce/wiki.al1-ce.dev/new/master/public' + getDirname(vm.route.file, '/'); var urlEdit = 'https://github.com/al1-ce/wiki.al1-ce.dev/edit/master/public' + vm.route.file; @@ -409,7 +411,7 @@ let p404_title = document.querySelector("#page-404-title-center"); let p404_create = document.querySelector("#page-404-create-new-article"); - if (p404_title != null) p404_title.innerHTML = `404 - Page "${vm.route.file}" not found.`; + if (p404_title != null) p404_title.innerHTML = `404 - Page "${vm.route.path}" not found.`; if (p404_create != null) p404_create.href = urlNew; let opt_reset_cookies = document.querySelector("#opt-reset-cookies"); @@ -434,7 +436,7 @@ let fg_output = document.getElementById("furigana-output"); let fg_input = document.getElementById("furigana-input"); - + if (fg_input != null && fg_output != null) { function process_furigana() { let t = fg_input.value; diff --git a/public/index.md b/public/index.md @@ -6,4 +6,4 @@ For now you could explore [[All Pages]], which wouldn't be much... ## Important pages -- [[meta/options|Options]] +- [[m/options|Options]] diff --git a/public/meta/maintenance.md b/public/m/maintenance.md diff --git a/public/m/markdown_flavour.md b/public/m/markdown_flavour.md @@ -0,0 +1,48 @@ +# wiki@al1-ce markdown flavour + +This article is a stub and is dependant on [[maintenance]] + +## Wikilinks +- &#91;[Direct Link]] + - links to direct_link article in current directory + - https://wiki.al1-ce.dev/CURRENT_DIR/direct_link +- &#91;[Direct Link|Custom text]] + - same as above but with custom text +- &#91;[Direct Link#Header]] + - same as above but linking to certain header +- &#91;[/m/Style Guidelines|Style Guidelines]] + - same as above but using absolute path + - https://wiki.al1-ce.dev/meta/style_guidelines + +## Inline code +More of a way to colour (TODO add actual color syntax) normal text + +- k - {@k keyword} +- n - {@n number} +- f - {@f function} +- s - {@s string} +- c - {@c comment} +- t - {@t tag} + +Syntax (`\@` replace with `@`) + +```md +{\@k keyword} {\@n 255} +``` + +## Rename Header + +```md +# something header {#replace-with-this-id} + +[link to that header](#replace-with-this-id) +``` + +## Furigana + +See [[/w/html_furigana|HTML furigana]]. + +```md +\\%{furigana(input)} +\\%{furigana(input)\=title} +``` diff --git a/public/meta/options.md b/public/m/options.md diff --git a/public/meta/style_guidelines.md b/public/m/style_guidelines.md diff --git a/public/m/style_test.md b/public/m/style_test.md @@ -0,0 +1,165 @@ +# Style test + +Page to test markdown style and some features. + +## Headers + +# Header 1 + +Some text here + +## Header 2 + +Some text here + +### Header 3 + +Some text here + +#### Header 4 + +Some text here + +##### Header 5 + +Some text here + +###### Header 6 + +Some text here + +Header 1 === +========== + +Header 2 --- +---------- + +## Lists + +Normal list +- Aa +- Bb +- Cc + - Dd + - Ee +- Ff + +Numbered list +1. 123 +2. 456 + 3. 789 +4. 0 + +## Text style + +- bold **bold** bold +- italic *italic* italic +- bold italic **_bold italic_** bold italic +- code `code` code +- striked ~~striked~~ striked +- highlighted ==highlighted== highlighted +- subscript ~sub~script subscript +- superscript ^super^script superscript + +## Lines + +*** + +--- + +___ + +## Blockquotes + +> Paragraph 1 +> +> paragraph 2 +>> double block +> - list item a +> - list item b +> *text* styling in **block** + +## Code blocks + +```md +<!--markdown--> +# Header +``` + +```d +// d +int main(int argc, char **argv) { return 0; } +``` + +## Images + +Markdown image + +![Img thing](../files/images/tega.png) + +HTML image + +<img src="../files/images/tega.png" width="640px" /> + +## Footnotes + +Here's a simple footnote,a[^1] and here's a longer one.[^bignote] + +[^1]: This is the first footnote. + +[^bignote]: bignotezz + +## Links + +- [normal link](/) - normal link +- [[markdown flavour]] - wikilink +- [[/w/recursion|recursion]] - absolute wikilink +- [[https://a.com|a.com]] - external wikilink? +- [ext link][5] `[link][id]` DO NOT USE IT CONFLICTS WITH FOOTNOTES +- <https://wiki.al1-ce.dev> - autolink +- <fake@example.com> - auto email + +[5]: https://wiki.al1-ce.dev + +## Tables + +| Syntax | Description | +| ----------- | ----------- | +| Header | Title | +| Paragraph | Text | + +| Syntax | Description | Test Text | +| :--- | :----: | ---: | +| Header | Title | Here's this | +| Paragraph | Text | And more | + +## Misc + +- [x] done +- [ ] todo + +- Auto-emoji :gun: + +!> Warning + +?> Info + +## Custom + +```aa +AA (Shift JIS) +|     .|\|/ |     |   .| +| ∧∧.|/⌒ヽ、| ∧_∧ .| ∧∧ | +|(,,゚Д゚)||,,゚ Θ゚)|(; ´Д`)|(=゚ω゚)| +``` + +- Furigana \%{this is a(tis is ah) test(test)} \%{今(い)まで。。。}\%{先(せん)生(せい)} test +- Inline style {@k void} {@f main}({@k int} argc, {@k char} **argv) { {@k return} {@n 0}; } {@c //} a {@t FIXME}{@c :} {@s utterly broken} + +## Custom header ID's + +Is an actual extension but was missing from parser so had to implement it myself + +### My Great Heading {#custom-id} +- [Markdown link](#custom-id) +- [[#custom-id|Wiki link]] diff --git a/public/meta/markdown_flavour.md b/public/meta/markdown_flavour.md @@ -1,48 +0,0 @@ -# wiki@al1-ce markdown flavour - -This article is a stub and is dependant on [[maintenance]] - -## Wikilinks -- &#91;[Direct Link]] - - links to direct_link article in current directory - - https://wiki.al1-ce.dev/CURRENT_DIR/direct_link -- &#91;[Direct Link|Custom text]] - - same as above but with custom text -- &#91;[Direct Link#Header]] - - same as above but linking to certain header -- &#91;[/meta/Style Guidelines|Style Guidelines]] - - same as above but using absolute path - - https://wiki.al1-ce.dev/meta/style_guidelines - -## Inline code -More of a way to colour (TODO add actual color syntax) normal text - -- k - {@k keyword} -- n - {@n number} -- f - {@f function} -- s - {@s string} -- c - {@c comment} -- t - {@t tag} - -Syntax (`\@` replace with `@`) - -```md -{\@k keyword} {\@n 255} -``` - -## Rename Header - -```md -# something header {#replace-with-this-id} - -[link to that header](#replace-with-this-id) -``` - -## Furigana - -See [[/wiki/html_furigana|HTML furigana]]. - -```md -\\%{furigana(input)} -\\%{furigana(input)\=title} -``` diff --git a/public/meta/style_test.md b/public/meta/style_test.md @@ -1,165 +0,0 @@ -# Style test - -Page to test markdown style and some features. - -## Headers - -# Header 1 - -Some text here - -## Header 2 - -Some text here - -### Header 3 - -Some text here - -#### Header 4 - -Some text here - -##### Header 5 - -Some text here - -###### Header 6 - -Some text here - -Header 1 === -========== - -Header 2 --- ----------- - -## Lists - -Normal list -- Aa -- Bb -- Cc - - Dd - - Ee -- Ff - -Numbered list -1. 123 -2. 456 - 3. 789 -4. 0 - -## Text style - -- bold **bold** bold -- italic *italic* italic -- bold italic **_bold italic_** bold italic -- code `code` code -- striked ~~striked~~ striked -- highlighted ==highlighted== highlighted -- subscript ~sub~script subscript -- superscript ^super^script superscript - -## Lines - -*** - ---- - -___ - -## Blockquotes - -> Paragraph 1 -> -> paragraph 2 ->> double block -> - list item a -> - list item b -> *text* styling in **block** - -## Code blocks - -```md -<!--markdown--> -# Header -``` - -```d -// d -int main(int argc, char **argv) { return 0; } -``` - -## Images - -Markdown image - -![Img thing](../files/images/tega.png) - -HTML image - -<img src="../files/images/tega.png" width="640px" /> - -## Footnotes - -Here's a simple footnote,a[^1] and here's a longer one.[^bignote] - -[^1]: This is the first footnote. - -[^bignote]: bignotezz - -## Links - -- [normal link](/) - normal link -- [[markdown flavour]] - wikilink -- [[/wiki/recursion|recursion]] - absolute wikilink -- [[https://a.com|a.com]] - external wikilink? -- [ext link][5] `[link][id]` DO NOT USE IT CONFLICTS WITH FOOTNOTES -- <https://wiki.al1-ce.dev> - autolink -- <fake@example.com> - auto email - -[5]: https://wiki.al1-ce.dev - -## Tables - -| Syntax | Description | -| ----------- | ----------- | -| Header | Title | -| Paragraph | Text | - -| Syntax | Description | Test Text | -| :--- | :----: | ---: | -| Header | Title | Here's this | -| Paragraph | Text | And more | - -## Misc - -- [x] done -- [ ] todo - -- Auto-emoji :gun: - -!> Warning - -?> Info - -## Custom - -```aa -AA (Shift JIS) -|     .|\|/ |     |   .| -| ∧∧.|/⌒ヽ、| ∧_∧ .| ∧∧ | -|(,,゚Д゚)||,,゚ Θ゚)|(; ´Д`)|(=゚ω゚)| -``` - -- Furigana \%{this is a(tis is ah) test(test)} \%{今(い)まで。。。}\%{先(せん)生(せい)} test -- Inline style {@k void} {@f main}({@k int} argc, {@k char} **argv) { {@k return} {@n 0}; } {@c //} a {@t FIXME}{@c :} {@s utterly broken} - -## Custom header ID's - -Is an actual extension but was missing from parser so had to implement it myself - -### My Great Heading {#custom-id} -- [Markdown link](#custom-id) -- [[#custom-id|Wiki link]] -\ No newline at end of file diff --git a/public/wiki/aa.md b/public/w/aa.md diff --git a/public/wiki/ayashii_world.md b/public/w/ayashii_world.md diff --git a/public/wiki/html_entities.md b/public/w/html_entities.md diff --git a/public/w/html_furigana.md b/public/w/html_furigana.md @@ -0,0 +1,81 @@ +# HTML furigana + +For providing furigana (kana on top of \%{世界(せかい)}) for kanji or similar style markup `<ruby>`[^1] tag can be used. + +Structure of `<ruby>` tag might seem complicated at first but it's rather simple when you learn what each tag does. + +The above example can be shown as: + +```html +<ruby>世界<rp>(</rp><rt>せかい</rt><rp>)</rp></ruby> +``` + +However it can also be shown as: + +```html +<ruby> + 世界 + <rp>(</rp> + <rt>せかい</rt> + <rp>)</rp> +</ruby> +``` + +Each of lines provides certain function, `<ruby>` tag itself wraps the furigana, `<rp>` tag provides support for legacy browsers to display furigana beside the kanji 世界(せかい) and `<rt>` provides furigana itself. + +If one would want to split furigana between kanji it can be easily done inside a single tag. + +\%{世(せ)界(かい)\=World} + + +```html +<ruby title="World"> + 世 + <rp>(</rp> + <rt>せ</rt> + <rp>)</rp> + 界 + <rp>(</rp> + <rt>かい</rt> + <rp>)</rp> +</ruby> +``` + +## Furigana input (for any reasons) + +How to use (`input` - output): +- text - \%{text} +- text(te) - \%{text(te)} +- text\\(te) - \%{text\(te)} +- text(\\(te)) - \%{text(\(te))} +- text(\\(te\\)) - \%{text(\(te\))\=Notice the escaped second paren} +- text(a)word()after(b) - \%{text(a)word()after(b)} + +<input placeholder="Input text" id="furigana-input" value="世(せ)界(かい)"></input> + +<p id="furigana-output"></p> + +<style> + #furigana-output { + text-align: center; + font-size: 5rem; + min-height: 12.5rem; + border: 1px solid var(--mono-tint2); + margin: 0.5em 0; + padding: 0.75em 0.5em 0.5em 0.5em; + background: white; + color: black; + } + + #furigana-input { + text-align: left; + width: 80%; + margin-left: 10%; + } +</style> + +## Notes + +This wiki however provides easier syntax for furigana, same rules as in above `Furigana input` section apply while input has to be wrapped into `\\%{input here}` or `\\%{input here\=title}`, see [[/m/markdown_flavour|Markdown flavour]]. + +[^1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ruby diff --git a/public/wiki/japanese_onomatopeia.md b/public/w/japanese_onomatopeia.md diff --git a/public/wiki/kagai_nihongo.md b/public/w/kagai_nihongo.md diff --git a/public/wiki/kana_sounds.md b/public/w/kana_sounds.md diff --git a/public/wiki/make.md b/public/w/make.md diff --git a/public/wiki/oekaki.md b/public/w/oekaki.md diff --git a/public/wiki/recursion.md b/public/w/recursion.md diff --git a/public/wiki/vim_digraphs.md b/public/w/vim_digraphs.md diff --git a/public/wiki/web_browsers.md b/public/w/web_browsers.md diff --git a/public/wiki/html_furigana.md b/public/wiki/html_furigana.md @@ -1,81 +0,0 @@ -# HTML furigana - -For providing furigana (kana on top of \%{世界(せかい)}) for kanji or similar style markup `<ruby>`[^1] tag can be used. - -Structure of `<ruby>` tag might seem complicated at first but it's rather simple when you learn what each tag does. - -The above example can be shown as: - -```html -<ruby>世界<rp>(</rp><rt>せかい</rt><rp>)</rp></ruby> -``` - -However it can also be shown as: - -```html -<ruby> - 世界 - <rp>(</rp> - <rt>せかい</rt> - <rp>)</rp> -</ruby> -``` - -Each of lines provides certain function, `<ruby>` tag itself wraps the furigana, `<rp>` tag provides support for legacy browsers to display furigana beside the kanji 世界(せかい) and `<rt>` provides furigana itself. - -If one would want to split furigana between kanji it can be easily done inside a single tag. - -\%{世(せ)界(かい)\=World} - - -```html -<ruby title="World"> - 世 - <rp>(</rp> - <rt>せ</rt> - <rp>)</rp> - 界 - <rp>(</rp> - <rt>かい</rt> - <rp>)</rp> -</ruby> -``` - -## Furigana input (for any reasons) - -How to use (`input` - output): -- text - \%{text} -- text(te) - \%{text(te)} -- text\\(te) - \%{text\(te)} -- text(\\(te)) - \%{text(\(te))} -- text(\\(te\\)) - \%{text(\(te\))\=Notice the escaped second paren} -- text(a)word()after(b) - \%{text(a)word()after(b)} - -<input placeholder="Input text" id="furigana-input" value="世(せ)界(かい)"></input> - -<p id="furigana-output"></p> - -<style> - #furigana-output { - text-align: center; - font-size: 5rem; - min-height: 12.5rem; - border: 1px solid var(--mono-tint2); - margin: 0.5em 0; - padding: 0.75em 0.5em 0.5em 0.5em; - background: white; - color: black; - } - - #furigana-input { - text-align: left; - width: 80%; - margin-left: 10%; - } -</style> - -## Notes - -This wiki however provides easier syntax for furigana, same rules as in above `Furigana input` section apply while input has to be wrapped into `\\%{input here}` or `\\%{input here\=title}`, see [[/meta/markdown_flavour|Markdown flavour]]. - -[^1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/ruby