Update navigation

This commit is contained in:
ef3d0c3e 2024-11-03 00:27:31 +01:00
parent 61f76c204b
commit bab2a9431d
7 changed files with 54 additions and 92 deletions

View file

@ -1,5 +1,4 @@
@import ../template.nml
@nav.previous = Blockquote
%<make_doc({"Blocks"}, "Blockquotes", "Blockquotes")>%
# Blockquotes

View file

@ -1,59 +1,8 @@
@import ../template.nml
@nav.previous = Blockquote
%<make_doc({"Blocks"}, "Code", "Code")>%
# 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
```

View file

@ -1,5 +1,4 @@
@import ../template.nml
@nav.previous = Code
%<make_doc({"Blocks"}, "Lists", "Lists")>%
# Lists

View file

@ -36,7 +36,7 @@ impl NavEntries {
let mut result = String::new();
match target {
Target::HTML => {
result += r#"<div class="navbar"><ul>"#;
result += r#"<input id="navbar-checkbox" class="toggle" type="checkbox" style="display:none" checked><div id="navbar"><ul>"#;
fn process(
target: Target,
@ -107,7 +107,7 @@ impl NavEntries {
0,
);
result += r#"</ul></div>"#;
result += r#"</ul></div><label for="navbar-checkbox" class="navbar-checkbox-label">&#9776;</label>"#;
}
_ => todo!(""),
}

View file

@ -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);

View file

@ -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(),);
}
}

View file

@ -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 {
:checked + #navbar {
display: block;
}
.container {
flex-direction: row;
}
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: "";
}