commit f121199de5c3850d07143ca267d39ce3c1af359b
parent a7c5526bf816ee8ead1e7bd2651f76bc854066e9
Author: Alisa Lain <60989682+al1-ce@users.noreply.github.com>
Date: Sun, 13 Jul 2025 05:11:39 +0300
improve furigana support, add new articles
Diffstat:
14 files changed, 306 insertions(+), 55 deletions(-)
diff --git a/public/404.html b/public/404.html
@@ -24,9 +24,9 @@
<body>
<div class="block heavy wide">
<br>
- <h1 class="upper glitch">Error: 404</h1><br>
- <h2 class="glitch">You've strayed from a set path.</h2>
- <a href="/">Go Back?</a>
+ <h1 class="upper">Error: 404</h1><br>
+ <h2>Unable to find requested resource.</h2>
+ <a href="/">Go Home?</a>
</div>
<script src="/js/index.js"></script>
diff --git a/public/_404.md b/public/_404.md
@@ -1,5 +1,11 @@
<h2><center id="page-404-title-center">404 - Page not found</center></h2>
+<hr>
+
<center>You can <a href="" id="page-404-create-new-article">create it</a>.</center>
+<br>
+
<center>Return to <a href="/">home</a>?</center>
+
+<hr>
+\ No newline at end of file
diff --git a/public/all_pages.md b/public/all_pages.md
@@ -1,6 +1,6 @@
||||
|:-|:-|:-|
-|[aa](wiki/aa.md)|[maintenance](meta/maintenance.md)|[style_guidelines](meta/style_guidelines.md)|
+|[aa](wiki/aa.md)|[kagai_nihongo](wiki/kagai_nihongo.md)|[recursion](wiki/recursion.md)|
+|[html_entities](wiki/html_entities.md)|[maintenance](meta/maintenance.md)|[style_guidelines](meta/style_guidelines.md)|
|[html_furigana](wiki/html_furigana.md)|[markdown_flavour](meta/markdown_flavour.md)|[style_test](meta/style_test.md)|
|[index](/)|[options](meta/options.md)|[vim_digraphs](wiki/vim_digraphs.md)|
-|[kagai_nihongo](wiki/kagai_nihongo.md)|[recursion](wiki/recursion.md)|
diff --git a/public/index.html b/public/index.html
@@ -255,6 +255,14 @@
color: #D00 !important;
text-decoration: underline;
}
+
+ rt {
+ font-size: 0.5em;
+ /* border: 1px solid transparent; */
+ }
+ rt:hover {
+ /* border: 1px dashed var(--mono-tint1); */
+ }
</style>
<nav id="app-nav" class="app-nav">
<a id="nav-home" href="/">Home</a>
@@ -343,10 +351,49 @@
// Invoked on each page load before new markdown is transformed to HTML.
// Supports asynchronous tasks (see beforeEach documentation for details).
// hook.beforeEach(function (markdown) {return markdown;});
+ hook.beforeEach(function(markdown, next) {
+ const out = markdown.replace(/\\+%{([^{}]+)}/g, function(content) {
+ if (content.startsWith("\\\\")) return content.substr(1);
+ const innerContent = content.replace('\\%{', '').replace('}', '');
+ const itext = innerContent.split(/(?<!\\)\\=/);
+ let t = innerContent;
+ let o = "<ruby>";
+ if (itext.length == 2) {
+ t = itext[0];
+ o = `<ruby title="${itext[1].replaceAll(/"/g, """)}">`;
+ }
+ let p = '';
+ let f = false;
+ for (let c of t) {
+ if (c == "<") c = "<";
+ if (c == ">") c = ">";
+ if (c == '(' && p != '\\') {
+ o += "<rp>(</rp><rt>";
+ f = true;
+ } else
+ if (c == ')' && p != '\\' && f == true) {
+ o += "</rt><rp>)</rp>";
+ f = false;
+ } else
+ if (c == '\\') { /* do nothing, next if */ } else
+ if (p == '\\' && (c != '(' && c != ')')) {
+ o += p + c;
+ } else {
+ o += c;
+ }
+ p = c;
+ }
+ o += "</ruby>";
+ o.replaceAll("<rp>(</rp><rt></rt><rp>)</rp>", "<rt></rt>");
+ return o;
+ });
+
+ next(out);
+ });
// 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;});
+ // hook.afterEach(function (html) {return html;});
// Invoked on each page load after new HTML has been appended to the DOM
hook.doneEach(function() {
@@ -384,6 +431,42 @@
for (let e of document.querySelectorAll("blockquote > blockquote > p")) {
e.innerHTML = ">" + e.innerHTML;
}
+
+ 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;
+ let o = "<ruby>";
+ let p = '';
+ let f = false;
+ for (let c of t) {
+ if (c == "<") c = "<";
+ if (c == ">") c = ">";
+ if (c == '(' && p != '\\') {
+ o += "<rp>(</rp><rt>";
+ f = true;
+ } else
+ if (c == ')' && p != '\\' && f == true) {
+ o += "</rt><rp>)</rp>";
+ f = false;
+ } else
+ if (c == '\\') { /* do nothing, next if */ } else
+ if (p == '\\' && (c != '(' && c != ')')) {
+ o += p + c;
+ } else {
+ o += c;
+ }
+ p = c;
+ }
+ o += "</ruby>";
+ o.replaceAll("<rp>(</rp><rt></rt><rp>)</rp>", "<rt></rt>");
+ fg_output.innerHTML = o;
+ };
+ fg_input.addEventListener("input", process_furigana);
+ process_furigana();
+ }
});
// Invoked one time after rendering the initial page
diff --git a/public/js/plugins/wikilink.js b/public/js/plugins/wikilink.js
@@ -30,7 +30,11 @@ function plugin(hook, vm) {
const linkTopicSps = link.split('#'); // link, topic
hashPath = linkTopicSps[0];
topic = `?id=${linkTopicSps[1]}`;
- showText = `${linkAliasSps[1].trim()}`;
+ if (linkAliasSps.length == 1) {
+ showText = `${hashPath.trim()}`;
+ } else {
+ showText = `${linkAliasSps[1].trim()}`;
+ }
}
if (showText.split("|").length == 2) { showText = showText.split("|")[1]; }
hashPath = hashPath.replaceAll(' ', '_').toLowerCase();
diff --git a/public/meta/maintenance.md b/public/meta/maintenance.md
@@ -2,16 +2,17 @@
This article is a list of things/features I need to do/implement.
-
To add:
- bottom "wikihub" table syntax
- Footnotes
- Special "citation needed" footnote style
+- Title syntax `<tag title="asdf">` or a "click/hover translation"
To do:
+- add escaping for inline formatting, wikilinks and header redirects
+- add [[multipl]]e <- incorporating attached ending (e) into link
---
See also:
-- [[maintenance]]
diff --git a/public/meta/markdown_flavour.md b/public/meta/markdown_flavour.md
@@ -1,18 +1,18 @@
# wiki@al1-ce markdown flavour
+This article is a stub and is dependant on [[maintenance]]
+
## Wikilinks
-```md
-[[Direct Link]]
+- [[Direct Link]]
- links to direct_link article in current directory
- https://wiki.al1-ce.dev/CURRENT_DIR/direct_link
-[[Direct Link|Custom text]]
+- [[Direct Link|Custom text]]
- same as above but with custom text
-[[Direct Link#Header]]
+- [[Direct Link#Header]]
- same as above but linking to certain header
-[[/meta/Style Guidelines|Style Guidelines]]
+- [[/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
@@ -38,3 +38,11 @@ Syntax (`\@` replace with `@`)
[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_guidelines.md b/public/meta/style_guidelines.md
@@ -1,5 +1,7 @@
# Style Guidelines
+This article is a stub
+
This is an article about article style guidelines.
For now there is at least one:
diff --git a/public/meta/style_test.md b/public/meta/style_test.md
@@ -59,7 +59,7 @@ Numbered list
- striked ~~striked~~ striked
- highlighted ==highlighted== highlighted
- subscript ~sub~script subscript
-- superscript ^super^script superscript
+- superscript ^super^script superscript
## Lines
@@ -91,14 +91,6 @@ ___
int main(int argc, char **argv) { return 0; }
```
-
-```aa
-AA (Shift JIS)
-| .|\|/ | | .|
-| ∧∧.|/⌒ヽ、| ∧_∧ .| ∧∧ |
-|(,,゚Д゚)||,,゚ Θ゚)|(; ´Д`)|(=゚ω゚)|
-```
-
## Images
Markdown image
@@ -141,20 +133,33 @@ Here's a simple footnote,a[^1] and here's a longer one.[^bignote]
| Header | Title | Here's this |
| Paragraph | Text | And more |
-## Custom header ID's
-
-### My Great Heading {#custom-id}
-- [Markdown link](#custom-id)
-- [[#custom-id|Wiki link]]
-
## Misc
- [x] done
- [ ] todo
-- Auto-emoji :joy:
+- 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/wiki/aa.md
@@ -1,6 +1,6 @@
# AA (Shift-JIS art)
-TODO
+This article is a stub
## Test
diff --git a/public/wiki/html_entities.md b/public/wiki/html_entities.md
@@ -0,0 +1,108 @@
+# HTML Entities
+
+This article is a stub
+
+ISO 8859-1 Characters
+Full list of supported ISO-8859-1 characters. Notice that the names are case sensitive, hence if you want an uppercase letter, the name should also start with an uppercase letter.
+
+```
+┌────────┬──────────────┬────────────────┬──────────────────
+│Character Entity Name Entity Number Description
+├────────┼──────────────┼────────────────┼──────────────────
+│ │ │   │ Space
+│! │ │ ! │ Exclamation mark
+│" │ │ " │ Quotation mark
+│# │ │ # │ Number sign
+│$ │ │ $ │ Dollar sign
+│% │ │ % │ Percent sign
+│& │ & │ & │ Ampersand
+│' │ │ ' │ Apostrophe
+│( │ │ ( │ Opening/Left Parenthesis
+│) │ │ ) │ Closing/Right Parenthesis
+│* │ │ * │ Asterisk
+│+ │ │ + │ Plus sign
+│, │ │ , │ Comma
+│- │ │ - │ Hyphen
+│. │ │ . │ Period
+│/ │ │ / │ Slash
+│0 │ │ 0 │ Digit 0
+│1 │ │ 1 │ Digit 1
+│2 │ │ 2 │ Digit 2
+│3 │ │ 3 │ Digit 3
+│4 │ │ 4 │ Digit 4
+│5 │ │ 5 │ Digit 5
+│6 │ │ 6 │ Digit 6
+│7 │ │ 7 │ Digit 7
+│8 │ │ 8 │ Digit 8
+│9 │ │ 9 │ Digit 9
+│: │ │ : │ Colon
+│; │ │ ; │ Semicolon
+│< │ < │ < │ Less-than
+│= │ │ = │ Equals sign
+│> │ > │ > │ Greater than
+│? │ │ ? │ Question mark
+│@ │ │ @ │ At sign
+│A │ │ A │ Uppercase A
+│B │ │ B │ Uppercase B
+│C │ │ C │ Uppercase C
+│D │ │ D │ Uppercase D
+│E │ │ E │ Uppercase E
+│F │ │ F │ Uppercase F
+│G │ │ G │ Uppercase G
+│H │ │ H │ Uppercase H
+│I │ │ I │ Uppercase I
+│J │ │ J │ Uppercase J
+│K │ │ K │ Uppercase K
+│L │ │ L │ Uppercase L
+│M │ │ M │ Uppercase M
+│N │ │ N │ Uppercase N
+│O │ │ O │ Uppercase O
+│P │ │ P │ Uppercase P
+│Q │ │ Q │ Uppercase Q
+│R │ │ R │ Uppercase R
+│S │ │ S │ Uppercase S
+│T │ │ T │ Uppercase T
+│U │ │ U │ Uppercase U
+│V │ │ V │ Uppercase V
+│W │ │ W │ Uppercase W
+│X │ │ X │ Uppercase X
+│Y │ │ Y │ Uppercase Y
+│Z │ │ Z │ Uppercase Z
+│[ │ │ [ │ Opening/Left square bracket
+│\ │ │ \ │ Backslash
+│] │ │ ] │ Closing/Right square bracket
+│^ │ │ ^ │ Caret
+│_ │ │ _ │ Underscore
+│` │ │ ` │ Grave accent
+│a │ │ a │ Lowercase a
+│b │ │ b │ Lowercase b
+│c │ │ c │ Lowercase c
+│d │ │ d │ Lowercase d
+│e │ │ e │ Lowercase e
+│f │ │ f │ Lowercase f
+│g │ │ g │ Lowercase g
+│h │ │ h │ Lowercase h
+│i │ │ i │ Lowercase i
+│j │ │ j │ Lowercase j
+│k │ │ k │ Lowercase k
+│l │ │ l │ Lowercase l
+│m │ │ m │ Lowercase m
+│n │ │ n │ Lowercase n
+│o │ │ o │ Lowercase o
+│p │ │ p │ Lowercase p
+│q │ │ q │ Lowercase q
+│r │ │ r │ Lowercase r
+│s │ │ s │ Lowercase s
+│t │ │ t │ Lowercase t
+│u │ │ u │ Lowercase u
+│v │ │ v │ Lowercase v
+│w │ │ w │ Lowercase w
+│x │ │ x │ Lowercase x
+│y │ │ y │ Lowercase y
+│z │ │ z │ Lowercase z
+│{ │ │ { │ Opening/Left curly brace
+│| │ │ | │ Vertical bar
+│} │ │ } │ Closing/Right curly brace
+│~ │ │ ~ │ Tilde
+└────────┴──────────────┴────────────────┴──────────────────
+```
+\ No newline at end of file
diff --git a/public/wiki/html_furigana.md b/public/wiki/html_furigana.md
@@ -1,6 +1,6 @@
# HTML furigana
-For providing furigana (kana on top of <ruby>世界<rp>(</rp><rt>せかい</rt><rp>)</rp></ruby>) for kanji or similar style markup `<ruby>`[^1] tag can be used.
+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.
@@ -25,16 +25,7 @@ Each of lines provides certain function, `<ruby>` tag itself wraps the furigana,
If one would want to split furigana between kanji it can be easily done inside a single tag.
-<ruby title="World">
- 世
- <rp>(</rp>
- <rt>せ</rt>
- <rp>)</rp>
- 界
- <rp>(</rp>
- <rt>かい</rt>
- <rp>)</rp>
-</ruby>
+\%{世(せ)界(かい)\=World}
```html
@@ -50,12 +41,41 @@ If one would want to split furigana between kanji it can be easily done inside a
</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>
-rt {
-font-size: 0.5em;
-}
+ #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>
-TODO: add furigana styling to index.html
+## 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
diff --git a/public/wiki/kagai_nihongo.md b/public/wiki/kagai_nihongo.md
@@ -1,15 +1,24 @@
# Kagai nihongo (moon. foreign japanese)
-An unnamed phenomenon, most likely brought by [[imageboards]], where [[anon|anons]] incorporate select japanese words into his speech.
+An unnamed phenomenon, most likely brought by [[imageboards]], where [[anon|anons]] incorporate select japanese words into their speech.
Notable examples:
-- daijoubu - "not daijoubu", "it's daijoubu", replacement for "ok"
-- desu - desu desu desu, a topic finisher, used everywhere
-- genki - 200% genki, means healthy, active
-- keikaku - just according to keikaku (plan)
-- sasuga - "as expected of", "even the [...]"
-- seiso - pure (proof needed)
-- senpai - upperclassman, be it school class or social class
+- \%{大丈夫(だいじょうぶ)}, daijoubu
+ - "not daijoubu", "it's daijoubu", replacement for "ok", "fine"
+- \%{です}, desu
+ - desu desu desu, a topic finisher, used everywhere
+- \%{元(げん)気(き)}, genki
+ - 200% genki, means healthy, active. Usually used when somebody is hyperactive
+- \%{計(けい)画(かく)}, keikaku
+ - just according to keikaku (plan), originated from Death Note eng. dub
+- \%{さすが}, sasuga
+ - "as expected of", "even the [...] could X". さすがに○○\%{先生(せんせい)!}, as expected of Mr. XX
+- \%{せいそ}, seiso
+ - eng. slang that came from \%{清楚(せいそ)\=clean, tidy} and is used when referring to [[vtuber|Vtubers]].
+- \%{せんぱい}, senpai
+ - upperclassman, be it school class or social class
+- \%{先(せん)生(せい)}, sensei
+ - teacher, used either towards teachers or "role models"
---
diff --git a/public/wiki/vim_digraphs.md b/public/wiki/vim_digraphs.md
@@ -1,5 +1,7 @@
# Vim digraphs
+This article is a stub
+
[[Vim]] provides an easy way to input printable non-ascii (usually unicode) characters with digraphs[^1].
Example: