From bab2a9431dd3c6d4750ea6e6be98aab856daceeb Mon Sep 17 00:00:00 2001 From: ef3d0c3e Date: Sun, 3 Nov 2024 00:27:31 +0100 Subject: [PATCH] Update navigation --- docs/blocks/blockquote.nml | 1 - docs/blocks/code.nml | 57 ++--------------------------------- docs/blocks/list.nml | 1 - src/compiler/navigation.rs | 4 +-- src/elements/code.rs | 4 +-- src/parser/util.rs | 17 ++++++----- style.css | 62 +++++++++++++++++++++++--------------- 7 files changed, 54 insertions(+), 92 deletions(-) diff --git a/docs/blocks/blockquote.nml b/docs/blocks/blockquote.nml index e37d1bb..8370d02 100644 --- a/docs/blocks/blockquote.nml +++ b/docs/blocks/blockquote.nml @@ -1,5 +1,4 @@ @import ../template.nml -@nav.previous = Blockquote %% # Blockquotes diff --git a/docs/blocks/code.nml b/docs/blocks/code.nml index 87ca016..c39dda9 100644 --- a/docs/blocks/code.nml +++ b/docs/blocks/code.nml @@ -1,59 +1,8 @@ @import ../template.nml -@nav.previous = Blockquote %% -# Blockquotes +# Code - ->[author=Lennart Poettering, cite=SystemD github issue 5998, url=https://github.com/systemd/systemd/pull/5998] ->>IMO, you shouldn't see the assignment of a CVE as a negative thing. The bug exists whether or not a CVE is assigned. The assignment of a CVE allows for people to consider what this issue means for them. -> ->Well, that makes no sense. You don't assign CVEs to every single random bugfix we do, do you? So why this one? I understand your currency is CVEs, but this just makes CVEs useless. And hardly anymore useful than a git history... -> ->I mean, I am fine with security bureaucracy if it actually helps anyone, but you just create noise where there shouldn't be any. And that way you just piss off the upstreams whose cooperation you actually should be interested in. Your at least made sure that my own interest in helping your efforts goes to zero... - -# Nesting blockquotes - -> Quotes can be nested ->> Here's a subquote ->>>[author=With author, cite=With cite] ->>> Here's another subquote ->> Back to the subquote -> ->> Another subquote -> This issue is getting a bit too heated, locking right now - -```Markdown, Given by the following -> Nest quotes can be nested ->> Here's a subquote ->>>[author=With author, cite=With cite] ->>> Here's another subquote ->> Back to the subquote -> ->> Another subquote -> This issue is getting a bit too heated, locking right now -``` - -# Properties -Properties must be specified on the first `>` of the quote, inside brackets. - * ``author`` The quote author - * ``cite`` The quote source name - * ``url`` The quote source url (used for accessibility) - -# Blockquotes styling - -The blockquotes styling controls how the author, cite and url are rendered. This is controlled by style key ``style.blockquote``. - * ``author_pos`` Position of the author statement, available options: - *- `None` Hides the author - *- `Before` Displays the author before the quote - *- `After` Displays the author after the quote (default) - * ``format`` An array with 3 format strings to control how the author is displayed: - *-[offset=0] Format for author+cite - *- Format for author onl - *- Format for cite only -```JSON, Default Style -{ - "author_pos": "After", - "format": ["{author}, {cite}", "{author}", "{cite}"], -} +```C, +TEST ``` diff --git a/docs/blocks/list.nml b/docs/blocks/list.nml index 28f96ad..78d4f91 100644 --- a/docs/blocks/list.nml +++ b/docs/blocks/list.nml @@ -1,5 +1,4 @@ @import ../template.nml -@nav.previous = Code %% # Lists diff --git a/src/compiler/navigation.rs b/src/compiler/navigation.rs index 395022e..1741cc4 100644 --- a/src/compiler/navigation.rs +++ b/src/compiler/navigation.rs @@ -36,7 +36,7 @@ impl NavEntries { let mut result = String::new(); match target { Target::HTML => { - result += r#""#; } _ => todo!(""), } diff --git a/src/elements/code.rs b/src/elements/code.rs index be727be..705b157 100644 --- a/src/elements/code.rs +++ b/src/elements/code.rs @@ -379,7 +379,7 @@ impl RegexRule for CodeRule { let mut code_content = if index == 0 { util::escape_text('\\', "```", matches.get(4).unwrap().as_str(), false) } else { - util::escape_text('\\', "``", matches.get(3).unwrap().as_str(), false) + util::escape_text('\\', "``", matches.get(3).unwrap().as_str(), !matches.get(3).unwrap().as_str().contains('\n')) }; if code_content.bytes().last() == Some(b'\n') // Remove newline @@ -657,7 +657,7 @@ fn fact(n: usize) -> usize assert_eq!(found[2].block, CodeKind::MiniBlock); assert_eq!(found[2].language, "Rust"); assert_eq!(found[2].name, None); - assert_eq!(found[2].code, "fn fact(n: usize) -> usize\n{\n\tmatch n\n\t{\n\t\t0 | 1 => 1,\n\t\t_ => n * fact(n-1)\n\t}\n}"); + assert_eq!(found[2].code, "\nfn fact(n: usize) -> usize\n{\n\tmatch n\n\t{\n\t\t0 | 1 => 1,\n\t\t_ => n * fact(n-1)\n\t}\n}"); assert_eq!(found[2].line_offset, 1); assert_eq!(found[3].block, CodeKind::MiniBlock); diff --git a/src/parser/util.rs b/src/parser/util.rs index e4df3e8..626d92c 100644 --- a/src/parser/util.rs +++ b/src/parser/util.rs @@ -303,31 +303,32 @@ mod tests { escape_text( '\\', "%", - "escaped: \\%, also escaped: \\\\\\%, untouched: \\a" + "escaped: \\%, also escaped: \\\\\\%, untouched: \\a", + true ), "escaped: %, also escaped: \\%, untouched: \\a" ); assert_eq!( - escape_text('"', "><)))°>", "Escaped fish: \"><)))°>"), + escape_text('"', "><)))°>", "Escaped fish: \"><)))°>", false), "Escaped fish: ><)))°>".to_string() ); assert_eq!( - escape_text('\\', "]", "Escaped \\]"), + escape_text('\\', "]", "Escaped \\]", true), "Escaped ]".to_string() ); assert_eq!( - escape_text('\\', "]", "Unescaped \\\\]"), + escape_text('\\', "]", "Unescaped \\\\]", false), "Unescaped \\\\]".to_string() ); assert_eq!( - escape_text('\\', "]", "Escaped \\\\\\]"), + escape_text('\\', "]", "Escaped \\\\\\]", true), "Escaped \\]".to_string() ); assert_eq!( - escape_text('\\', "]", "Unescaped \\\\\\\\]"), + escape_text('\\', "]", "Unescaped \\\\\\\\]", false), "Unescaped \\\\\\\\]".to_string() ); - assert_eq!(escape_text('\\', ")", "A\\)B\\"), "A)B".to_string(),); - assert_eq!(escape_text('\\', ")", "A\\)B\\\\"), "A)B\\".to_string(),); + assert_eq!(escape_text('\\', ")", "A\\)B\\", true), "A)B".to_string(),); + assert_eq!(escape_text('\\', ")", "A\\)B\\\\", false), "A)B\\".to_string(),); } } diff --git a/style.css b/style.css index 8d5933c..57acd6f 100644 --- a/style.css +++ b/style.css @@ -82,37 +82,51 @@ a.inline-code { } /* Navbar */ -.navbar { +.navbar-wrap +{ + display: flex; +} +#navbar { display: none; left: 0; top: 0; bottom: 0; - width: max(calc((100vw - 99ch) / 2 - 12vw), 24ch); + width: max(min(calc((100vw - 99ch) / 2), 32ch), 28ch); height: 100vh; - position: fixed; margin-right: 1em; + padding-top: 2.5em; + position: fixed; + overflow-x: scroll; - overflow-y: auto; - box-sizing: border-box; - overscroll-behavior-y: contain; + transition: 0.5s; background-color: #242526; color: #d0d0d0; - - font-weight: bold; + box-shadow: 1px 0px 4px 0px rgba(0,0,0,0.75); } -@media (min-width: 130ch) { - .navbar { - display: block; - } - .container { - flex-direction: row; - } +:checked + #navbar { + display: block; + transition: margin-left .5s; +} +.navbar-checkbox-label { + border-radius: 3px; + position: fixed; + + top: 0.2em; + left: 0.2em; + line-height: 1em; + padding: 0.1em; + + background: #2f343f; + font-size: 1.8em; + color: #7c8c8c; + + box-shadow: 0px 0px 3px 1px #242526 inset; } -.navbar li { +#navbar li { display: block; position: relative; padding-left: .25em; @@ -149,31 +163,31 @@ li.navbar-entry-current a { font-weight: normal; } -.navbar ul { +#navbar ul { margin-left: 0em; padding-left: 0; line-height: 1.66em; } -.navbar summary{ +#navbar summary{ display: block; cursor: pointer; } -.navbar summary::marker, -.navbar summary::-webkit-details-marker{ +#navbar summary::marker, +#navbar summary::-webkit-details-marker{ display: none; } -.navbar summary:focus{ +#navbar summary:focus{ outline: none; } -.navbar summary:focus-visible{ +#navbar summary:focus-visible{ outline: 1px dotted #000; } -.navbar summary:after { +#navbar summary:after { content: "+"; color: #55ffb4; float: left; @@ -181,7 +195,7 @@ li.navbar-entry-current a { width: 1em; } -.navbar details[open] > summary:after { +#navbar details[open] > summary { content: "–"; }