"#,
+ ),
+ );
+ }
+
#[test]
fn http_external_anchor() {
assert_eq!(
diff --git a/src/syntax/content/parser/context/block.rs b/src/syntax/content/parser/context/block.rs
index 3b34724..8048896 100644
--- a/src/syntax/content/parser/context/block.rs
+++ b/src/syntax/content/parser/context/block.rs
@@ -6,15 +6,17 @@ use crate::{
syntax::content::{
Parseable as _,
parser::{
- Block, Lexeme, State, Token,
+ Block, Lexeme, State, Token, context,
token::{
- Header, LineBreak, List, Literal, Paragraph, PreFormat, Quote,
- Table, Verse,
+ Header, LineBreak, List, Paragraph, PreFormat, Quote, Table,
+ Verse,
},
},
},
};
+/// A return of `true` will trigger a `continue` on the outer parser, causing
+/// no more subsequent parsing of the current lexeme.
pub fn parse(
lexeme: &Lexeme,
state: &mut State,
@@ -27,8 +29,7 @@ pub fn parse(
if PreFormat::probe(lexeme) {
log!(VERBOSE, "Block Context: None -> PreFormat on {lexeme}");
state.context.block = Block::PreFormat;
- tokens.push(Token::PreFormat(PreFormat::new(true)));
- return true;
+ return true
} else if Header::probe(lexeme) {
let mut header = Header::lex(lexeme);
header.dom_id = Some(Header::make_id(
@@ -44,7 +45,7 @@ pub fn parse(
log!(VERBOSE, "Block Context: None -> List on {lexeme}");
state.context.block = Block::List;
state.buffers.list.candidate.ordered = lexeme.match_char('+');
- return super::list::parse(
+ return context::list::parse(
lexeme, state, tokens, iterator, graph,
);
} else if Quote::probe(lexeme) {
@@ -71,14 +72,7 @@ pub fn parse(
}
},
Block::PreFormat => {
- if PreFormat::probe(lexeme) {
- tokens.push(Token::PreFormat(PreFormat::new(false)));
- log!(VERBOSE, "Block Context: PreFormat -> None on {lexeme}");
- state.context.block = Block::None;
- } else {
- tokens.push(Token::Literal(Literal::lex(lexeme)));
- }
- return true;
+ return context::preformat::parse(lexeme, state, tokens, iterator);
},
Block::Paragraph => {
if Paragraph::probe_end(lexeme) {
@@ -95,13 +89,17 @@ pub fn parse(
}
},
Block::List => {
- return super::list::parse(lexeme, state, tokens, iterator, graph);
+ return context::list::parse(lexeme, state, tokens, iterator, graph);
},
Block::Quote => {
- return super::quote::parse(lexeme, state, tokens, iterator, graph);
+ return context::quote::parse(
+ lexeme, state, tokens, iterator, graph,
+ );
},
Block::Table => {
- return super::table::parse(lexeme, state, tokens, iterator, graph);
+ return context::table::parse(
+ lexeme, state, tokens, iterator, graph,
+ );
},
Block::Verse => {
if Verse::probe_end(lexeme) {
@@ -127,7 +125,7 @@ mod tests {
graph::Graph,
syntax::content::parser::{
self, Block, State, Token, context,
- token::{Header, PreFormat, header::Level},
+ token::{Header, header::Level},
},
};
@@ -161,16 +159,6 @@ mod tests {
assert_eq!(vec, vec![Token::Header(Header::from_u8(1, false, None))]);
}
- #[test]
- fn end_with_open_preformat() {
- let mut state = State::default();
- state.context.block = Block::PreFormat;
-
- let mut vec: Vec = vec![];
- context::close(&state, &mut vec);
- assert_eq!(vec, vec![Token::PreFormat(PreFormat::new(false))]);
- }
-
#[test]
fn truncated_header_level() {
let u: usize = 999;
diff --git a/src/syntax/content/parser/context/preformat.rs b/src/syntax/content/parser/context/preformat.rs
new file mode 100644
index 0000000..ed6763f
--- /dev/null
+++ b/src/syntax/content/parser/context/preformat.rs
@@ -0,0 +1,61 @@
+use std::{iter::Peekable, slice::Iter};
+
+use crate::{
+ prelude::*,
+ syntax::content::{
+ Parseable as _,
+ parser::{Lexeme, State, Token, context::Block, token::PreFormat},
+ },
+};
+
+/// Handles open `PreFormat` contexts until a block is fully parsed.
+///
+/// A return of `true` will trigger a continue in the outer parser,
+/// skipping any further parsing of the current lexeme.
+///
+/// # Panics
+/// This parser can handle only the List context, and will panic if passed an
+/// unrelated context since it has no knowledge on how to handle them.
+pub fn parse(
+ lexeme: &Lexeme,
+ state: &mut State,
+ tokens: &mut Vec,
+ iterator: &mut Peekable>,
+) -> bool {
+ let buffer = &mut state.buffers.preformat;
+ let candidate = &mut buffer.candidate;
+
+ #[expect(clippy::wildcard_enum_match_arm)]
+ match state.context.block {
+ Block::PreFormat => {
+ if lexeme.match_first_char('<') {
+ candidate.text.push_str("<");
+ candidate.text.push_str(
+ lexeme.text().strip_prefix('<').unwrap_or(&lexeme.text()),
+ );
+ } else if lexeme.match_last_char('>') {
+ candidate.text.push_str(
+ lexeme.text().strip_suffix('>').unwrap_or(&lexeme.text()),
+ );
+ candidate.text.push_str(">");
+ } else if lexeme.match_char('\\') {
+ candidate.text.push_str(lexeme.next().as_str());
+ iterator.next();
+ return true;
+ } else if PreFormat::probe(lexeme) {
+ // found end of block, push it and reset state
+ log!(VERBOSE, "Accepting preformat candidate {candidate}");
+ tokens.push(Token::PreFormat(candidate.clone()));
+ state.context.block = Block::None;
+ *candidate = PreFormat::default();
+ } else {
+ // anything else is pushed into the candidate preformat's text
+ candidate.text.push_str(&lexeme.text());
+ }
+ },
+ _ => {
+ panic!("PreFormat context parser called for {:?}", state.context)
+ },
+ }
+ true
+}
diff --git a/src/syntax/content/parser/lexeme.rs b/src/syntax/content/parser/lexeme.rs
index 378a8b8..94b28d5 100644
--- a/src/syntax/content/parser/lexeme.rs
+++ b/src/syntax/content/parser/lexeme.rs
@@ -32,6 +32,8 @@ impl Lexeme {
pub fn mutate_text(&mut self, new: &str) { self.text = new.to_string(); }
+ /// Returns an Option containing the character if the raw lexeme text
+ /// is composed of a single character, None if it has multiple characters.
pub fn as_char(&self) -> Option {
if self.text.chars().count() == 1 {
self.text.chars().nth(0)
@@ -56,6 +58,7 @@ impl Lexeme {
}
}
+ /// Returns true if the raw lexeme text is a single matching character.
pub fn match_char(&self, c: char) -> bool {
self.as_char().is_some_and(|as_char| as_char == c)
}
@@ -86,6 +89,8 @@ impl Lexeme {
&& self.match_third_char(c3)
}
+ /// Returns true if the lexeme raw text is composed of a single character
+ /// and this character is in the provided slice.
pub fn match_char_in(&self, slice: &[char]) -> bool {
self.as_char().is_some_and(|c| slice.contains(&c))
}
@@ -224,7 +229,7 @@ impl Lexeme {
impl fmt::Display for Lexeme {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use crate::log::wrap;
+ use crate::dev::log::wrap;
let properties = if self.last && self.first {
"[S] "
@@ -286,7 +291,7 @@ mod tests {
fn first_segment() {
let payload = "nhNc fGev QnGW E4hj ExyZ";
let lexeme = Lexeme::new(payload, "", "");
- assert_eq!(lexeme.clone().first_segment(), Some(String::from("nhNc")));
+ assert_eq!(lexeme.first_segment(), Some(String::from("nhNc")));
}
#[test]
@@ -381,8 +386,8 @@ mod tests {
let lexemes = Lexeme::collect(&input);
let first = lexemes.first().unwrap();
- let second = lexemes.get(1).unwrap();
- let third = lexemes.get(2).unwrap();
+ let second = &lexemes[1];
+ let third = &lexemes[2];
let last = lexemes.last().unwrap();
assert_eq!(
diff --git a/src/syntax/content/parser/lexer.rs b/src/syntax/content/parser/lexer.rs
index e9a0d40..e8d3abc 100644
--- a/src/syntax/content/parser/lexer.rs
+++ b/src/syntax/content/parser/lexer.rs
@@ -38,7 +38,9 @@ pub(super) fn lex(
let mut iterator = lexemes.iter().peekable();
while let Some(lexeme) = iterator.next() {
- if lexeme.match_char('\\') {
+ if lexeme.match_char('\\')
+ && !matches!(state.context.block, context::Block::PreFormat)
+ {
if let Some(next) = iterator.next() {
tokens.push(Token::Literal(Literal::lex(next)));
}
diff --git a/src/syntax/content/parser/state.rs b/src/syntax/content/parser/state.rs
index aa42f68..47498a3 100644
--- a/src/syntax/content/parser/state.rs
+++ b/src/syntax/content/parser/state.rs
@@ -3,7 +3,7 @@ use std::collections::HashMap;
use crate::syntax::content::parser::{
Token,
context::Context,
- token::{Anchor, Item, List, Quote, Table},
+ token::{Anchor, Item, List, PreFormat, Quote, Table},
};
#[derive(Clone, Default, Debug)]
@@ -29,6 +29,7 @@ pub struct Buffers {
pub list: ListBuffer,
pub quote: QuoteBuffer,
pub table: TableBuffer,
+ pub preformat: PreFormatBuffer,
}
#[derive(Default, Clone, Debug)]
@@ -59,6 +60,11 @@ pub struct TableBuffer {
pub in_header: bool,
}
+#[derive(Default, Clone, Debug)]
+pub struct PreFormatBuffer {
+ pub candidate: PreFormat,
+}
+
impl std::fmt::Display for AnchorBuffer {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
let display_text = if self.text.is_empty() {
diff --git a/src/syntax/content/parser/token/anchor.rs b/src/syntax/content/parser/token/anchor.rs
index 3702d77..556ac42 100644
--- a/src/syntax/content/parser/token/anchor.rs
+++ b/src/syntax/content/parser/token/anchor.rs
@@ -11,6 +11,7 @@ pub struct Anchor {
node: Option,
leading: bool,
balanced: bool,
+ absolute: bool,
external: bool,
}
@@ -34,10 +35,17 @@ impl Anchor {
self.balanced = balanced;
}
+ pub const fn absolute(&self) -> bool { self.absolute }
+
+ pub const fn set_absolute(&mut self, absolute: bool) {
+ self.absolute = absolute;
+ }
+
pub const fn external(&self) -> bool { self.external }
pub const fn set_external(&mut self, external: bool) {
self.external = external;
+ self.absolute = true;
}
pub const fn set_leading(&mut self, leading: bool) {
@@ -58,21 +66,28 @@ impl Anchor {
fn route(&mut self) {
self.destination = if let Some(destination) = self.destination.clone() {
- if destination.contains(':') || destination.contains('/') {
+ if destination.contains(':') || destination.starts_with('/') {
Some(destination)
} else if destination.is_empty() && self.text.is_empty() {
None
} else if destination.is_empty() {
- self.node_id = Some(self.text.clone());
+ self.node_id = Some(Self::strip_fragment(&self.text));
Some(format!("/node/{}", self.text))
} else {
- self.node_id = self.destination.clone();
+ self.node_id = self
+ .destination
+ .clone()
+ .map(|d| Anchor::strip_fragment(&d));
Some(format!("/node/{destination}"))
}
} else {
None
}
}
+
+ fn strip_fragment(target: &str) -> String {
+ target.split('#').next().unwrap_or(target).to_string()
+ }
}
impl Parseable for Anchor {
@@ -100,19 +115,31 @@ impl Parseable for Anchor {
String::default()
};
- let classes = if self.node.is_some() {
- String::from(r#"class="attached""#)
- } else if !self.external {
- String::from(r#"class="detached""#)
- } else if self.external {
+ let classes = if self.external {
String::from(r#"class="external""#)
+ } else if self.absolute {
+ String::from(r#"class="absolute""#)
+ } else if self.node.is_some() {
+ String::from(r#"class="attached""#)
} else {
- String::default()
+ String::from(r#"class="detached""#)
+ };
+
+ let text = if destination.contains('#')
+ && !self.absolute
+ && destination == &format!("/node/{}", self.text)
+ {
+ self.text
+ .split('#')
+ .next()
+ .unwrap_or(&self.text)
+ .to_string()
+ } else {
+ self.text.clone()
};
format!(
- r#"{}"#,
- destination, self.text,
+ r#"{text}"#
)
}
@@ -121,7 +148,7 @@ impl Parseable for Anchor {
impl std::fmt::Display for Anchor {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- use crate::log::wrap;
+ use crate::dev::log::wrap;
let wrapped_text = wrap(&self.text);
let display_text = if wrapped_text.is_empty() {
@@ -216,7 +243,7 @@ mod tests {
anchor.external = true;
assert_eq!(
- format!("{}", Token::Anchor(Box::new(anchor.clone()))),
+ format!("{}", Token::Anchor(Box::new(anchor))),
"Tk:Anchor 'wPVo1 0OmYm' -> \"M1UEp 1gbfr\" \
+Leading +Balanced +External",
);
@@ -261,4 +288,15 @@ mod tests {
let anchor = Anchor::default();
assert_eq!(format!("{anchor}"), "Anchor -> ");
}
+
+ #[test]
+ fn flatten() {
+ let payload = "tpBTViYnldoTqDsB";
+ let mut anchor = Anchor::default();
+ anchor.text = String::from(payload);
+ assert_eq!(anchor.flatten(), payload);
+
+ let token = Token::Anchor(Box::new(anchor));
+ assert_eq!(token.flatten(), payload);
+ }
}
diff --git a/src/syntax/content/parser/token/bold.rs b/src/syntax/content/parser/token/bold.rs
index 6ef5bd3..6ae041e 100644
--- a/src/syntax/content/parser/token/bold.rs
+++ b/src/syntax/content/parser/token/bold.rs
@@ -60,15 +60,15 @@ mod tests {
assert_eq!(format!("{}", Token::Bold(bold.clone())), "Tk:Bold [open]");
bold.open = false;
- assert_eq!(
- format!("{}", Token::Bold(bold.clone())),
- "Tk:Bold [closed]"
- );
+ assert_eq!(format!("{}", Token::Bold(bold)), "Tk:Bold [closed]");
}
#[test]
fn flatten() {
let bold = Bold::new(false);
assert_eq!(bold.flatten(), "");
+
+ let token = Token::Bold(bold);
+ assert_eq!(token.flatten(), "");
}
}
diff --git a/src/syntax/content/parser/token/checkbox.rs b/src/syntax/content/parser/token/checkbox.rs
index c2597b7..9230af6 100644
--- a/src/syntax/content/parser/token/checkbox.rs
+++ b/src/syntax/content/parser/token/checkbox.rs
@@ -64,7 +64,7 @@ mod tests {
checkbox.checked = false;
assert_eq!(
- format!("{}", Token::CheckBox(checkbox.clone())),
+ format!("{}", Token::CheckBox(checkbox)),
"Tk:CheckBox [empty]"
);
}
@@ -73,5 +73,8 @@ mod tests {
fn flatten() {
let checkbox = CheckBox::new(false);
assert_eq!(checkbox.flatten(), "");
+
+ let token = Token::CheckBox(checkbox);
+ assert_eq!(token.flatten(), "");
}
}
diff --git a/src/syntax/content/parser/token/code.rs b/src/syntax/content/parser/token/code.rs
index a6f6977..8f82eba 100644
--- a/src/syntax/content/parser/token/code.rs
+++ b/src/syntax/content/parser/token/code.rs
@@ -60,9 +60,15 @@ mod tests {
assert_eq!(format!("{}", Token::Code(code.clone())), "Tk:Code [open]");
code.open = false;
- assert_eq!(
- format!("{}", Token::Code(code.clone())),
- "Tk:Code [closed]"
- );
+ assert_eq!(format!("{}", Token::Code(code)), "Tk:Code [closed]");
+ }
+
+ #[test]
+ fn flatten() {
+ let code = Code::new(true);
+ assert_eq!(code.flatten(), "");
+
+ let token = Token::Code(code);
+ assert_eq!(token.flatten(), "");
}
}
diff --git a/src/syntax/content/parser/token/header.rs b/src/syntax/content/parser/token/header.rs
index 1f5fe02..9de3b5d 100644
--- a/src/syntax/content/parser/token/header.rs
+++ b/src/syntax/content/parser/token/header.rs
@@ -322,4 +322,13 @@ mod tests {
format!("Header [unknown L1 DOM ID {payload}]")
);
}
+
+ #[test]
+ fn flatten() {
+ let header = Header::new(Level::Two, true, Some("MNxqaFfIbCzw"));
+ assert_eq!(header.flatten(), "");
+
+ let token = Token::Header(header);
+ assert_eq!(token.flatten(), "");
+ }
}
diff --git a/src/syntax/content/parser/token/item.rs b/src/syntax/content/parser/token/item.rs
index a0b8321..0e36144 100644
--- a/src/syntax/content/parser/token/item.rs
+++ b/src/syntax/content/parser/token/item.rs
@@ -53,11 +53,21 @@ mod tests {
#[should_panic(
expected = "Items should only be rendered by a list's render method"
)]
- fn render() {
+ fn token_render() {
let item = Item::new("aCNuZwwzrt", None);
item.render();
}
+ #[test]
+ #[should_panic(
+ expected = "Items should only be rendered by a list's render method"
+ )]
+ fn render() {
+ let item = Item::new("vuv3ipykTzuf", None);
+ let token = Token::Item(item);
+ token.render();
+ }
+
#[test]
fn probe() {
let lexeme = Lexeme::new("bOa", "2R6", "4Mp");
@@ -80,7 +90,7 @@ mod tests {
);
item.depth = None;
assert_eq!(
- format!("{}", Token::Item(item.clone())),
+ format!("{}", Token::Item(item)),
"Tk:Item [] dRMy4"
);
}
@@ -89,5 +99,6 @@ mod tests {
fn flatten() {
let item = Item::new("", None);
assert_eq!(item.flatten(), "");
+ assert_eq!(Token::Item(item).flatten(), "");
}
}
diff --git a/src/syntax/content/parser/token/linebreak.rs b/src/syntax/content/parser/token/linebreak.rs
index 023efd7..65ccc73 100644
--- a/src/syntax/content/parser/token/linebreak.rs
+++ b/src/syntax/content/parser/token/linebreak.rs
@@ -28,7 +28,12 @@ mod tests {
#[test]
fn token_display() {
- let linebreak = LineBreak::default();
- assert_eq!(format!("{}", Token::LineBreak(linebreak)), "Tk:LineBreak");
+ assert_eq!(format!("{}", Token::LineBreak(LineBreak)), "Tk:LineBreak");
+ }
+
+ #[test]
+ fn flatten() {
+ assert_eq!(LineBreak.flatten(), "\n");
+ assert_eq!(Token::LineBreak(LineBreak).flatten(), "\n");
}
}
diff --git a/src/syntax/content/parser/token/list.rs b/src/syntax/content/parser/token/list.rs
index db7aff1..1120b9d 100644
--- a/src/syntax/content/parser/token/list.rs
+++ b/src/syntax/content/parser/token/list.rs
@@ -232,4 +232,13 @@ mod tests {
\n\n"
);
}
+
+ #[test]
+ fn flatten() {
+ let list = List::new(true);
+ assert_eq!(list.flatten(), "[List: 0 items]");
+
+ let token = Token::List(List::new(true));
+ assert_eq!(token.flatten(), "[List: 0 items]");
+ }
}
diff --git a/src/syntax/content/parser/token/literal.rs b/src/syntax/content/parser/token/literal.rs
index 6991fb0..236ee41 100644
--- a/src/syntax/content/parser/token/literal.rs
+++ b/src/syntax/content/parser/token/literal.rs
@@ -23,7 +23,7 @@ impl Parseable for Literal {
impl std::fmt::Display for Literal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- write!(f, "Literal {}", crate::log::wrap(&self.text))
+ write!(f, "Literal {}", crate::dev::log::wrap(&self.text))
}
}
@@ -43,9 +43,14 @@ mod tests {
);
literal.text = String::from("TjY02");
- assert_eq!(
- format!("{}", Token::Literal(literal.clone())),
- "Tk:Literal TjY02"
- );
+ assert_eq!(format!("{}", Token::Literal(literal)), "Tk:Literal TjY02");
+ }
+
+ #[test]
+ fn flatten() {
+ let payload = "vJtsvWD7ErYB";
+ let literal = Literal::lex(&Lexeme::new(payload, "", ""));
+ assert_eq!(literal.flatten(), payload);
+ assert_eq!(Token::Literal(literal).flatten(), payload);
}
}
diff --git a/src/syntax/content/parser/token/oblique.rs b/src/syntax/content/parser/token/oblique.rs
index fa12ba2..a156a19 100644
--- a/src/syntax/content/parser/token/oblique.rs
+++ b/src/syntax/content/parser/token/oblique.rs
@@ -64,7 +64,7 @@ mod tests {
oblique.open = false;
assert_eq!(
- format!("{}", Token::Oblique(oblique.clone())),
+ format!("{}", Token::Oblique(oblique)),
"Tk:Oblique [closed]"
);
}
@@ -73,5 +73,8 @@ mod tests {
fn flatten() {
let oblique = Oblique::new(false);
assert_eq!(oblique.flatten(), "");
+
+ let token = Token::Oblique(oblique);
+ assert_eq!(token.flatten(), "");
}
}
diff --git a/src/syntax/content/parser/token/paragraph.rs b/src/syntax/content/parser/token/paragraph.rs
index ab635d2..c0756af 100644
--- a/src/syntax/content/parser/token/paragraph.rs
+++ b/src/syntax/content/parser/token/paragraph.rs
@@ -89,8 +89,19 @@ mod tests {
paragraph.open = None;
assert_eq!(
- format!("{}", Token::Paragraph(paragraph.clone())),
+ format!("{}", Token::Paragraph(paragraph)),
"Tk:Paragraph [unknown]"
);
}
+
+ #[test]
+ fn flatten() {
+ let open = Paragraph::new(true);
+ let closed = Paragraph::new(false);
+
+ assert_eq!(open.flatten(), "");
+ assert_eq!(closed.flatten(), "");
+ assert_eq!(Token::Paragraph(open).flatten(), "");
+ assert_eq!(Token::Paragraph(closed).flatten(), "");
+ }
}
diff --git a/src/syntax/content/parser/token/preformat.rs b/src/syntax/content/parser/token/preformat.rs
index 1ca0128..f24bbc4 100644
--- a/src/syntax/content/parser/token/preformat.rs
+++ b/src/syntax/content/parser/token/preformat.rs
@@ -1,46 +1,42 @@
use crate::syntax::content::{Lexeme, Parseable};
-#[derive(Debug, Clone, Eq, PartialEq)]
+#[derive(Debug, Default, Clone, Eq, PartialEq)]
pub struct PreFormat {
- open: Option,
+ pub text: String,
}
impl PreFormat {
- pub const fn new(open: bool) -> PreFormat { PreFormat { open: Some(open) } }
+ pub fn new(text: &str) -> PreFormat {
+ PreFormat {
+ text: String::from(text),
+ }
+ }
}
impl std::fmt::Display for PreFormat {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- let display_open_state = if let Some(open_state) = self.open {
- if open_state { "open" } else { "closed" }
+ let character_count = self.text.chars().count();
+ let is_whitespace = self.text.trim_ascii().is_empty();
+ let summary = if is_whitespace {
+ "empty"
} else {
- "unknown"
+ &format!("{character_count} chars")
};
- write!(f, "PreFormat [{display_open_state}]")
+ write!(f, "PreFormat [{summary}]")
}
}
impl Parseable for PreFormat {
fn probe(lexeme: &Lexeme) -> bool {
- lexeme.match_first_char('`') && (lexeme.next() == "\n" || lexeme.last())
+ lexeme.match_char('`') && (lexeme.next() == "\n" || lexeme.last())
}
- fn lex(_lexeme: &Lexeme) -> PreFormat { PreFormat { open: None } }
-
- fn render(&self) -> String {
- if let Some(o) = self.open {
- if o {
- "
".to_owned()
- } else {
- "
".to_owned()
- }
- } else {
- panic!(
- "Attempt to render a preformat tag while open state is unknown"
- )
- }
+ fn lex(_lexeme: &Lexeme) -> PreFormat {
+ panic!("Attempt to lex a preformat directly from a lexeme")
}
+ fn render(&self) -> String { format!("
\n");
@@ -67,11 +70,100 @@ impl Parseable for Table {
xml
}
- fn flatten(&self) -> String { String::default() }
+ fn flatten(&self) -> String { String::from("[Table]") }
}
impl std::fmt::Display for Table {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- write!(f, "Table")
+ let headers_width = self.headers.len();
+ let contents_height = self.contents.len();
+ let contents_width = self.last_row_count();
+
+ let mut extra = String::default();
+ if headers_width > 0 && contents_height > 0 {
+ extra = format!(
+ " [{contents_width}x{contents_height} +{headers_width} headers]"
+ );
+ } else if headers_width > 0 {
+ extra = format!(" [+{headers_width} headers]");
+ } else if contents_height > 0 {
+ extra = format!(" [{contents_width}x{contents_height}]");
+ }
+
+ write!(f, "Table{extra}")
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::syntax::content::parser::Token;
+
+ #[test]
+ #[should_panic(expected = "Attempt to lex a table directly from a lexeme")]
+ fn lex() {
+ let lexeme = Lexeme::new("tp0h", "rrFt", "Qouf");
+ Table::lex(&lexeme);
+ }
+
+ #[test]
+ fn flatten() {
+ assert_eq!(Table::default().flatten(), "[Table]");
+ assert_eq!(Token::Table(Table::default()).flatten(), "[Table]");
+ }
+
+ #[test]
+ fn display() {
+ use std::string::ToString;
+
+ let mut table = Table::default();
+ table.add_header("A");
+ table.add_header("B");
+ table.add_header("C");
+
+ let table_token = Token::Table(table.clone());
+ assert_eq!(format!("{table}"), "Table [+3 headers]");
+ assert_eq!(format!("{table_token}"), "Tk:Table [+3 headers]");
+
+ table.add_row(
+ ["1", "2", "3"]
+ .iter()
+ .map(ToString::to_string)
+ .collect::>(),
+ );
+ table.add_row(
+ ["4", "5", "6"]
+ .iter()
+ .map(ToString::to_string)
+ .collect::>(),
+ );
+ table.add_row(
+ ["7", "8", "9"]
+ .iter()
+ .map(ToString::to_string)
+ .collect::>(),
+ );
+
+ let table_token2 = Token::Table(table.clone());
+ assert_eq!(format!("{table}"), "Table [3x3 +3 headers]");
+ assert_eq!(format!("{table_token2}"), "Tk:Table [3x3 +3 headers]");
+
+ let mut table2 = Table::default();
+ table2.add_row(
+ ["1", "2", "3"]
+ .iter()
+ .map(ToString::to_string)
+ .collect::>(),
+ );
+ table2.add_row(
+ ["2", "4", "6"]
+ .iter()
+ .map(ToString::to_string)
+ .collect::>(),
+ );
+
+ let table2_token = Token::Table(table2.clone());
+ assert_eq!(format!("{table2}"), "Table [3x2]");
+ assert_eq!(format!("{table2_token}"), "Tk:Table [3x2]");
}
}
diff --git a/src/syntax/content/parser/token/underline.rs b/src/syntax/content/parser/token/underline.rs
index bf60f1d..0cd565e 100644
--- a/src/syntax/content/parser/token/underline.rs
+++ b/src/syntax/content/parser/token/underline.rs
@@ -66,7 +66,7 @@ mod tests {
underline.open = false;
assert_eq!(
- format!("{}", Token::Underline(underline.clone())),
+ format!("{}", Token::Underline(underline)),
"Tk:Underline [closed]"
);
}
@@ -75,5 +75,8 @@ mod tests {
fn flatten() {
let underline = Underline::new(false);
assert_eq!(underline.flatten(), "");
+
+ let token = Token::Underline(underline);
+ assert_eq!(token.flatten(), "");
}
}
diff --git a/src/syntax/content/parser/token/verse.rs b/src/syntax/content/parser/token/verse.rs
index 919929a..f3f7910 100644
--- a/src/syntax/content/parser/token/verse.rs
+++ b/src/syntax/content/parser/token/verse.rs
@@ -3,16 +3,10 @@ use crate::syntax::content::{Parseable, parser::Lexeme};
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Verse {
open: Option,
- citation: Option,
}
impl Verse {
- pub const fn new(open: bool) -> Verse {
- Verse {
- open: Some(open),
- citation: None,
- }
- }
+ pub const fn new(open: bool) -> Verse { Verse { open: Some(open) } }
pub fn probe_end(lexeme: &Lexeme) -> bool {
lexeme.match_char_triple('\n', '&', '\n')
@@ -24,12 +18,7 @@ impl Parseable for Verse {
lexeme.match_char_triple('\n', '&', '\n')
}
- fn lex(_lexeme: &Lexeme) -> Verse {
- Verse {
- open: None,
- citation: None,
- }
- }
+ fn lex(_lexeme: &Lexeme) -> Verse { Verse { open: None } }
fn render(&self) -> String {
if let Some(open) = self.open {
@@ -59,12 +48,54 @@ impl std::fmt::Display for Verse {
None => "unknown",
};
- let citation = if self.citation.is_some() {
- " cited"
- } else {
- ""
- };
-
- write!(f, "Verse [{display_open_state}{citation}]")
+ write!(f, "Verse [{display_open_state}]")
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::syntax::content::parser::Token;
+
+ #[test]
+ fn lexed_verse_is_empty() {
+ let verse = Verse::lex(&Lexeme::default());
+ assert!(verse.open.is_none());
+ }
+
+ #[test]
+ fn flatten() {
+ let verse = Verse::new(true);
+ assert!(verse.flatten().is_empty());
+
+ let token = Token::Verse(verse);
+ assert_eq!(token.flatten(), "");
+ }
+
+ #[test]
+ #[should_panic(
+ expected = "Attempt to render a verse tag while open state is unknown"
+ )]
+ fn render_attempt_with_unknown_open_state() {
+ let verse = Verse::lex(&Lexeme::default());
+ verse.render();
+ }
+
+ #[test]
+ fn display() {
+ let open = Verse::new(true);
+ let open_token = Token::Verse(open.clone());
+ assert_eq!(format!("{open}"), "Verse [open]");
+ assert_eq!(format!("{open_token}"), "Tk:Verse [open]");
+
+ let closed = Verse::new(false);
+ let closed_token = Token::Verse(closed.clone());
+ assert_eq!(format!("{closed}"), "Verse [closed]");
+ assert_eq!(format!("{closed_token}"), "Tk:Verse [closed]");
+
+ let unknown = Verse::lex(&Lexeme::default());
+ let unknown_token = Token::Verse(unknown.clone());
+ assert_eq!(format!("{unknown}"), "Verse [unknown]");
+ assert_eq!(format!("{unknown_token}"), "Tk:Verse [unknown]");
}
}
diff --git a/static/graph-schema.json b/static/graph-schema.json
new file mode 100644
index 0000000..95c177a
--- /dev/null
+++ b/static/graph-schema.json
@@ -0,0 +1,80 @@
+{
+ "$id": "https://git.jutty.dev/jutty/en/raw/branch/main/static/graph-schema.json",
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "title": "Graph",
+ "description": "An en graph file",
+ "type": "object",
+ "$defs": {
+ "node": {
+ "type": "object",
+ "title": "Node",
+ "description": "A node object.",
+ "example": "[nodes.Earth]\ntext = \"Earth is a planet of the solar system.\"",
+ "default": null,
+ "properties": {
+ "text": {
+ "type": "string",
+ "description": "The text content of this node."
+ },
+ "title": {
+ "type": "string",
+ "description": "The node display title, useful to make it distinct from the ID.",
+ "default": "The node's ID."
+ },
+ "listed": {
+ "type": "boolean",
+ "description": "Whether this node is shown in listing pages.",
+ "default": true
+ },
+ "redirect": {
+ "type": "string",
+ "description": "A node ID to where any requests for this node will be redirected.",
+ "default": null
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "properties": {
+ "root_node": {
+ "type": "string",
+ "title": "Root node ID",
+ "description": "The ID of node highlighted in the homepage as the graph root.",
+ "example": "MyNode",
+ "default": null
+ },
+ "nodes": {
+ "title": "Nodes",
+ "description": "The graph's nodes.",
+ "default": null,
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/$defs/node"
+ },
+ "propertyNames": {
+ "pattern": "^[^-][^!@#$%^&*;:/~| \\]\\[()\\\\]*$"
+ }
+ },
+ "meta": {
+ "type": "object",
+ "properties": {
+ "config": {
+ "type": "object",
+ "properties": {
+ "content_language": { "type": "string" },
+ "footer_credits": { "type": "boolean" },
+ "error_poem": { "type": "boolean" },
+ "node_selector": { "type": "boolean" },
+ "navbar_search": { "type": "boolean" },
+ "about": { "type": "boolean" },
+ "footer_text": { "type": "string" },
+ "acknowledgments": { "type": "string" }
+ },
+ "additionalProperties": false
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "additionalProperties": false
+}
diff --git a/static/graph.toml b/static/graph.toml
index c15418d..df35c11 100644
--- a/static/graph.toml
+++ b/static/graph.toml
@@ -1,6 +1,45 @@
-root_node = "Documentation"
+#:schema ./graph-schema.json
-[nodes.Documentation]
+root_node = "Introduction"
+
+[nodes.Introduction]
+text = """
+## What is en?
+
+en is a writing tool. It was designed for complex, conceptually heavy projects, where the relationships between terms matter and possibly have their own attributes. You can use it to write non-linear, connected textual works and have their references to which other mapped out as a |graph| of metadata-rich, interrelated information. This very website is running en.
+
+It works by ingesting plain text files written in |TOML|, a file format that focuses on being human-readable but that can also be directly interpreted by computer programs. These files contain your node definitions and allow en to construct a human-readable website that makes your graphs' nodes browsable, searchable and listed in relation to each other or as a shallow tree of nodes. It also serves this graph as raw data for integration with other tools that can further analyze and transform what you have written.
+
+## Motivation
+
+en was created out of the desire to write a book that did not follow a linear progression. But it can be used for note-taking, studying, documentation, encyclopedic content and any other format that benefits from a focus on the connections between pages. It aims to remove the constraints imposed by trying to mimic the linearity of typical nonfiction writing.
+
+It's described as a "writing instrument" because it's not so much about the presentation or even the web format. While that's the medium for this particular implementation, you can notice en serves its raw data in both TOML and JSON. It's first and foremost about mapping out and structuring written thoughts.
+
+Because your en graph is defined in simple plain-text files, you can add new pages easily from a few lines and start connecting them. Instead of having to create a dedicated file or resource for each new entry you find deserving of observation, with its own beginning and end, its own "I'm empty, fill me to completion" demeanor, you can stay in the flow of your sprawling thoughts. This is meant to fit the specific wiring of minds whose thoughts spread and fork quickly and often, whether to great depth or across wide expanses.
+
+## What's ahead
+
+en is in its infancy. Right now, most of the work is focused on making the markup syntax more robust. Some interesting features planned include:
+
+- Multi-file graphs, including single-file node definitions with TOML frontmatter
+- Richer node connection metadata, with builtin connection kinds and special rendering styles
+- More node metrics, sorting options and full-text search
+- New render formats: static website, single page and PDF/EPUB formats with paper-friendly metadata
+- JSON schema for language server integration
+- Separating the server from the source-to-source translator, allowing en's markup syntax to be used as a standalone compile-to-HTML language
+- Adding CLI options to make it more practical to manipulate a graph, such as adding new nodes or querying your graphagarn
+- Hypergraphs, enabling cross-graph references and letting the user choose which graph to render
+
+If you like what you see and are curious about en's future, take a look at the |roadmap| for a more comprehensive view of what else is to come.
+
+## Get started
+
+See the |Get Started|GetStarted| page to learn how to install and use en.
+"""
+
+[nodes.GetStarted]
+title = "Get Started"
text = """
## Installation
@@ -13,7 +52,7 @@ x64 Linux binaries are available from the |git.jutty.dev package registry|https:
%
Platform ! Download
x64 Linux GNU | |en-x64-linux-gnu|https://git.jutty.dev/api/packages/jutty/generic/en/{{ en_version }}/en-x64-linux-gnu|
- x64 Linux musl | |en-x64-linux-musl|https://git.jutty.dev/api/packages/jutty/generic/en/{{ en_version }}/en-x64-linux-musl|
+ x64 Linux musl | |en-x64-linux-musl|https://git.jutty.dev/api/packages/jutty/generic/en/{{ en_version }}/en-x64-linux-musl |
%
If in doubt, it is likely your system uses the GNU libc. Regardless, the musl binary is statically compiled and should run on mostly any x64 Linux system.
@@ -22,7 +61,7 @@ Other platforms may be supported in the future depending on CI resources.
### Build from source
-If you are on another platform or simply paranoid, you can also build en yourself.
+If you are on another platform or simply prefer starting from source, you can also build en yourself.
You will need:
@@ -37,7 +76,7 @@ cargo install --git https://codeberg.org/jutty/en --tag v{{ en_version }}
And you should now have the `en` command available on your shell.
-The `cargo install` example shown above will build en from the latest tagged release, which should be more stable. You can remove the `--tag v{{ en_version }}` part if you'd like to build the very latest development sources.
+The `cargo install` example shown above will build en from the last tagged release, which should be more stable. You can remove the `--tag v{{ en_version }}` part if you'd like to build the most recent development sources.
For more details on building from source, see |SourceBuild|.
@@ -71,11 +110,13 @@ The main electronic component of a computer is its |motherboard|.
\"""
`
+In |the future|Roadmap, en should support both individual node files with TOML frontmatter and also multiple TOML files containing several nodes each. In the current implementation, all nodes live in a single `graph.toml` file.
+
Some special syntax is allowed inside the node text. See |Syntax| for supported features.
A node can have several other attributes. See |Node| for details on all of them.
-## Connections
+### Connections
Nodes can have connections between each other. Each node page lists its outgoing and incoming connections.
@@ -83,48 +124,77 @@ The simplest kind of connection is achieved by creating an anchor to another nod
`
[nodes.Quark]
-text = "Quarks are subatomic particles that form |hadron|s".
+text = "Quarks are subatomic particles that form |hadron|s."
`
Here, a connection is created from the node with ID `Quark` to the node with ID `Hadron`. See |AnchorSyntax| for the various ways you can link to other nodes from within the node text itself.
-Even if a node is not mentioned in the node text, you can still add connections to it. For simple connections without any associated properties, you can simply add links:
+There are several different ways to connect nodes, including ones where you can add metadata to the connection itself. See |Connections| for more details.
+
+## Where to go from here
+
+- Dive deeper into the |syntax| used to write your graph
+- Glimpse into en's future in the |roadmap|
+- Visit the |data endpoints|/data| for a raw view of the graph
+- See an index of all pages in the |tree|/tree|
+- Look under the hood in the |source code|https://codeberg.org/jutty/en repo
+"""
+
+[nodes.Connections]
+text = """
+A connection is a link from one node to another. As shown in |GetStarted|, the simplest way to create them is by adding an |anchor|Syntax#Anchors| in the node text itself. However, there are other ways to create connections between nodes.
+
+## Links
+
+Even if a node is not mentioned in the node text, you can still add connections to it.
+
+For simple connections without any associated properties, you can simply add links, which are lightweight connections without any metadata aside from the automatically determined source and destination:
`
[nodes.Quark]
text = "A subatomic particle that forms hadrons."
-links = [ "Particle", "Hadron" ]
-`
+links = [ "Particle", "Hadron" ] `
This will create two outgoing connections from Quark: to Particle and to Hadron.
-For metadata-rich connections, which allow you to add properties to the connection, you can use the full connection syntax:
+## Rich connections
+
+For richer connections that have their own properties, you can use the full connection syntax:
`
-[[nodes.Realism.connections]]
-to = "Surrealism"
-kind = "contrast"
+[nodes.Earth.connections.Moon]
+kind = "Satellite"
+
+[nodes.Earth.connections.MilkyWay]
+kind = "Galaxy"
`
-This will create a connection from the node with ID `Realism` to a node with ID `Surrealism` and add the "contrast" kind to the connection. See |Connections| for the existing kinds and how they affect your graph.
+This will create connections from the node with ID `Earth` to the nodes with ID `Moon` and `MilkyWay` and add the "Satellite" and "Galaxy" kinds to each connection, respectively. This will add a corresponding CSS class with the same name to the connection when it's rendered so you can style it in special ways and is also reflected in the |output formats|outputs.
"""
-[nodes.docs]
-redirect = "Documentation"
-hidden = true
+[nodes.Outputs]
+text = """
+en take as its input one or more graph files containing your node definitions. It then processes your graph, looks for connections and configuration values and produces one or more outputs depending on your settings:
+
+- A browsable, live-served website (such as this one)
+- A |TOML| representation of the graph that can be used as a basis to generate other, adapted graphs
+- A JSON representation of the graph that can be further analyzed and interpreted with third-party tools
+
+The output formats are not simply a translation of the input, but enrich them. Among other things, they translate en's |markup syntax|Syntax into HTML, add metrics about how nodes are connected and flag which missing nodes are most sought after by dangling connections.
+"""
[nodes.SourceBuild]
text = """
-An overview on building from source is available in the |Documentation| page. This page contains a more detailed and considered approach for those interested.
+An overview on building from source is available in the |Get Started|GetStarted#Build page. This page contains a more detailed and considered approach for those interested.
-Source builds are tested on both Debian and Alpine, meaning en should compile and run on both glibc and musl systems.
+en is developed on NixOS and builds are tested on both Debian and Alpine, meaning en should compile and run on both glibc and musl systems.
## Dependencies
A Rust toolchain is required to build en itself and can be installed through |rustup|https://rustup.rs/|.
-For compiling en dependencies, you will also need a C toolchain: a compiler and a libc (e.g. `gcc` + `glibc` or `clang` + `musl`), which may already be installed on your system.
+For compiling the en dependencies, you will also need a C toolchain: a compiler and a libc (e.g. `gcc` + `glibc` or `clang` + `musl`), which may already be installed on your system.
For the two tested systems, all you need are the following packages:
@@ -138,7 +208,7 @@ You may also need `curl`, `git` and `ca-certificates` depending on how you will
## Building from a Git clone
-Aside from the `cargo install` approach described in |Documentation|, you can alternatively fetch the code yourself using Git, which allows you to inspect and change it before compiling:
+Aside from the `cargo install` approach described in |GetStarted|GetStarted#Build, you can alternatively fetch the code yourself using Git, which allows you to inspect and change it before compiling:
`
git clone -b v{{ en_version }} --single-branch https://codeberg.org/jutty/en
@@ -164,7 +234,7 @@ A node is defined in your graph file starting with a table header of the form:
Where `ID` is an identifier of your choice.
-While the |TOML| specification is quite flexible regarding what characters can make up this identifier, it's recommended that you keep it simple and use only letters and numbers. See |AnchorSyntax| for more details on why.
+While the |TOML| specification is quite flexible regarding what characters can make up this identifier, it's recommended that you keep it simple. Non-English characters are fine, but characters with special meaning in |en syntax|Syntax and URL parsing might lead to unexpected results. See |AnchorSyntax| for details.
## Fields
@@ -174,14 +244,14 @@ Nodes can have several optional fields that alter how en interprets and displays
- `text`: The textual content that is shown when the node is accessed
- `redirect`: Where to redirect any attempt to access the node
- `links`: An array of identifiers for other nodes to which this node is connected
-- `hidden`: Whether this node should be listed in the index and tree pages. This won't prevent the node from being found or linked to directly through its ID
+- `listed`: Whether this node should be listed in the index and tree pages. This won't prevent the node from being found or linked to directly through its ID
## Example
`
[nodes.Citrus]
title = "Citrus Trees"
-hidden = false
+listed = true
text = "Citrus is a |genus| of trees known mainly for its fruits."
redirect = "Citric"
links = [ "Orange", "Lemon", "Lime", "Grapefruit", ]
@@ -193,7 +263,7 @@ to = "Citric acid"
### Default values
-The example above has all fields in it for completeness, but all fields have default values and are therefore optional. This means that explicitly writing `hidden = false` is the same as not setting it at all.
+The example above has all fields in it for completeness, but all fields have default values and are therefore optional. This means that explicitly writing `listed = true` is the same as not setting it at all.
The default values for unset fields are:
@@ -201,7 +271,7 @@ The default values for unset fields are:
- `text`: An empty string (i.e. `text = ""`)
- `redirect`: An empty string
- `links`: An empty array (i.e. `links = []`)
-- `hidden`: `false`
+- `listed`: `true`
"""
[nodes.CLI]
@@ -209,32 +279,58 @@ title = "CLI Options"
text = """
You can set the hostname, port and graph file path using CLI options:
-For the hostname, use `-h` or `--hostname`:
-
`
-en -h localhost
-en --hostname 10.120.0.5
+en --hostname 10.0.1.2 -p 443 --graph ./graphs/my-graph.toml
`
-If unspecified, the default is `0.0.0.0`.
+## Options
-For the port, use `-p` or `--port`:
+### Graph
-`
-en -p 3003
-en --port 3000
-`
+The relative or absolute path to the graph definition |TOML| file.
-If unspecified, the default is to use a random available port assigned by the operating system.
+*Variants:* `--graph`, `-g`
-For the graph path, use `-g` or `--graph`:
+*Default:* `./static/graph.toml`
+
+*Examples:*
`
en -g graph.toml
en --g ./static/my-graph.toml
`
-If unspecified, the default is `./static/graph.toml`.
+### Hostname
+
+The IP address where the en server will be accessible.
+
+*Variants:* `--hostname`, `-h`
+
+*Default:* `0.0.0.0`
+
+*Examples:*
+
+`
+en -h localhost
+en --hostname 10.120.0.5
+`
+
+### Port
+
+The port where the en server will be accessible.
+
+*Variants:* `--port`, `-p`
+
+*Default:* A random available port assigned by the operating system
+
+*Examples:*
+
+`
+en -p 3003
+en --port 3000
+`
+
+## Using multiple options
You can combine these options as you wish:
@@ -269,6 +365,12 @@ particles|ParticlePhysics
This example will render as the word "particles" pointing to a node with ID `ParticlePhysics` because the destination is not an external URL.
+When both sides are the same, you can simply write:
+
+`
+|ParticlePhysics|
+`
+
An external anchor looks like this:
`
@@ -283,55 +385,25 @@ If the left side contains spaces, you need a leading `|` character:
|en docs|https://en.jutty.dev/node/Documentation
`
-To make a plain address clickable, wrap it in two `|` characters:
+To make a plain address an anchor, wrap it in two `|` characters:
`
|https://en.jutty.dev|
`
-### Trailing characters in anchors
-
-For internal anchors, most punctuation is automatically separated from the anchor destination so you can simply write:
-
-`
-This gem|PreciousStone, though green, was not an emerald.
-`
-
-> This gem|PreciousStone, though green, was not an emerald.
-
-However, for external anchors, you want to add a third `|` to explicitly set the end because external URLs can have all sorts of arbitrary characters.
-
### Node anchors
Because anchors between nodes are central to en, there is special syntax to make them as fluid as possible to create without cluttering the text too much.
-A node ID wrapped in two `|` characters will become an anchor to that node:
+en can resolve IDs case insensitively (with priority to case-sensitive matches), will ignore trailing punctuation and a single `s` character for plurals, and will also collapse spaces when trying to resolve an ID, so you can also write:
`
-|ParticlePhysics|
+check out the en |documentation|, or look at the |example|s.
`
-en can resolve IDs case insensitively (with priority to case-sensitive matches) and will also collapse spaces when trying to resolve an ID, so you can also write:
+If there is a node with id Documentation and another with id Example, they'd be linked to by the linked anchors.
-`
-check out the |en documentation|
-`
-
-And if an anchor with the id `enDocumentation` or any other case-insensitive combination exists, it will land on it.
-
-In summary, all of the anchors below are valid and lead to the same page:
-
-`
-|syntax|Syntax
-Syntax|syntax
-Syntax|syn tax|
-
-|Syntax|
-|syntax|
-|syn tax|
-`
-
-While flexible, this can sometimes be ambiguous. See |AnchorSyntax| for some caveats regarding anchors.
+While flexible, this can sometimes be ambiguous. See |AnchorSyntax| for more details and caveats regarding anchors.
## Formatting
@@ -464,18 +536,18 @@ You can still use `<` characters to force line breaks in this case.
To add a citation to your quote block, start a line with two `-` characters:
`
-> with no more communion
-> to down as morning pick-me-ups
-> to sweeten afternoon naps
-> to soothe nightmares
--- Assotto Saint, The Language of Dust
+> i sat down next to her
+> with a large frosty _bandito_
+> she gazed at the ghost of me
+> asked _“amigo, como esta”_
+-- Assotto Saint, Lady & Me
`
-> with no more communion
-> to down as morning pick-me-ups
-> to sweeten afternoon naps
-> to soothe nightmares
--- Assotto Saint, The Language of Dust
+> i sat down next to her
+> with a large frosty _bandito_
+> she gazed at the ghost of me
+> asked _“amigo, como esta”_
+-- Assotto Saint, Lady & Me
If you have a more complex citation, you can use multiple lines starting with `--`. All such lines will be joined together in the citation. If you need to break lines, use the `<` character at the end of a line:
@@ -484,7 +556,7 @@ If you have a more complex citation, you can use multiple lines starting with `-
o mito da índole pacífica do brasileiro e o da "democracia racial".
-- Benedita da Silva,
-- |Speech on the Federal Senate|https://www25.senado.leg.br/web/atividade/pronunciamentos/-/p/pronunciamento/165765|,
--- March 3rd, 1995, <
+-- March 3rd, 1995 <
-- International Day for the Elimination of Racial Discrimination
`
@@ -492,7 +564,7 @@ If you have a more complex citation, you can use multiple lines starting with `-
o mito da índole pacífica do brasileiro e o da "democracia racial".
-- Benedita da Silva,
-- |Speech on the Federal Senate|https://www25.senado.leg.br/web/atividade/pronunciamentos/-/p/pronunciamento/165765|,
--- March 3rd, 1995, <
+-- March 3rd, 1995 <
-- International Day for the Elimination of Racial Discrimination
The first URL found in your citation will be used as the blockquote element's `cite` value.
@@ -523,26 +595,48 @@ Lines starting with a `+` character will create numbered lists instead:
+ ni
+ san
+In both kinds of lists, you can use an uniform amount of indentation to nest the items:
+
+`
+- purple
+ - red
+ - blue
+- orange
+ - red
+ - yellow
+ - red
+ - green
+`
+
+- purple
+ - red
+ - blue
+- orange
+ - red
+ - yellow
+ - red
+ - green
+
### Tables
Tables are blocks delimited by a sole `%` on its own line:
`
%
- Country ! Capital
- Colombia | Bogotá
- Belgium | Brussels
- Palestine | Jerusalem
- Zambia | Lusaka
+ Country ! Capital
+ Colombia | Bogotá
+ Belgium | Brussels
+ Palestine | Jerusalem
+ Zambia | Lusaka
%
`
%
- Country ! Capital
- Colombia | Bogotá
+ Country ! Capital
+ Colombia | Bogotá
Belgium | Brussels
- Palestine | Jerusalem
- Zambia | Lusaka
+ Palestine | Jerusalem
+ Zambia | Lusaka
%
Table cells are delimited by either a `!` for headers or `|` for common cells. These delimiters must be surrounded by at least one space to each side and are optional at the first and last position of each line.
@@ -593,7 +687,7 @@ Finally, you can precede any character with a `\\\\` to fully _escape_ that char
## Raw HTML
-If you need some more advanced feature that is not supported directly by en's markup snytax, you can always just write plain HTML and it will be passed along. For example, you could render a form:
+If you need some more advanced feature that is not supported directly by en's markup syntax, you can always just write plain HTML and it will be passed along. For example, you could render a form:
`
<form style="text-align: center;">
@@ -612,6 +706,10 @@ If you need some more advanced feature that is not supported directly by en's ma
Notice that, as shown in this example, you can mix en syntax and HTML. You might want to add a space between your HTML tags and en special syntax so the boundary is clearer, but otherwise they don't tend to overlap since the symbols most used in HTML are not special in en with the exception of `<`, which is interpreted specially only at the end of lines.
If you want to avoid either one of these syntaxes from being interpreted specially, you should escape the relevant characters as explained in the previous section.
+
+## Known issues
+
+- Nesting multiple different formatting symbols is currently supported only in a few cases. Better nesting is on the |roadmap|, but currently may not work as expected.
"""
[nodes.Escaping]
@@ -628,11 +726,11 @@ Notice that |TOML| itself also handles escape codes, so to pass a backslash you
`
[node.Double]
-text = "You need double slashes to escape an asterisk here: \\\\\\\\*"
+text = "You need double slashes here: \\\\\\\\*"
[node.TripleDouble]
text = \"""
-Just like here: \\\\\\\\*
+And here: \\\\\\\\*
\"""
[node.Single]
@@ -644,7 +742,7 @@ Here too: \\\\*
'''
`
-This has nothing to do with en's markup syntax per se, it's just a consequence of how backslashes are also special in TOML syntax. For more details, see the |TOML documentation on Strings|https://toml.io/en/v1.1.0#string|.
+This has nothing to do with en's markup syntax _per se_, it's just a consequence of how backslashes are also special in TOML syntax. For more details, see the |TOML documentation on Strings|https://toml.io/en/v1.1.0#string|.
## Interactions with HTML
@@ -652,7 +750,7 @@ en will happily accept HTML code and pass it along to the browser, so you can us
If you want to prevent a particular part of your text from being interpreted as HTML, you can escape it |as you normally would|https://developer.mozilla.org/en-US/docs/Glossary/Character_reference|.
-The fact you are using HTML does not exclude en syntax from being interpreted, although this may change in the future. Presently, you need to escape en markup syntax if you want it printed literally even inside HTML tags. This matters because en uses its syntax to create connections between your graph's nodes and makes several decisions based on these relations.
+The fact you are using HTML does not exclude en syntax from being interpreted, although this may change in the future. Presently, you need to escape en markup syntax if you want it printed literally even inside HTML tags. This matters because en |uses its syntax to create connections|AnchorSyntax| between your graph's nodes and makes several decisions based on these relations.
"""
[nodes.AnchorSyntax]
@@ -662,37 +760,32 @@ en's anchor syntax can be very flexible, but some situations lead to ambiguity.
In short, following these two rules should keep you out of trouble:
-- *Avoid special characters in your node IDs*: |TOML| allows you to use a wide range of characters in identifiers, but when writing your graph it's better keep your IDs simple
-- When needed, use full three-pipe `|text|destination|` syntax to make your anchors fully unambiguous
+- *Avoid characters with special meanings in your node IDs*: |TOML| allows you to use a wide range of characters in identifiers, but when writing your graph it's better keep your IDs free of some characters. Accents and ideograms are fine, but characters such as `#`, `&`, `:` and `/` are not because they are interpreted differently by en and URL parsers, which might lead to unexpected results
+- *Know you can be explicit to force proper evaluation*: When needed, use full three-pipe anchors, as in `|text|destination|`, to make your anchors fully unambiguous
-## Punctuation in destinations
+## Basic anchor
+See the |Anchors section in the Syntax page|Syntax#Anchors| for the basic anchor syntax. The following sections go into more detail on some edge cases.
-Consider this example:
+### Trailing characters in anchors
+
+For internal anchors, most punctuation is automatically separated from the anchor destination so you can simply write:
`
-|gem|PreciousStone
-|PreciousStone|,
+This gem|PreciousStone, though green, was not an emerald.
`
-Both point to the node with ID `PreciousStone`, as they indeed _seem_ to. But if we didn't treat punctuation differently, we'd have:
+> This gem|PreciousStone, though green, was not an emerald.
-`
-|a|b
-|a|b
-`
+This is one of the reasons to avoid punctuation in your node IDs.
-For this reason, some symbols are treated specially at the trailing boundary of anchors.
-
-Punctuation won't be considered as a possible destination, so you can write the previous example and have it behave as expected.
-
-This is one of the reasons special symbols in your node IDs can lead to trouble.
-
-These are the punctuation symbols that are treated specially:
+The punctuation symbols that are ignored at the trailing boundary of anchors are:
`
, . : ; ? ! ( ) ' " ` | _ * \\
`
+For external anchors, you often must add a third `|` to explicitly set the end because external URLs can have all sorts of arbitrary characters. This is not necessary for spaces, but it is for other characters.
+
## Plural node anchors
Something similar applies to the lowercase letter `s`:
@@ -704,10 +797,10 @@ We found three |boat|s at the marina.
This conveniently lets you write plural words as anchors to their singular form without having to write:
`
-We found three boats|boat at the marina.
+We found three boats|Boat at the marina.
`
-Which is annoyting to write and also makes the text a lot noisier.
+Which is annoying to write and makes the text a lot less fluid.
Unlike with punctuation, this doesn't mean you can't have a node with the ID `s`. You can, but you'll have to write your anchors to it always with a trailing pipe:
@@ -717,50 +810,94 @@ The |letter s|s| is important so we dedicated a whole page to it: |s|!
## Spaced node anchors
-Like punctuation, node IDs shouldn't have spaces. If you write a node anchor with spaces, it will be collapsed:
+If you write a node anchor with spaces, it will be collapsed:
`
-This |Node Anchor| will work as if it were |Node Anchor|NodeAnchor|.
+This |Node Anchor| will work as if it were |NodeAnchor|.
`
-As long as you don't have a page with the ID `NodeanchoR` and another with the ID `NodeAnchor`, this shouldn't be a problem.
+Accordingly, node IDs should not have spaces because, among other things, this feature makes it impossible to create an anchor to them.
-Because node ID resolution redirects to a lowercase match as a fallback to an exact match, you can write:
+## Case-insensitive fallbacks
+
+Because node ID resolution redirects to a lowercase match if it can't find an exact match, you can write:
`
The next |precious stone| was stolen in 1973.
`
-And the visible text will be preserved as "precious stone" but be able to point to an ID such as `PreciousStone`.
+And the visible text will still display as "precious stone" but point to an ID such as `PreciousStone`.
+
+This is not a problem if you want to refer to a specific ID that differs only in case because the case-sensitive match takes priority.
## URL detection
en must differentiate node anchors from outgoing URLs:
`
-|sample|Example|
-|sample|https://example.com|
-
-|Example|
-|https://example.com|
+|internal|Internal|
+|external|https://external.example.com|
`
-It does this by looking at the destination and checking if it contains a `:`. That's one more reason to avoid this character in your node IDs.
+It does this by looking at the destination and checking if it contains a `/` or `:`. That's one more reason to avoid these characters in your node IDs.
"""
-[nodes.en]
+[nodes.Customization]
text = """
-en is a tool to write non-linear, connected pieces of text and have their references mapped out as a |graph| of connected information.
+You can customize several aspects of en by overriding its default templates, styles and other assets.
-It works by ingesting a |TOML| file containing your node specification and serving it as a website that allows nodes to be browsed, searched and listed in relation to each other or as a shallow tree of nodes.
+## The `public` directory
-## Motivation
+The `static/public` directory is searched by en in the current working directory and can also be |passed as a command line option|CLI. All files placed inside this directory will be served by the en server as static files. You can create directories and organize files as you see fit, and then reference them through custom templates and includes.
-en was created out of the desire to write complex, long-form descriptions of a personal worldview without being constrained or getting stuck trying to mimic the linearity of a typical philosophy book.
+If you place a file in a default path, it will override the default. Namely:
-It's described as a "writing instrument" because it's not so much about the presentation or even the web format. While that's the medium for this particular implementation, you can notice en serves its raw data in both TOML and JSON. It's first and foremost about mapping out and structuring written thoughts.
+- `static/public/assets/favicon.svg`: Website icon as seen on tabs and other UI elements
+- `static/public/assets/style.css`: Main CSS stylesheet
+- `static/public/assets/fonts/fonts.css`: Fonts CSS index mapping the default families `sans`, `serifed`, `mono`, `prose` and `title`. The `prose` family is used for paragraphs such as in the node text content, while the `sans` family is used for UI elements such as the navigation bar and footer.
+
+The en server supports a variety of file types including plain text; data formats such as CSV, TOML and JSON; various font and image formats; and document formats such as PDF and EPUB. If you want to serve a file with a mimetype that is not included among the |builtin ones|https://codeberg.org/jutty/en/src/branch/main/src/router/handlers/mime.rs|, you can use the `mimes` |configuration option|Configuration#mimes|. If you don't, the file will be served with mimetype `application/octet-stream`, which may or may not work depending on what you are actually serving and how it's being consumed.
+
+## Styles
+
+You can override the default CSS and fonts using custom CSS files.
+
+To completely override the default style, you can place your replacement at the default path as explained in the previous section.
+
+If you just want to add small customizations, this can be better accomplished by adding a CSS file as part of a custom headers include, as explained in the next section.
+
+## Templates
+
+en uses the Tera|https://keats.github.io/tera templating engine, which provides several features for creating your own templates.
+
+When starting up, en will look for a `templates` directory in the current working directory. For each template, it looks up the corresponding filename inside this directory. If it can't find one, it will fallback to a default template.
+
+For a list of templates along with their names, see the |templates directory|https://codeberg.org/jutty/en/src/branch/main/templates| in the source code repository.
+
+See the |Tera documentation|https://keats.github.io/tera/docs for a more extensive description of the available features for writing templates.
+
+### Includes
+
+Overriding an entire template can be very verbose, considering the default templates attempt to handle various edge cases.
+
+To make it easier to override the most common use cases, the following templates are consumed as "includes" in specific parts of the main templates if placed inside the `templates` directory with the suffix `.include.html`:
+
+- `header`: Included at the end of the default templates' base header
+- `post-body`: Included after the body in the default base template
+- `favicon`: Replaces the default favicon code
+- `styles`: Replaces the default CSS links
+- `footer`: Replaces the footer
+- `navigation`: Replaces the navigation bar
+- `index-header`: Replaces the block showing the title and subtitle of the website in the index page
+- `index-list`: Replaces the block showing the list of nodes in the index page
+
+For example, to override the block in the header of all pages that globally sets the CSS stylesheets, you can drop a file at `templates/styles.include.html` containing something like:
+
+`
+
+
+`
-Because en is defined in simple configuration files, you can add new pages easily from a few lines and start connecting them. Instead of having to create a dedicated file or resource for each new entry you find deserving of observation, with its own beginning and end, its own "I'm empty, fill me to completion" demeanor, you can stay in the flow of your sprawling thoughts. This is meant to fit the specific wiring of minds whose thoughts spread and fork quickly and often, whether to great depth or across wide expanses.
"""
[nodes.Graph]
@@ -776,9 +913,13 @@ en uses this concept to create a writing tool, allowing you to map out complex t
text = """
TOML is a configuration format that can be easily read and understood by humans and machines alike.
+It was chosen as en's main input format for its obvious semantics, because it's more readable, has friendlier strings compared to alternatives such as JSON and less convoluted indentation compared to YAML.
+
+One of the most valued attributes in en's design is readability. TOML provides powerful multi-line strings that can trim whitespace and literal multiline string that avoid the need for escaping. This couples well with en's own |markup syntax|Syntax.
+
To learn more about TOML, you can visit its website at |https://toml.io|.
-To see the TOML declaration that translates into the rendered graph you are reading right now, visit the "TOML Graph" link on the top navigation bar.
+To see the TOML representation for the graph you are reading right now, visit the |data endpoints|/data|.
"""
[nodes.Acknowledgments]
@@ -813,118 +954,192 @@ en is only possible thanks to a number of projects and people:
## Software
-- Neovim|https://neovim.io/
-- foot|https://codeberg.org/dnkl/foot
-- tmux|https://github.com/tmux/tmux/
-- |Debian|https://debian.org/ and its kernel|https://www.kernel.org/
+- |NixOS|https://nixos.org/|, |Debian|https://debian.org|, |Alpine|https://alpinelinux.org and their kernel|https://www.kernel.org/
- LibreWolf|https://librewolf.net/ and its upstream |Mozilla Firefox|https://www.firefox.com/
- InkScape|https://inkscape.org/
"""
+[nodes.RedirectTest]
+redirect = "Node"
+
[nodes.Roadmap]
text = """
-- [ ] Performance
- - [ ] Caching
- - [x] Move more logic from Serial to Graph submodules
- - [x] Further centralize state
- - [ ] Reduce O(n) calls in the formats module
-- [ ] Input syntax
- - [ ] Invert where redirects are set
- - [x] Formatting
- - [x] Blockquotes
- - [x] Tables
- - [x] Nested formatting
- - [x] Headers
- - [x] Preformatted blocks
- - [x] _Oblique_,
- - [x] __Underline__
- - [x] ~~Strikethrough~~
- - [x] *Bold*
- - [x] `Inline code`
- - [x] Lists
- - [x] Nested lists
- - [x] Checkboxes
- - [x] Move this roadmap to en
- - [ ] Special sections
- - [ ] Top-bound
- - [ ] Top-bound is not included in the summary (tooltip)
- - Sections
- - [ ] Definition (implies metadata `has_definition`)
- - [ ] See also (implies a kind of connection, e.g. `related`)
- - [ ] Not to be confused with (implies a kind of connection)
- - [ ] Contrast with (implies a kind of connection)
- - [ ] Example (implies metadata `has_example`)
- - [ ] Bottom-bound
- - [ ] References/influences (implies metadata `has_references`)
- - [ ] Aggregated from the full text content
-- [ ] Meta-awareness
- - [x] Detached edges
- - [ ] Most linked to nodes
- - [ ] Most linked from nodes
- - [ ] Most linked
-- [ ] Rendering
- - [ ] Sorting of tree, index list and drop-down navigation
- - [x] Alphabetic
- - [ ] By most linked to
- - [ ] By most linked
- - [ ] Tree
- - [ ] Hide tree leaves from the top level
- - [ ] Branch deeper
- - Customization
- - [ ] Custom assets (favicon, CSS)
- - [x] Drop all hardcoded assets endpoints
- - [ ] Custom header include
- - [x] Custom templates
- - [ ] user-supplied loading order (e.g. through filenames)
- - [ ] Themes
-- [x] Anchors and connections
- - [x] Render detached anchors differently
- - [x] Count connection to a redirect as a connection to the target
- - [ ] Suffix-aware anchors
- - [x] Plural anchors (`|node|s` -> `node`)
- - [x] Ignore trailing punctuation
- - [ ] Conjugation anchors (`|will|ed` -> `will`)
- - [ ] Configurable suffixes
- - [x] Spaced node anchor (`|red fox|` -> `redfox` -> `RedFox`)
- - [x] Automatic connections from anchors
- - [ ] `#` syntax for header ID anchors
- - [ ] Connection kinds
- - [ ] Mutual
- - [ ] Category <-> Membership
- - [ ] Opposite <-> Equivalent
- - [ ] Contrast <-> Similar
- - [ ] Cognate <-> Unrelated
- - [ ] Specialization <-> Generalization
- - [ ] Custom connection kinds
- - [x] External anchors
-- [ ] I/O formats
- - [ ] Output
- - [ ] Add separate TOML endpoints for pre/postprocessed
- - [ ] Render to filesystem
- - [ ] Single-page rendering
- - [x] Make error output more clean when `DEBUG` is unset
- - [ ] Input
- - [ ] Frontmatter format
- - [ ] Multi-file graphs
- - [ ] Multi-graph
-- [ ] Templating
- - [ ] Simplify template code with includes, macros and custom functions
- - [ ] Move compiled templates to a static ref
- - See: |https://keats.github.io/tera/docs/#:~:text=only%20happen%20once|
- - [ ] Reduce whitespace
- - See: |https://keats.github.io/tera/docs/#whitespace-control|
+
+## Upcoming
+
+### v0.5.0-alpha
+- [ ] Docs for custom assets and templates
+- [ ] Custom kind for connections
+- [ ] Hide tree leaves from the top level
+- [x] Fix anchors containing `/` and `#` considered node IDs
+- [x] Fix `PreFormat` blocks rendering HTML tags
+
+### v0.6.0-alpha
+- [ ] Custom header include
+
+### v0.7.0-alpha
+- [ ] Frontmatter format
+- [ ] Multi-file graphs
+
+### v0.8.0-alpha
- [ ] Full-text search
-- [ ] Assess Option return types that should be Result
-## Done
+
-- [x] Redirects
+_See |Changelog|Roadmap#Changelog| for previously released versions._
+
+
+
+
+## Backlog
+These changes are planned, but have not been assigned to an upcoming release yet.
+
+### Syntax
+- [ ] Improve nested formatting
+- [ ] Invert where redirects are set
+- [ ] Special sections
+ - Top-bound
+ - [ ] Top-bound is not included in the summary (tooltip)
+ - Sections
+ - [ ] Definition (implies metadata `has_definition`)
+ - [ ] See also (implies a kind of connection, e.g. `related`)
+ - [ ] Not to be confused with (implies a kind of connection)
+ - [ ] Contrast with (implies a kind of connection)
+ - [ ] Example (implies metadata `has_example`)
+ - Bottom-bound
+ - [ ] References/influences (implies metadata `has_references`)
+ - [ ] Aggregated from the full text content
+
+### Metrics
+- [ ] Most linked to nodes
+- [ ] Most linked from nodes
+- [ ] Most linked
+
+### Rendering
+- [ ] Sorting of tree, index list and drop-down navigation
+ - [x] Alphabetic
+ - [ ] By most linked to
+ - [ ] By most linked
+- Tree
+ - [ ] Branch deeper
+- Customization
+ - [ ] Custom assets (favicon, CSS)
+ - [x] Drop all hardcoded assets endpoints
+ - [x] Custom templates
+ - [ ] user-supplied loading order (e.g. through filenames)
+ - [ ] Themes
+- [ ] Table of contents
+
+### Connections
+- [ ] `#` syntax for header ID anchors
+- Connection kinds
+ - [ ] Mutual
+ - [ ] Category <-> Membership
+ - [ ] Opposite <-> Equivalent
+ - [ ] Contrast <-> Similar
+ - [ ] Cognate <-> Unrelated
+ - [ ] Specialization <-> Generalization
+ - [ ] Custom connection kinds
+ - [x] External anchors
+- [ ] Suffix-aware anchors
+ - [x] Plural anchors (`|node|s` -> `node`)
+ - [x] Ignore trailing punctuation
+ - [ ] Conjugation anchors (`|will|ed` -> `will`)
+ - [ ] Configurable suffixes
+
+### I/O formats
+
+#### Input
+- [ ] Multi-graph
+
+#### Output
+- [ ] Add separate TOML endpoints for pre/postprocessed
+- [ ] Render to filesystem
+- [ ] Single-page rendering
+- [ ] Consider printing parsing errors to console by default
+
+### Templating
+- [ ] Simplify template code with includes, macros and custom functions
+- [ ] Move compiled templates to a static ref
+ - See: |https://keats.github.io/tera/docs/#:~:text=only%20happen%20once|
+- [ ] Reduce whitespace
+ - See: |https://keats.github.io/tera/docs/#whitespace-control|
+
+### Documentation
+- [ ] Generate `meta.config` docs from JSON schema
+
+#### Validation
+- [ ] Finalize JSON schema
+- [ ] Add CI step with `taplo lint`
+
+### Code
+- [ ] Assess `Option` return types that should be `Result`
+
+### Performance
+- [ ] Caching
+- [ ] Reduce O(n) calls in the formats module
+
+### Done
+
+Toggle to expand
+
+#### Syntax
+- Formatting
+ - [x] Blockquotes
+ - [x] Tables
+ - [x] Nested formatting
+ - [x] Headers
+ - [x] Preformatted blocks
+ - [x] _Oblique_,
+ - [x] __Underline__
+ - [x] ~~Strikethrough~~
+ - [x] *Bold*
+ - [x] `Inline code`
+ - [x] Lists
+ - [x] Nested lists
+ - [x] Checkboxes
+ - [x] Move this roadmap to en
+
+#### Connections
+- [x] Count connection to a redirect as a connection to the target
+- [x] Spaced node anchor (`|red fox|` -> `redfox` -> `RedFox`)
+- [x] Automatic connections from anchors
+
+#### I/O formats
+##### Input
+- [x] Array syntax for lightweight connections
+
+##### Output
+- [x] Make error output more clean when `DEBUG` is unset
+
+##### Metrics
+- [x] Detached edges
+
+#### Rendering
+- [x] Render detached anchors differently
- [x] Strip/render some syntax in Tree text preview
- [x] Drop-down navigation
-- [x] Array syntax for lightweight connections
+
+#### Server
+- [x] Redirects
- [x] Automatic IDs
- [x] Automatic titles
- [x] Mismatch between TOML ID and provided ID
+
+#### Performance
+- [x] Move more logic from Serial to Graph submodules
+- [x] Further centralize state
+
+
+
+
+
+## Changelog
+
+### |v0.4.0-alpha|https://codeberg.org/jutty/en/releases/tag/v0.4.0-alpha|
+
+- Embed assets and welcome graph into the binary
+- Source custom templates and assets from `./templates` and `./static/public`
"""
[meta.config]
@@ -933,6 +1148,7 @@ footer_credits = false
error_poem = true
node_selector = true
navbar_search = true
+about = true
footer_text = """
-acknowledgments|Acknowledgments • |source code|https://codeberg.org/jutty/en
+acknowledgments|Acknowledgments • |source code|https://codeberg.org/jutty/en
"""
diff --git a/static/public/assets/fonts/LICENSES.sha256sum b/static/public/assets/fonts/LICENSES.sha256sum
index 4cf7352..b2023fc 100644
--- a/static/public/assets/fonts/LICENSES.sha256sum
+++ b/static/public/assets/fonts/LICENSES.sha256sum
@@ -1,19 +1,21 @@
-9cc97638cf0185884ac800144b6246c7772f94ff2cc70686afa9574aaea4fa2b ./_licenses/CC_BY_ND_4_0_INTERNATIONAL.LICENSE
-8a0b028b517cc55196eb9d8b52be9af6681a012fea18b1f66fb54e8d98f5689b ./_licenses/CC_BY_ND_4_0_INTERNATIONAL.compact.LICENSE
-1d361a8f8e8ce6e68457dcd93fb56e162e6baa3bbb7e7573a290d44399f6b57e ./_licenses/SIL_OFL_1_1.LICENSE
-b9b403f45aa19c80648bfc7164caf8bf0b38727d7ea31d8bbc8ec850a8646237 ./_licenses/SIL_OFL_1_1.compact.LICENSE
+9cc97638cf0185884ac800144b6246c7772f94ff2cc70686afa9574aaea4fa2b ./_canon/CC_BY_ND_4_0_INTERNATIONAL.LICENSE
+00b6b2ffad0a8a99a0497b6474d16296adb91a9d9d83dd745d3148176aa16b7e ./_canon/CC_BY_ND_4_0_INTERNATIONAL.body.LICENSE
+5f1cc99e4d0fe6ed3495b8f7fb57bdd07623b99a9f0b2bde6076ef3719f162f9 ./_canon/CC_BY_ND_4_0_INTERNATIONAL.compact.LICENSE
+1d361a8f8e8ce6e68457dcd93fb56e162e6baa3bbb7e7573a290d44399f6b57e ./_canon/SIL_OFL_1_1.LICENSE
+6863ff4dc820f24756b6acfb38a2c6bc19d5b8d71b17030330a6f16eb4cee348 ./_canon/SIL_OFL_1_1.body.LICENSE
+2533bdb563fb91d70cb719edca0a0cdc8f5cc347d567561b4a87e7509e02073d ./_canon/SIL_OFL_1_1.compact.LICENSE
3f70f82d58c8f58b91cf8d718621ac1537234eb6f37ee9a83469a321ef46e4db ./cormorant/LICENSE
-b9b403f45aa19c80648bfc7164caf8bf0b38727d7ea31d8bbc8ec850a8646237 ./cormorant/compact.LICENSE
+2533bdb563fb91d70cb719edca0a0cdc8f5cc347d567561b4a87e7509e02073d ./cormorant/compact.LICENSE
c110f34253aced57d6d4f02edce58b171dca3340591a1119e02ea084a4b78f93 ./cormorant/header.LICENSE
7d5da66dc426b59bbba125049b7016f2011f93724ddf7b7f97ce1911f958b963 ./maven/LICENSE
-b9b403f45aa19c80648bfc7164caf8bf0b38727d7ea31d8bbc8ec850a8646237 ./maven/compact.LICENSE
+2533bdb563fb91d70cb719edca0a0cdc8f5cc347d567561b4a87e7509e02073d ./maven/compact.LICENSE
c63dd928ccd5c2c80491b84d1874227536dfced1f1f82cbd900ddc86c59b738b ./maven/header.LICENSE
1d2892790cc9522de02d3f01ba48d12742862b1a69d04d69752938591efabecd ./mononoki/LICENSE
-b9b403f45aa19c80648bfc7164caf8bf0b38727d7ea31d8bbc8ec850a8646237 ./mononoki/compact.LICENSE
+2533bdb563fb91d70cb719edca0a0cdc8f5cc347d567561b4a87e7509e02073d ./mononoki/compact.LICENSE
20601bbaafe0fe8d6a39527785fc501f242ebae18d1aaa4d5d15a8ac4ff4fff3 ./mononoki/header.LICENSE
3e57bc17e8ece63050a2ac5aa99a80f87183289b18303d46311199875b4808b7 ./rawengulk/LICENSE
-b9b403f45aa19c80648bfc7164caf8bf0b38727d7ea31d8bbc8ec850a8646237 ./rawengulk/compact.LICENSE
+2533bdb563fb91d70cb719edca0a0cdc8f5cc347d567561b4a87e7509e02073d ./rawengulk/compact.LICENSE
4d8b5ec962dfeb2813bdeb0762e3b714e68e19f9fbcdb3481d12f018b125308b ./rawengulk/header.LICENSE
18837f5b671bd48dc6b595a475d8c45ab3e6ae33adb65d9bbeac59c58f77bc24 ./reforma/LICENSE
-71a379fe7cce14275bab647c25fe024c085d9618c836c476338ef88d33e38b22 ./reforma/compact.LICENSE
-c870d796e9bad6ab1b29bb73ea3ef316355d24d8efad78272636aaf95033ae9a ./reforma/header.LICENSE
+2edceb2f872692052b281629777bc5af5386601dd4c437f297f84846f9fa75cf ./reforma/compact.LICENSE
+a3d29ef378426d0b1d9f17364a3d7532ad623a51c8c19a3badc74c23e5e93ef6 ./reforma/header.LICENSE
diff --git a/static/public/assets/fonts/_canon/CC_BY_ND_4_0_INTERNATIONAL.body.LICENSE b/static/public/assets/fonts/_canon/CC_BY_ND_4_0_INTERNATIONAL.body.LICENSE
new file mode 100644
index 0000000..6c5a1fe
--- /dev/null
+++ b/static/public/assets/fonts/_canon/CC_BY_ND_4_0_INTERNATIONAL.body.LICENSE
@@ -0,0 +1,392 @@
+Attribution-NoDerivatives 4.0 International
+
+=======================================================================
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+ Considerations for licensors: Our public licenses are
+ intended for use by those authorized to give the public
+ permission to use material in ways otherwise restricted by
+ copyright and certain other rights. Our licenses are
+ irrevocable. Licensors should read and understand the terms
+ and conditions of the license they choose before applying it.
+ Licensors should also secure all rights necessary before
+ applying our licenses so that the public can reuse the
+ material as expected. Licensors should clearly mark any
+ material not subject to the license. This includes other CC-
+ licensed material, or material used under an exception or
+ limitation to copyright. More considerations for licensors:
+ wiki.creativecommons.org/Considerations_for_licensors
+
+ Considerations for the public: By using one of our public
+ licenses, a licensor grants the public permission to use the
+ licensed material under specified terms and conditions. If
+ the licensor's permission is not necessary for any reason--for
+ example, because of any applicable exception or limitation to
+ copyright--then that use is not regulated by the license. Our
+ licenses grant only permissions under copyright and certain
+ other rights that a licensor has authority to grant. Use of
+ the licensed material may still be restricted for other
+ reasons, including because others have copyright or other
+ rights in the material. A licensor may make special requests,
+ such as asking that all changes be marked or described.
+ Although not required by our licenses, you are encouraged to
+ respect those requests where reasonable. More considerations
+ for the public:
+ wiki.creativecommons.org/Considerations_for_licensees
+
+
+=======================================================================
+
+Creative Commons Attribution-NoDerivatives 4.0 International Public
+License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution-NoDerivatives 4.0 International Public License ("Public
+License"). To the extent this Public License may be interpreted as a
+contract, You are granted the Licensed Rights in consideration of Your
+acceptance of these terms and conditions, and the Licensor grants You
+such rights in consideration of benefits the Licensor receives from
+making the Licensed Material available under these terms and
+conditions.
+
+
+Section 1 -- Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar
+ Rights that is derived from or based upon the Licensed Material
+ and in which the Licensed Material is translated, altered,
+ arranged, transformed, or otherwise modified in a manner requiring
+ permission under the Copyright and Similar Rights held by the
+ Licensor. For purposes of this Public License, where the Licensed
+ Material is a musical work, performance, or sound recording,
+ Adapted Material is always produced where the Licensed Material is
+ synched in timed relation with a moving image.
+
+ b. Copyright and Similar Rights means copyright and/or similar rights
+ closely related to copyright including, without limitation,
+ performance, broadcast, sound recording, and Sui Generis Database
+ Rights, without regard to how the rights are labeled or
+ categorized. For purposes of this Public License, the rights
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
+ Rights.
+
+ c. Effective Technological Measures means those measures that, in the
+ absence of proper authority, may not be circumvented under laws
+ fulfilling obligations under Article 11 of the WIPO Copyright
+ Treaty adopted on December 20, 1996, and/or similar international
+ agreements.
+
+ d. Exceptions and Limitations means fair use, fair dealing, and/or
+ any other exception or limitation to Copyright and Similar Rights
+ that applies to Your use of the Licensed Material.
+
+ e. Licensed Material means the artistic or literary work, database,
+ or other material to which the Licensor applied this Public
+ License.
+
+ f. Licensed Rights means the rights granted to You subject to the
+ terms and conditions of this Public License, which are limited to
+ all Copyright and Similar Rights that apply to Your use of the
+ Licensed Material and that the Licensor has authority to license.
+
+ g. Licensor means the individual(s) or entity(ies) granting rights
+ under this Public License.
+
+ h. Share means to provide material to the public by any means or
+ process that requires permission under the Licensed Rights, such
+ as reproduction, public display, public performance, distribution,
+ dissemination, communication, or importation, and to make material
+ available to the public including in ways that members of the
+ public may access the material from a place and at a time
+ individually chosen by them.
+
+ i. Sui Generis Database Rights means rights other than copyright
+ resulting from Directive 96/9/EC of the European Parliament and of
+ the Council of 11 March 1996 on the legal protection of databases,
+ as amended and/or succeeded, as well as other essentially
+ equivalent rights anywhere in the world.
+
+ j. You means the individual or entity exercising the Licensed Rights
+ under this Public License. Your has a corresponding meaning.
+
+
+Section 2 -- Scope.
+
+ a. License grant.
+
+ 1. Subject to the terms and conditions of this Public License,
+ the Licensor hereby grants You a worldwide, royalty-free,
+ non-sublicensable, non-exclusive, irrevocable license to
+ exercise the Licensed Rights in the Licensed Material to:
+
+ a. reproduce and Share the Licensed Material, in whole or
+ in part; and
+
+ b. produce and reproduce, but not Share, Adapted Material.
+
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
+ Exceptions and Limitations apply to Your use, this Public
+ License does not apply, and You do not need to comply with
+ its terms and conditions.
+
+ 3. Term. The term of this Public License is specified in Section
+ 6(a).
+
+ 4. Media and formats; technical modifications allowed. The
+ Licensor authorizes You to exercise the Licensed Rights in
+ all media and formats whether now known or hereafter created,
+ and to make technical modifications necessary to do so. The
+ Licensor waives and/or agrees not to assert any right or
+ authority to forbid You from making technical modifications
+ necessary to exercise the Licensed Rights, including
+ technical modifications necessary to circumvent Effective
+ Technological Measures. For purposes of this Public License,
+ simply making modifications authorized by this Section 2(a)
+ (4) never produces Adapted Material.
+
+ 5. Downstream recipients.
+
+ a. Offer from the Licensor -- Licensed Material. Every
+ recipient of the Licensed Material automatically
+ receives an offer from the Licensor to exercise the
+ Licensed Rights under the terms and conditions of this
+ Public License.
+
+ b. No downstream restrictions. You may not offer or impose
+ any additional or different terms or conditions on, or
+ apply any Effective Technological Measures to, the
+ Licensed Material if doing so restricts exercise of the
+ Licensed Rights by any recipient of the Licensed
+ Material.
+
+ 6. No endorsement. Nothing in this Public License constitutes or
+ may be construed as permission to assert or imply that You
+ are, or that Your use of the Licensed Material is, connected
+ with, or sponsored, endorsed, or granted official status by,
+ the Licensor or others designated to receive attribution as
+ provided in Section 3(a)(1)(A)(i).
+
+ b. Other rights.
+
+ 1. Moral rights, such as the right of integrity, are not
+ licensed under this Public License, nor are publicity,
+ privacy, and/or other similar personality rights; however, to
+ the extent possible, the Licensor waives and/or agrees not to
+ assert any such rights held by the Licensor to the limited
+ extent necessary to allow You to exercise the Licensed
+ Rights, but not otherwise.
+
+ 2. Patent and trademark rights are not licensed under this
+ Public License.
+
+ 3. To the extent possible, the Licensor waives any right to
+ collect royalties from You for the exercise of the Licensed
+ Rights, whether directly or through a collecting society
+ under any voluntary or waivable statutory or compulsory
+ licensing scheme. In all other cases the Licensor expressly
+ reserves any right to collect such royalties.
+
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+ a. Attribution.
+
+ 1. If You Share the Licensed Material, You must:
+
+ a. retain the following if it is supplied by the Licensor
+ with the Licensed Material:
+
+ i. identification of the creator(s) of the Licensed
+ Material and any others designated to receive
+ attribution, in any reasonable manner requested by
+ the Licensor (including by pseudonym if
+ designated);
+
+ ii. a copyright notice;
+
+ iii. a notice that refers to this Public License;
+
+ iv. a notice that refers to the disclaimer of
+ warranties;
+
+ v. a URI or hyperlink to the Licensed Material to the
+ extent reasonably practicable;
+
+ b. indicate if You modified the Licensed Material and
+ retain an indication of any previous modifications; and
+
+ c. indicate the Licensed Material is licensed under this
+ Public License, and include the text of, or the URI or
+ hyperlink to, this Public License.
+
+ For the avoidance of doubt, You do not have permission under
+ this Public License to Share Adapted Material.
+
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
+ reasonable manner based on the medium, means, and context in
+ which You Share the Licensed Material. For example, it may be
+ reasonable to satisfy the conditions by providing a URI or
+ hyperlink to a resource that includes the required
+ information.
+
+ 3. If requested by the Licensor, You must remove any of the
+ information required by Section 3(a)(1)(A) to the extent
+ reasonably practicable.
+
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+ to extract, reuse, reproduce, and Share all or a substantial
+ portion of the contents of the database, provided You do not Share
+ Adapted Material;
+
+ b. if You include all or a substantial portion of the database
+ contents in a database in which You have Sui Generis Database
+ Rights, then the database in which You have Sui Generis Database
+ Rights (but not its individual contents) is Adapted Material; and
+
+ c. You must comply with the conditions in Section 3(a) if You Share
+ all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+ c. The disclaimer of warranties and limitation of liability provided
+ above shall be interpreted in a manner that, to the extent
+ possible, most closely approximates an absolute disclaimer and
+ waiver of all liability.
+
+
+Section 6 -- Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and
+ Similar Rights licensed here. However, if You fail to comply with
+ this Public License, then Your rights under this Public License
+ terminate automatically.
+
+ b. Where Your right to use the Licensed Material has terminated under
+ Section 6(a), it reinstates:
+
+ 1. automatically as of the date the violation is cured, provided
+ it is cured within 30 days of Your discovery of the
+ violation; or
+
+ 2. upon express reinstatement by the Licensor.
+
+ For the avoidance of doubt, this Section 6(b) does not affect any
+ right the Licensor may have to seek remedies for Your violations
+ of this Public License.
+
+ c. For the avoidance of doubt, the Licensor may also offer the
+ Licensed Material under separate terms or conditions or stop
+ distributing the Licensed Material at any time; however, doing so
+ will not terminate this Public License.
+
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+ License.
+
+
+Section 7 -- Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different
+ terms or conditions communicated by You unless expressly agreed.
+
+ b. Any arrangements, understandings, or agreements regarding the
+ Licensed Material not stated herein are separate from and
+ independent of the terms and conditions of this Public License.
+
+
+Section 8 -- Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and
+ shall not be interpreted to, reduce, limit, restrict, or impose
+ conditions on any use of the Licensed Material that could lawfully
+ be made without permission under this Public License.
+
+ b. To the extent possible, if any provision of this Public License is
+ deemed unenforceable, it shall be automatically reformed to the
+ minimum extent necessary to make it enforceable. If the provision
+ cannot be reformed, it shall be severed from this Public License
+ without affecting the enforceability of the remaining terms and
+ conditions.
+
+ c. No term or condition of this Public License will be waived and no
+ failure to comply consented to unless expressly agreed to by the
+ Licensor.
+
+ d. Nothing in this Public License constitutes or may be interpreted
+ as a limitation upon, or waiver of, any privileges and immunities
+ that apply to the Licensor or You, including from the legal
+ processes of any jurisdiction or authority.
+
+=======================================================================
+
+Creative Commons is not a party to its public
+licenses. Notwithstanding, Creative Commons may elect to apply one of
+its public licenses to material it publishes and in those instances
+will be considered the “Licensor.” The text of the Creative Commons
+public licenses is dedicated to the public domain under the CC0 Public
+Domain Dedication. Except for the limited purpose of indicating that
+material is shared under a Creative Commons public license or as
+otherwise permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the
+public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
diff --git a/static/public/assets/fonts/_canon/SIL_OFL_1_1.body.LICENSE b/static/public/assets/fonts/_canon/SIL_OFL_1_1.body.LICENSE
new file mode 100644
index 0000000..6e85af4
--- /dev/null
+++ b/static/public/assets/fonts/_canon/SIL_OFL_1_1.body.LICENSE
@@ -0,0 +1,85 @@
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/static/public/assets/fonts/reforma/header.LICENSE b/static/public/assets/fonts/reforma/header.LICENSE
index 36ff711..8521b49 100644
--- a/static/public/assets/fonts/reforma/header.LICENSE
+++ b/static/public/assets/fonts/reforma/header.LICENSE
@@ -4,4 +4,3 @@ http://pampatype.com.
This Font Software is licensed under the Creative Commons BY-ND 4.0. This full license is available at: https://creativecommons.org/licenses/by-nd/4.0/
## creative commons
-
diff --git a/static/public/assets/fonts/split.sh b/static/public/assets/fonts/split.sh
index a683c33..75829d3 100755
--- a/static/public/assets/fonts/split.sh
+++ b/static/public/assets/fonts/split.sh
@@ -2,6 +2,10 @@
set -eu
+log() {
+ printf ' [split] %s\n' "$@" >&2
+}
+
get_marker() {
# extended regex syntax
cc_marker='^\#? ?Attribution-NoDerivatives 4.0 International$'
@@ -14,7 +18,7 @@ get_marker() {
elif grep -Eq "$cc_marker" "$m_file"; then
printf '%s' "$cc_marker"
else
- printf '%s %s\n' "$m_file" "matches no marker" >&2
+ log "$m_file matches no marker"
printf ''
fi
}
@@ -22,9 +26,25 @@ get_marker() {
behead() {
b_file="$1"
b_marker="$2"
- b_out_path="$3"
+ b_head_out_path="$3"
+ b_body_out_path="$4"
+
+ log "Beheading $b_file on marker $b_marker"
+ b_body=$(sed -En "/$b_marker/, \$p" "$b_file")
+ b_head=$(sed -E "/$b_marker/, \$d" "$b_file")
+
+ if [ -n "$b_head_out_path" ]; then
+ log "Keeping head of $b_file on $b_head_out_path"
+ printf '%s\n' "$b_head" \
+ | sed -E 's/^-+$//' \
+ > "$b_head_out_path"
+ fi
+
+ if [ -n "$b_body_out_path" ]; then
+ log "Keeping body of $b_file on $b_body_out_path"
+ printf '%s\n' "$b_body" > "$b_body_out_path"
+ fi
- sed -E "/$b_marker/, \$d" "$b_file" | sed -E 's/^-+$//' > "$b_out_path"
}
compact() {
@@ -32,39 +52,49 @@ compact() {
c_marker="$2"
c_out_path="$3"
- # Eliminating [:space:] is enough for OFL to match, but Reforma's
- # markdown license file is full of quirks so we must reduce aggresively
sed -En "/$c_marker/, \$p" "$c_file" \
- | sed -E 's/(wiki\.creativecommons\.org|https?).*\s//g' \
- | tr -cd '[:alnum:]' \
- | tr '[:upper:]' '[:lower:]' > "$c_out_path"
+ | tr -d '[:space:]' \
+ > "$c_out_path"
}
+log "Iterating over font directories"
for dir in *; do
[ -d "$dir" ] || continue
- [ "$dir" != _licenses ] || continue
+ [ "$dir" != _canon ] || continue
license="$dir/LICENSE"; [ -f "$license" ]
+ log "On license $license"
+
marker=$(get_marker "$license")
+ log "Got '$marker' marker for license $license"
if [ -n "$marker" ]; then
- behead "$license" "$marker" "$dir/header.LICENSE"
+ behead "$license" "$marker" "$dir/header.LICENSE" ""
compact "$license" "$marker" "$dir/compact.LICENSE"
fi
done
-for license in _licenses/*.LICENSE; do
- printf '%s' "$license" | grep -qEv '(header|compact)\.LICENSE' || continue
+log "Iterating over canonical licenses"
+for license in _canon/*.LICENSE; do
+ printf '%s' "$license" \
+ | grep -qEv '(header|compact|body)\.LICENSE' \
+ || continue
marker=$(get_marker "$license")
+ log "Got '$marker' marker for license $license"
+
+ body_name=$(printf '%s' "$license" | sed "s*\.LICENSE*.body.LICENSE*")
compact_name=$(printf '%s' "$license" | sed "s*\.LICENSE*.compact.LICENSE*")
+ log "Using names $body_name (body) and $compact_name (compact)"
+
+ behead "$license" "$marker" "" "$body_name"
compact "$license" "$marker" "$compact_name"
done
for file in ./*/*LICENSE*; do
size=$(du "$file" | awk '{print $1}')
if [ "$size" -le 0 ]; then
- echo "$file is empty"
+ log "$file is empty"
exit 1
fi
done
@@ -73,15 +103,25 @@ sha256sum ./*/*LICENSE* > LICENSES.sha256sum
grep compact LICENSES.sha256sum | sort
unique_licenses=$(
- find _licenses/ -name '*.LICENSE' -not -name '*.compact.LICENSE' | wc -l
+ find _canon/ \
+ -name '*.LICENSE' \
+ -not -name '*.compact.LICENSE' \
+ -not -name '*.body.LICENSE' \
+ | wc -l
)
unique_hashes=$(
- cat LICENSES.sha256sum | grep compact | awk '{print $1}' | sort | uniq | wc -l
+ cat LICENSES.sha256sum \
+ | grep compact \
+ | awk '{print $1}' \
+ | sort \
+ | uniq \
+ | wc -l
)
if [ "$unique_hashes" -ne "$unique_licenses" ]; then
- echo "unique hashes: $unique_hashes"
- echo "unique licenses: $unique_licenses"
+ log "Number of distinct hashes and licenses don't match."
+ log "unique hashes: $unique_hashes"
+ log "unique licenses: $unique_licenses"
exit 1
fi
diff --git a/static/public/assets/style.css b/static/public/assets/style.css
index 8242120..b92a157 100644
--- a/static/public/assets/style.css
+++ b/static/public/assets/style.css
@@ -34,6 +34,7 @@ p:not(.quote-citation), section li {
section p {
line-height: 2;
+ margin: 4px 0 16px;
}
pre {
@@ -46,30 +47,25 @@ pre {
transition: 1000ms;
}
-pre:hover {
- box-shadow: 1px 1px 3px 2.5px #00777777;
-}
-
code {
padding: 3px 6px;
margin-right: 3px;
white-space: nowrap;
- font-size: calc(var(--base-font-size) * 0.8);
- box-shadow: 1px 1px 1px 1px #00000077;
transition: 1000ms;
-}
-
-code:hover {
- box-shadow: 1px 1px 1px 1px #00777799;
+ box-shadow: 1px 1px 0.5px 0.5px #00000077;
}
pre, code {
background: light-dark(#e0e0e0, #333);
font-family: mono, monospace;
- border: solid 2px light-dark(#d0d0d0, #434343);
+ border: solid 1px light-dark(#d0d0d0, #434343);
border-radius: 6px;
}
+h1 , h2 , h3 , h4 , h5 , h6 {
+ code { font-size: calc(var(--base-font-size) * 0.6); }
+}
+
a {
color: light-dark(#0f6366, #1dd7d7);
text-decoration: underline dotted #159b9b;
@@ -100,8 +96,20 @@ a.external {
}
a.external:hover {
- color: light-dark(#0393b2, #74e5ff);
- text-decoration-color: light-dark(#1ed4f1, #aeffff);
+ color: light-dark(#037cb2, #74e5ff);
+ transition: 1500ms;
+}
+
+a.absolute {
+ color: light-dark(#196719, #2fe471);
+ text-decoration-color: light-dark(#196719, #2fe471);
+ text-decoration-style: solid;
+ text-decoration-thickness: 1.5px;
+ transition: 1500ms;
+}
+
+a.absolute:hover {
+ filter: brightness(1.25);
transition: 1500ms;
}
@@ -150,7 +158,7 @@ span.id-label {
border: solid 1px light-dark(#d0d0d0, #666);
}
-span.hidden-label {
+span.unlisted-label {
background: light-dark(#888, #000);
color: light-dark(#eee, #969696);
border: solid 1px light-dark(#d0d0d0, #555);
@@ -171,7 +179,7 @@ main h2 {
h1, h2, h3, h4, h5, h6 {
font-weight: 1;
- margin: 10px 0;
+ margin: 10px 0 5px;
overflow-wrap: break-word;
}
diff --git a/static/welcome.toml b/static/welcome.toml
new file mode 100644
index 0000000..90341de
--- /dev/null
+++ b/static/welcome.toml
@@ -0,0 +1,19 @@
+#:schema ./graph-schema.json
+
+[nodes.GettingStarted]
+title = "Getting Started"
+text = """
+## Welcome to en!
+#
+If you are seeing this, it's working!
+
+Now that you know how to run it, tell en how to find your graph file by adding a `--graph` option:
+
+`
+en --graph my_graph.toml
+`
+
+Alternatively, you can also add a `static` directory next to the en binary with a `graph.toml` file in it.
+
+To learn how to write your first graph and everything else about en, check out the |documentation|https://en.jutty.dev|.
+"""
diff --git a/templates/about.html b/templates/about.html
index 2746039..ce09cf9 100644
--- a/templates/about.html
+++ b/templates/about.html
@@ -8,17 +8,17 @@
{% if graph.meta.config.about_text %}
{{ graph.meta.config.about_text | safe }}
{% else %}
-
en is a program to create a connected collection of texts.
+
en is a writing instrument to create a connected collection of texts.
-
You define your graph using a plain-text configuration file, en reads this file and generates a website like the one you are browsing right now.
+
You define your graph using plain-text files, en reads these files and generates a website like the one you are browsing right now.