Compare commits

...

15 commits

Author SHA1 Message Date
dc4c331cb8 Extend test coverage for test and fixed modules
Some checks are pending
/ verify (push) Waiting to run
2026-03-20 00:18:53 -03:00
9024e56e72 Update README with expanded long-term goals and a more detailed pitch 2026-03-17 08:38:08 -03:00
a60d6913c7 Fix order of 'quick' in some justfile recipes 2026-03-16 20:55:43 -03:00
ce61c0df27 Improve asset mime handling robustness and readability
Some checks failed
/ publish (push) Has been cancelled
2026-03-16 20:47:55 -03:00
92287bc9c8 justfile: Rename quick, add short recipes, tweak several
- Add parameter for test filtering to test recipes
- Add --timings option to supported cargo commands
2026-03-16 20:45:30 -03:00
d756a16132 Cleanup tests directory 2026-03-16 20:45:30 -03:00
6af32696be Apply lints to all targets 2026-03-16 20:45:30 -03:00
c305627822 Add dev::test module for filesystem tests setup/teardown 2026-03-16 20:04:48 -03:00
9ebd91a589 Move log module to dev::log 2026-03-16 20:02:03 -03:00
b806d84451 Add template and asset fallback tests 2026-03-11 04:09:25 -03:00
0514fcd05f Strip header from canonical licenses 2026-03-11 02:40:45 -03:00
1d5a7bad80 Drop 'latest' tag as a way of finding the newest tag 2026-03-11 02:40:45 -03:00
8c20597350 Embed assets into the binary
Some checks failed
/ publish (push) Has been cancelled
2026-03-11 02:40:45 -03:00
08cf23dc8e Fix minor typo in docs 2026-03-09 14:43:52 -03:00
b4899eec30 Pass container scripts' parameters to podman 2026-03-09 14:43:39 -03:00
65 changed files with 2533 additions and 332 deletions

View file

@ -2,3 +2,4 @@ allow-unwrap-in-tests = true
allow-expect-in-tests = true
single-char-binding-names-threshold = 2
upper-case-acronyms-aggressive = true
allow-indexing-slicing-in-tests = true

156
.justfile
View file

@ -50,30 +50,30 @@ run-watch-containerized:
alias wc := run-watch-containerized
[private]
quick-assess:
{{ just_cmd }} lint check quick-test-cover
assess-quick:
{{ just_cmd }} lint check test-cover-quick
[private]
quick-assess-run:
-{{ just_cmd }} quick-assess
assess-run-quick:
-{{ just_cmd }} assess-quick
{{ just_cmd }} run
# Run quick assessments on changes
[group: 'develop']
quick-assess-watch:
{{ watch_cmd }} {{ just_cmd }} quick-assess
assess-watch-quick:
{{ watch_cmd }} {{ just_cmd }} assess-quick
alias qa := quick-assess-watch
alias aq := assess-watch-quick
# Run quick assessments, build and serve on changes
[group: 'develop']
quick-assess-run-watch:
{{ watch_cmd }} {{ just_cmd }} quick-assess-run
assess-run-watch-quick:
{{ watch_cmd }} {{ just_cmd }} assess-run-quick
alias qr := quick-assess-run-watch
alias rq := assess-run-watch-quick
[private]
quick-test-cover:
test-cover-quick:
{{ cover_cmd }} --no-report -- --test 'serial_tests::' --test-threads 1
{{ cover_cmd }} --no-report -- --skip 'serial_tests::'
{{ cover_cmd }} report --html
@ -81,10 +81,11 @@ quick-test-cover:
# Quickly update coverage reports (inaccurate)
[group: 'assess']
quick-test-cover-watch:
{{ watch_cmd }} {{ just_cmd }} quick-test-cover
test-cover-watch-quick:
@{{ watch_cmd }} {{ just_cmd_no_ts }} test-cover-quick 2>&1 \
| grep -v "process didn't exit successfully:" || true
alias qo := quick-test-cover-watch
alias oq := test-cover-watch-quick
# Format all files
[group: 'develop']
@ -93,10 +94,30 @@ format:
alias f := format
# Test (short output)
[group: 'develop']
test-short pattern="":
cargo test {{ pattern }} -q --message-format short \
-- 'serial_tests::' --test-threads=1 \
--format=terse -- quiet
cargo test {{ pattern }} -q --message-format short --bin en
cargo test {{ pattern }} -q --message-format short --doc
cargo test {{ pattern }} --message-format short --lib \
-- --format terse --skip 'serial_tests::'
alias ts := test-short
# Test on changes (shorter output)
[group: 'develop']
test-short-watch:
{{ watch_cmd }} {{ just_cmd }} test-short
alias tsw := test-short-watch
# Lint
[group: 'develop']
lint:
cargo +nightly clippy
cargo +nightly clippy --timings --all-targets
alias l := lint
@ -107,6 +128,20 @@ lint-watch:
alias lw := lint-watch
# Lint (short output)
[group: 'develop']
lint-short:
cargo +nightly clippy --all-targets -q --message-format short
alias ls := lint-short
# Lint on changes (shorter output)
[group: 'develop']
lint-short-watch:
{{ watch_cmd }} {{ just_cmd }} lint-short
alias lsw := lint-short-watch
# Run cargo check on changes
[group: 'develop']
check-watch:
@ -136,8 +171,8 @@ alias x := fix
# Run tests on changes
[group: 'develop']
test-watch:
{{ watch_cmd }} {{ just_cmd }} test
test-watch pattern="":
{{ watch_cmd }} {{ just_cmd }} test {{ pattern}}
alias tw := test-watch
@ -165,22 +200,16 @@ alias oo := cover-open
# Tag HEAD with version from Cargo.toml
[script, group: 'assess']
tag: update
tag commit="HEAD": update
if [ "{{ last_tag }}" = "{{ manifest_version }}" ]; then
echo "Last tag {{ last_tag }} and manifest ({{ manifest_version }}) already match"
if [ "{{ last_tag }}" != "{{ tagged_latest }}" ]; then
echo "Last tag {{ last_tag }} and 'latest' tag ({{ tagged_latest }}) diverge"
git tag --force latest "v{{ manifest_version }}"
{{ just_cmd }} version-assess
fi
exit
elif [ "{{ manifest_version }}" != "{{ lockfile_version }}" ]; then
echo "Manifest and lockfile versions don't match: update failed?"
exit 1
fi
git tag "v{{ manifest_version }}" HEAD
git tag --force latest "v{{ manifest_version }}"
git tag "v{{ manifest_version }}" {{ commit }}
{{ just_cmd }} version-assess
# Verify and push
@ -191,13 +220,6 @@ push: verify
alias p := push
# Push tag 'latest'
[group: 'develop']
push-tag-latest-unsafe:
git push origin tag latest --force --no-verify
alias ptlu := push-tag-latest-unsafe
# Push without verifying
[group: 'develop']
push-unsafe:
@ -211,14 +233,14 @@ alias pu := push-unsafe
# Generate crate documentation
[group: 'document']
doc:
cargo doc --document-private-items --no-deps
cargo doc --timings --document-private-items --no-deps
alias d := doc
# Generate crate and dependencies documentation
[group: 'document']
doc-all:
cargo doc --document-private-items
cargo doc --timings --document-private-items
alias da := doc-all
@ -236,35 +258,45 @@ alias do := doc-open
format-assess:
cargo +nightly fmt -- --check
alias fc := format-assess
alias fa := format-assess
# Assess production lints
[group: 'assess']
lint-assess:
cargo +nightly clippy -- \
-D clippy::dbg_macro -D clippy::use_debug \
cargo +nightly clippy --timings -- \
-D clippy::print_stdout -D clippy::print_stderr \
-D clippy::dbg_macro -D clippy::use_debug
cargo +nightly clippy --timings --all-targets -- \
-D clippy::todo -D clippy::unimplemented -D clippy::unreachable
alias la := lint-assess
alias lp := lint-assess
# Run cargo check
[group: 'assess']
check:
{{ debug_vars }} cargo check --workspace
{{ debug_vars }} cargo check --workspace --all-targets \
--future-incompat-report
alias c := check
# Run tests
[group: 'assess']
test:
cargo test -- --test 'serial_tests::' --test-threads 1
cargo test --bin en
cargo test --doc
cargo test --lib -- --skip 'serial_tests::'
test pattern="":
cargo test {{ pattern}} --timings -- --test-threads=1 'serial_tests::'
cargo test {{ pattern}} --timings --bin en
cargo test {{ pattern}} --timings --doc
cargo test {{ pattern}} --timings --lib -- --skip 'serial_tests::'
alias t := test
# Run tests with unfiltered output
[group: 'assess']
test-output pattern="":
DEBUG=${DEBUG:-debug} cargo test {{ pattern }} -- --no-capture 2>&1
alias to := test-output
# Clean test coverage data
[group: 'assess']
test-cover-clean:
@ -296,8 +328,11 @@ verify:
git status
exit 1
fi
{{ just_cmd }} todos-assess version-assess \
security-assess format-assess lint-assess check test cover-assess
{{ just_cmd }} \
todos-assess version-assess \
security-assess \
format-assess lint-assess check \
test "" cover-assess
alias v := verify
@ -305,15 +340,13 @@ alias v := verify
[script, group: 'assess']
version-assess: update
if
[ "{{ last_tag }}" != "{{ tagged_latest }}" ] \
|| [ "{{ last_tag }}" != "{{ lockfile_version }}" ] \
[ "{{ last_tag }}" != "{{ lockfile_version }}" ] \
|| [ "{{ last_tag }}" != "{{ lockfile_version }}" ]
then
printf 'Last tag: %s\nManifest: %s\nLockfile: %s\nTagged latest: %s\n' \
printf 'Last tag: %s\nManifest: %s\nLockfile: %s\n' \
"{{ last_tag }}" \
"{{ manifest_version }}" \
"{{ lockfile_version }}" \
"{{ tagged_latest }}"
"{{ lockfile_version }}"
exit 1
fi
@ -343,7 +376,7 @@ alias cl := clean
# Build
[group: 'build']
build target=default_target:
cargo build --target {{ target }} --locked
cargo build --timings --target {{ target }} --locked
alias b := build
@ -351,35 +384,36 @@ alias b := build
# glibc build
[group: 'build']
build-gnu:
cargo build --target {{ glibc_target }} --locked
cargo build --timings --target {{ glibc_target }} --locked
alias bg := build-gnu
# musl build
[group: 'build']
build-musl:
cargo build --target {{ musl_target }} --locked
cargo build --timings --target {{ musl_target }} --locked
alias bm := build-musl
# Release build
[group: 'build']
release-build target=default_target:
cargo build --target {{ target }} --locked --release
cargo build --timings --target {{ target }} --locked --release
du -h target/{{ target }}/release/en
alias rb := release-build
# glibc release build
[group: 'build']
release-build-gnu:
cargo build --target {{ glibc_target }} --locked --release
{{ just_cmd }} release-build {{ glibc_target }}
alias rbg := release-build-gnu
# musl release build
[group: 'build']
release-build-musl:
cargo build --target {{ musl_target }} --locked --release
{{ just_cmd }} release-build {{ musl_target }}
alias rbm := release-build-musl
@ -408,16 +442,12 @@ glibc_target := "x86_64-unknown-linux-gnu"
default_target := musl_target
debug_vars := 'DEBUG=${DEBUG:-} DEBUG_FILTER=${DEBUG_FILTER:-} RUST_BACKTRACE=${RUST_BACKTRACE:-} RUSTFLAGS=${RUSTFLAGS:-}'
just_cmd := 'just --timestamp --explain --command-color green'
just_cmd_no_ts := 'just --explain --command-color green'
watch_cmd := "watchexec -qc -r -e rs,toml,html --color always -- "
cover_cmd := 'cargo llvm-cov --color always --ignore-filename-regex "main\.rs|log\.rs"'
just_cmd := 'just --timestamp --explain --command-color green'
last_tag := ```
git tag --sort=-creatordate \
| grep -v '^latest$' | head -1 | tr -d v
```
tagged_latest := `git tag --points-at $(git rev-parse latest) \
| grep -v '^latest$' | tr -d v`
last_tag := `git tag --sort=-creatordate | head -1 | tr -d v`
manifest_version := `grep "^version" Cargo.toml | cut -d \" -f 2`
lockfile_version := ```
grep -A 1 'name = "en"' Cargo.lock \

42
Cargo.lock generated
View file

@ -135,9 +135,9 @@ checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
[[package]]
name = "cc"
version = "1.2.56"
version = "1.2.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2"
checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423"
dependencies = [
"find-msvc-tools",
"shlex",
@ -259,7 +259,7 @@ dependencies = [
[[package]]
name = "en"
version = "0.2.0-alpha"
version = "0.3.1-alpha"
dependencies = [
"axum",
"serde",
@ -528,9 +528,9 @@ dependencies = [
[[package]]
name = "itoa"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "js-sys"
@ -616,9 +616,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.21.3"
version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "parse-zoneinfo"
@ -1102,7 +1102,7 @@ dependencies = [
"toml_datetime",
"toml_parser",
"toml_writer",
"winnow",
"winnow 0.7.15",
]
[[package]]
@ -1116,18 +1116,18 @@ dependencies = [
[[package]]
name = "toml_parser"
version = "1.0.9+spec-1.1.0"
version = "1.0.10+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4"
checksum = "7df25b4befd31c4816df190124375d5a20c6b6921e2cad937316de3fccd63420"
dependencies = [
"winnow",
"winnow 1.0.0",
]
[[package]]
name = "toml_writer"
version = "1.0.6+spec-1.1.0"
version = "1.0.7+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607"
checksum = "f17aaa1c6e3dc22b1da4b6bba97d066e354c7945cac2f7852d4e4e7ca7a6b56d"
[[package]]
name = "tower"
@ -1475,19 +1475,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
[[package]]
name = "zerocopy"
version = "0.8.42"
name = "winnow"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2578b716f8a7a858b7f02d5bd870c14bf4ddbbcf3a4c05414ba6503640505e3"
checksum = "a90e88e4667264a994d34e6d1ab2d26d398dcdca8b7f52bec8668957517fc7d8"
[[package]]
name = "zerocopy"
version = "0.8.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.42"
version = "0.8.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e6cc098ea4d3bd6246687de65af3f920c430e236bee1e3bf2e441463f08a02f"
checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89"
dependencies = [
"proc-macro2",
"quote",

View file

@ -1,6 +1,6 @@
[package]
name = "en"
version = "0.2.0-alpha"
version = "0.3.1-alpha"
description = "A non-linear writing instrument."
license = "AGPL-3.0-only"
@ -211,7 +211,6 @@ shadow_reuse = "warn"
shadow_same = "warn"
shadow_unrelated = "warn"
should_panic_without_expect = "warn"
similar_names = "warn"
single_char_pattern = "warn"
single_match_else = "warn"
single_option_map = "warn"
@ -269,5 +268,4 @@ zero_sized_map_values = "warn"
# cargo
negative_feature_names = "warn"
redundant_feature_names = "warn"
multiple_crate_versions = "warn"
wildcard_dependencies = "warn"

View file

@ -1,14 +1,26 @@
# en
en is a tool to write non-linear, connected pieces of text and have their references mapped out as a graph of connected information.
en is a tool to write non-linear, connected pieces of text and have their references mapped out as a metadata-rich graph of connected information.
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.
## Roadmap
For an outline of planned and completed features, see the [roadmap](https://en.jutty.dev/node/Roadmap).
It works by ingesting a graph definition that leverages TOML for metadata and a special markup language for prose. en can then serve this textual representation as a website (with other targets planned) that allows nodes to be explored.
## Learn more
You can learn more and see what en looks like by visiting the [homepage](https://en.jutty.dev), which is rendered using en itself.
## Install and run
See the [Documentation](https://en.jutty.dev/node/Documentation) page for instructions and how to install and start using en.
## Roadmap
On a high-level, here are some things that en intends to achieve at some point:
1. Separate 'en' the server from 'en' the source-to-source translator. This would allow using en's markup syntax as a standalone compile-to-HTML language, effectively creating an "en cli" that should also have options to make it more practical to manipulate a graph, such as adding new nodes or querying your graph
3. Multifile graphs, with _optional_ TOML frontmatter
2. Make en more fitting to the 'note taking' use case
3. Multigraph, with the server being capable to let the user choose which graph to render and with inter-graph connections
4. Different rendering modes such as to a static website, to PDF or EPUB (with paper-friendly metadata)
5. Stateful and stateless online graph editing with 'export to TOML'
For a more detailed outline of what's planned for the future of en, along with what's already been completed, see the [roadmap](https://en.jutty.dev/node/Roadmap).

View file

@ -1,14 +1,27 @@
FROM alpine:latest
MAINTAINER Juno Takano juno@jutty.dev
ENV DEBUG=debug
ENV TAG=${TAG:-latest}
# Setup tooling
RUN apk add curl clang git file
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Install
RUN git clone -b "$TAG" --single-branch https://codeberg.org/jutty/en /build
RUN <<EOF
REPO_URL=https://codeberg.org/jutty/en
LAST_TAG=$(
git ls-remote --tags "$REPO_URL" \
| grep refs/tags \
| sed 's/.*refs\/tags\///' \
| sort -V \
| tail -n 1
)
git config --global advice.detachedHead false
echo "Selected tag: $LAST_TAG"
git clone --verbose -b "$LAST_TAG" \
--depth 1 --single-branch --no-tags \
"$REPO_URL" /build
EOF
RUN <<EOF
cd /build && /root/.cargo/bin/cargo build --locked --release
mv /build/target/release/en /usr/local/bin/en

View file

@ -1,7 +1,6 @@
FROM debian:stable-slim
MAINTAINER Juno Takano juno@jutty.dev
ENV DEBUG=debug
ENV TAG=${TAG:-latest}
# Setup tooling
RUN apt-get -y --update install --no-install-recommends \
@ -9,7 +8,21 @@ RUN apt-get -y --update install --no-install-recommends \
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Install
RUN git clone -b "$TAG" --single-branch https://codeberg.org/jutty/en /build
RUN <<EOF
REPO_URL=https://codeberg.org/jutty/en
LAST_TAG=$(
git ls-remote --tags "$REPO_URL" \
| grep refs/tags \
| sed 's/.*refs\/tags\///' \
| sort -V \
| tail -n 1
)
git config --global advice.detachedHead false
echo "Selected tag: $LAST_TAG"
git clone --verbose -b "$LAST_TAG" \
--depth 1 --single-branch --no-tags \
"$REPO_URL" /build
EOF
RUN <<EOF
cd /build && /root/.cargo/bin/cargo build --locked --release
mv /build/target/release/en /usr/local/bin/en

View file

@ -3,6 +3,7 @@
set -eu
suffix=$(printf '%s' "$1" | sed 's/.*\.//')
tag="en:$suffix"
shift
if podman container exists "$tag"; then
podman stop --time 3 "$tag"
@ -16,7 +17,7 @@ fi
podman build \
--tag "$tag" \
-f "Containerfile.$suffix"
-f "Containerfile.$suffix" "$@"
if [ -f en ]; then
rm -v en

View file

@ -4,9 +4,12 @@ set -eu
suffix=$(printf '%s' "$1" | sed 's/.*\.//')
name="en-$suffix"
tag="en:$suffix"
shift
podman run \
--replace \
--name "$name" \
--publish 3008:80 \
--init \
"$@" \
"$tag"

2
src/dev.rs Normal file
View file

@ -0,0 +1,2 @@
pub mod log;
pub mod test;

View file

@ -114,7 +114,7 @@ pub fn timed(past: &Instant, message: &str) -> Instant {
#[macro_export]
macro_rules! tlog {
($instant:expr, $fmt:expr $(, $($arg:tt)+ )?) => {{
$crate::log::timed($instant, &format!($fmt $(, $($arg)+ )?))
$crate::dev::log::timed($instant, &format!($fmt $(, $($arg)+ )?))
}};
}
@ -129,26 +129,26 @@ pub fn elog(function: &str, message: &str) {
macro_rules! log {
($level:path, $fmt:expr $(, $($arg:tt)+ )?) => {{
let data = $crate::log::Data::new(
let data = $crate::dev::log::Data::new(
Some($level),
std::any::type_name_of_val(&|| {}),
std::backtrace::Backtrace::capture(),
);
if data.should_log {
$crate::log::elog(&data.path, &format!($fmt $(, $($arg)+ )?));
$crate::dev::log::elog(&data.path, &format!($fmt $(, $($arg)+ )?));
}
}};
($fmt:expr $(, $($arg:tt)+ )?) => {{
let data = $crate::log::Data::new(
let data = $crate::dev::log::Data::new(
None,
std::any::type_name_of_val(&|| {}),
std::backtrace::Backtrace::capture(),
);
if data.should_log {
$crate::log::elog(&data.path, &format!($fmt $(, $($arg)+ )?));
$crate::dev::log::elog(&data.path, &format!($fmt $(, $($arg)+ )?));
};
}};
@ -272,7 +272,7 @@ mod tests {
fn test(&self);
}
struct Logger {}
struct Logger;
impl Loggable for Logger {
fn test(&self) {

190
src/dev/test.rs Normal file
View file

@ -0,0 +1,190 @@
use std::{env, fs, io, path::PathBuf};
use crate::prelude::*;
#[derive(Debug)]
pub struct Directories {
pub original: PathBuf,
pub templates: PathBuf,
pub assets: PathBuf,
pub test: PathBuf,
}
impl Directories {
/// Sets up self-cleaning original, temporary and 'templates' directories.
///
/// # Errors
/// May return Error when:
/// - Current directory does not exist or lacking permissions
/// - Several I/O possibilities from directory creation failures
/// - Several I/O possibilities from working directory changing failures
pub fn setup(dir_name: &str) -> Result<Directories, Error> {
let original = env::current_dir()?;
let test = original.join(format!("target/mocks/{dir_name}"));
let templates = test.join("templates");
let assets = test.join("static").join("public").join("assets");
drop(fs::remove_dir_all(&test));
if let Err(error) = fs::create_dir_all(&test) {
return Err(Error::with_io(
"Failed test's directory creation",
error,
))
}
if let Err(error) = fs::create_dir_all(&templates) {
return Err(Error::with_io(
"Failed 'templates' directory creation",
error,
))
}
if let Err(error) = fs::create_dir_all(&assets) {
return Err(Error::with_io(
"Failed 'assets' directory creation",
error,
))
}
if let Err(error) = env::set_current_dir(&test) {
return Err(Error::with_io("Failed current directory change", error))
}
Ok(Directories {
original,
templates,
assets,
test,
})
}
}
impl Drop for Directories {
fn drop(&mut self) {
if let Err(error) = std::env::set_current_dir(&self.original) {
log!(ERROR, "Couldn't reset to original directory: {error}");
}
if let Err(error) = std::fs::remove_dir_all(&self.test) {
log!(WARN, "Couldn't cleanup test directory: {error}");
}
}
}
#[derive(Debug)]
pub struct Error {
pub message: String,
pub inner_io: Option<io::Error>,
pub inner_tera: Option<tera::Error>,
}
impl Error {
fn with_io(message: &str, inner_error: io::Error) -> Error {
Error {
message: String::from(message),
inner_io: Some(inner_error),
inner_tera: None,
}
}
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
let mut message = self.message.clone();
if let Some(inner_io) = &self.inner_io {
message = format!("{message}\n{inner_io}");
}
if let Some(inner_tera) = &self.inner_tera {
message = format!("{message}\n{inner_tera}");
}
write!(f, "{message}")
}
}
impl From<String> for Error {
fn from(string: String) -> Error {
Error {
message: string,
inner_io: None,
inner_tera: None,
}
}
}
impl From<&str> for Error {
fn from(str: &str) -> Error { Error::from(String::from(str)) }
}
impl From<io::Error> for Error {
fn from(inner: io::Error) -> Error {
let mut error = Error::from(inner.to_string());
error.inner_io = Some(inner);
error
}
}
impl From<tera::Error> for Error {
fn from(inner: tera::Error) -> Error {
let mut error = Error::from(inner.to_string());
error.inner_tera = Some(inner);
error
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn bad_test_directory_name() {
let dirs = Directories::setup("\0");
assert!(dirs.is_err());
}
#[test]
fn display_contains_str_from_from() {
let payload = "rHneusPkYNGW0Ia0";
let error = Error::from(payload);
assert!(format!("{error}").contains(payload));
}
#[test]
fn display_contains_str_from_io_error() {
let payload = "SsVi0d3Ywc8kVhwp";
let io_payload = "LoPbZP7cJEHzAjGW";
let io_error = std::io::Error::other(io_payload);
let error = Error::with_io(payload, io_error);
assert!(format!("{error}").contains(payload));
assert!(format!("{error}").contains(io_payload));
}
#[test]
fn from_io_error() {
let payload = "YgmTKBm3VtHt5h3x9";
let io_error = std::io::Error::other(payload);
let error = Error::from(io_error);
assert!(error.message.contains(payload));
}
}
#[cfg(test)]
mod serial_tests {
use super::*;
#[test]
fn failed_working_directory_reset() {
let dirs = Directories::setup("\0");
let error = dirs.unwrap_err();
println!("{error}");
assert!(error.message.contains("Failed test's directory creation"));
assert!(
format!("{error}")
.contains("file name contained an unexpected NUL byte")
);
}
}

View file

@ -115,6 +115,7 @@ impl Graph {
};
let result = Graph::from_serial(&toml_source, &Format::TOML)?;
Ok(result)
}
@ -127,7 +128,7 @@ impl Graph {
serial: &str,
format: &Format,
) -> Result<Graph, SerialError> {
match *format {
let result = match *format {
Format::TOML => match toml::from_str::<Graph>(serial) {
Ok(graph) => Ok(graph),
Err(error) => Err(SerialError {
@ -146,6 +147,23 @@ impl Graph {
cause: SerialErrorCause::UnsupportedFormat,
message: "Unsupported format".to_string(),
}),
};
let graph = result?;
Graph::print_warnings(&graph);
Ok(graph)
}
fn print_warnings(graph: &Graph) {
if graph.meta.config.serve_fonts && !graph.meta.config.footer {
log!(
WARN,
"Ignoring 'footer' value of false (hidden) because \
'serve_fonts' is set to true (by default or explicitly). \
This is necessary for compliance with the font licenses. \
Either set 'serve_fonts' to false to disable serving fonts \
or reenable the footer to suppress this warning."
);
}
}
@ -703,8 +721,8 @@ mod tests {
.unwrap();
graph.modulate();
let node = graph.nodes.get("Node").unwrap();
let connection = node.connections.get("Nowhere").unwrap();
let node = &graph.nodes["Node"];
let connection = &node.connections["Nowhere"];
assert!(connection.detached);
}
@ -725,8 +743,8 @@ mod tests {
.unwrap();
graph.modulate();
let node = graph.nodes.get("NodeOne").unwrap();
let connection = node.connections.get("NodeTwo").unwrap();
let node = &graph.nodes["NodeOne"];
let connection = &node.connections["NodeTwo"];
println!("{connection:#?}");
assert!(!connection.detached);
}
@ -745,10 +763,10 @@ mod tests {
.unwrap();
graph.modulate();
let n01 = graph.nodes.get("n01").unwrap();
let n02 = graph.nodes.get("n02").unwrap();
let n01_to_n02 = n01.connections.get("n02").unwrap();
let n02_to_n03 = n02.connections.get("n03").unwrap();
let n01 = &graph.nodes["n01"];
let n02 = &graph.nodes["n02"];
let n01_to_n02 = &n01.connections["n02"];
let n02_to_n03 = &n02.connections["n03"];
assert_eq!(n01_to_n02.from, "n01");
assert_eq!(n01_to_n02.to, "n02");
@ -775,16 +793,16 @@ mod tests {
.unwrap();
graph.modulate();
let n01 = graph.nodes.get("n01").unwrap();
let n02 = graph.nodes.get("n02").unwrap();
let n04 = graph.nodes.get("n04").unwrap();
let n01 = &graph.nodes["n01"];
let n02 = &graph.nodes["n02"];
let n04 = &graph.nodes["n04"];
let n01_to_n02 = n01.connections.get("n02").unwrap();
let n01_to_n03 = n01.connections.get("n03").unwrap();
let n01_to_n04 = n01.connections.get("n04").unwrap();
let n01_to_n02 = &n01.connections["n02"];
let n01_to_n03 = &n01.connections["n03"];
let n01_to_n04 = &n01.connections["n04"];
let n04_to_n01 = n04.connections.get("n01").unwrap();
let n04_to_n03 = n04.connections.get("n03").unwrap();
let n04_to_n01 = &n04.connections["n01"];
let n04_to_n03 = &n04.connections["n03"];
assert_eq!(n01_to_n02.from, "n01");
assert_eq!(n01_to_n02.to, "n02");
@ -843,8 +861,8 @@ mod tests {
.unwrap();
graph.modulate();
assert!(graph.nodes.get("n01").unwrap().summary.contains(text));
assert!(graph.nodes.get("n01").unwrap().text.contains(text));
assert!(&graph.nodes["n01"].summary.contains(text));
assert!(&graph.nodes["n01"].text.contains(text));
}
#[test]
@ -863,8 +881,8 @@ mod tests {
.unwrap();
graph.modulate();
assert_eq!(graph.nodes.get("n01").unwrap().summary, summary);
assert!(graph.nodes.get("n01").unwrap().text.contains(text));
assert_eq!(&graph.nodes["n01"].summary, summary);
assert!(&graph.nodes["n01"].text.contains(text));
}
#[test]
@ -882,7 +900,7 @@ mod tests {
.unwrap();
graph.modulate();
assert_eq!(graph.nodes.get("n01").unwrap().summary, first_sentence);
assert_eq!(&graph.nodes["n01"].summary, first_sentence);
}
#[test]
@ -901,7 +919,7 @@ mod tests {
.unwrap();
graph.modulate();
assert_eq!(graph.nodes.get("n01").unwrap().summary, first_paragraph);
assert_eq!(&graph.nodes["n01"].summary, first_paragraph);
}
#[test]
@ -930,7 +948,7 @@ mod tests {
.unwrap();
graph.modulate();
assert_eq!(graph.nodes.get("n01").unwrap().summary, summary);
assert_eq!(graph.nodes["n01"].summary, summary);
}
#[test]
@ -949,9 +967,9 @@ mod tests {
.unwrap();
graph.modulate();
let n1_to_n2 = graph.nodes.get("n1").unwrap().connections.get("n2");
let n1_to_n2 = &graph.nodes["n1"].connections.get("n2");
let n2_to_n0 = graph.nodes.get("n2").unwrap().connections.get("n0");
let n2_to_n0 = &graph.nodes["n2"].connections.get("n0");
println!("{n1_to_n2:#?}");
println!("{n2_to_n0:#?}");
@ -973,8 +991,8 @@ mod tests {
graph.modulate();
assert_eq!(graph.stats.detached_total, 2);
assert_eq!(*graph.stats.detached.get("anchor").unwrap(), 1);
assert_eq!(*graph.stats.detached.get("this one").unwrap(), 1);
assert_eq!(graph.stats.detached["anchor"], 1);
assert_eq!(graph.stats.detached["this one"], 1);
}
#[test]
@ -990,7 +1008,7 @@ mod tests {
graph.modulate();
assert_eq!(graph.stats.detached_total, 2);
assert_eq!(*graph.stats.detached.get("anchor").unwrap(), 2);
assert_eq!(graph.stats.detached["anchor"], 2);
}
#[test]
@ -1277,7 +1295,7 @@ mod tests {
assert!(!format!("{none}").contains("exact"));
let some = QueryResult {
node: Some(node.clone()),
node: Some(node),
exact: false,
redirect: false,
};
@ -1290,24 +1308,19 @@ mod tests {
}
#[cfg(test)]
#[expect(clippy::panic_in_result_fn)]
mod serial_tests {
use super::*;
use crate::dev::test::{Directories, Error};
#[test]
fn bad_graph_path() {
let original_working_directory = std::env::current_dir().unwrap();
assert!(
std::env::set_current_dir(std::path::Path::new(
"tests/mocks/no_graph"
))
.is_ok()
);
fn bad_graph_path() -> Result<(), Error> {
let _dirs = Directories::setup("bad_graph_path")?;
let graph = Graph::load();
let message = graph.meta.messages.first().unwrap();
assert!(message.contains("Failed reading file at"));
assert!(std::env::set_current_dir(original_working_directory).is_ok());
Ok(())
}
}

View file

@ -66,6 +66,8 @@ pub struct Config {
pub raw_json: bool,
#[serde(default = "mktrue")]
pub raw_toml: bool,
#[serde(default = "mktrue")]
pub serve_fonts: bool,
#[serde(default)]
pub site_description: String,
#[serde(default)]
@ -99,6 +101,7 @@ impl Default for Config {
raw: true,
raw_json: true,
raw_toml: true,
serve_fonts: true,
site_description: String::default(),
site_title: String::default(),
tree: true,
@ -597,7 +600,6 @@ mod tests {
assert!(
validation_error
.message
.clone()
.unwrap()
.contains("Splits to three elements: false")
);

View file

@ -2,14 +2,13 @@ use std::{sync, time};
pub mod prelude {
pub use crate::{
log,
log::{Level::*, now},
tlog, write_log,
dev::log::{Level::*, now},
log, tlog, write_log,
};
}
pub mod dev;
pub mod graph;
pub mod log;
pub mod router;
pub mod syntax;

View file

@ -1,6 +1,6 @@
use std::{backtrace, io, panic};
use en::{ONSET, graph::Graph, log, prelude::*, syntax};
use en::{ONSET, dev::log, graph::Graph, prelude::*, syntax};
#[tokio::main]
#[expect(clippy::print_stderr, clippy::print_stdout, clippy::use_debug)]

View file

@ -33,7 +33,8 @@ pub fn new(graph: Graph) -> Router {
.route("/graph/{format}", get(handlers::fixed::serial))
.route("/search", get(handlers::navigation::search))
.route("/redirect", get(handlers::navigation::redirect))
.route("/static/{*path}", get(handlers::fixed::file));
.route("/static/{*path}", get(handlers::fixed::file))
.route("/legal", get(handlers::navigation::legal));
if state.graph.meta.config.tree {
router = router.route("/tree", get(handlers::navigation::tree));

View file

@ -9,7 +9,7 @@ use crate::{
router::{GlobalState, handlers},
};
pub(in crate::router::handlers) fn by_code(
pub(in crate::router::handlers) fn make(
code: Option<u16>,
message: Option<&str>,
graph: &Graph,
@ -61,7 +61,7 @@ fn make_body(
}
pub async fn not_found(State(state): State<GlobalState>) -> Response<Body> {
by_code(
make(
Some(404),
Some("The page you tried to access could not be found."),
&state.graph,
@ -86,10 +86,10 @@ mod tests {
#[tokio::test]
async fn internal_error() {
let graph = Graph::load();
assert!(by_code(Some(201), None, &graph).status() == 201);
assert!(by_code(Some(304), None, &graph).status() == 304);
assert!(by_code(Some(418), None, &graph).status() == 418);
assert!(by_code(Some(505), None, &graph).status() == 505);
assert!(make(Some(201), None, &graph).status() == 201);
assert!(make(Some(304), None, &graph).status() == 304);
assert!(make(Some(418), None, &graph).status() == 418);
assert!(make(Some(505), None, &graph).status() == 505);
}
#[test]

View file

@ -1,63 +1,311 @@
use std::{collections::HashMap, io::ErrorKind, string::FromUtf8Error};
use axum::{
body::Body,
extract::{Path, State},
http::{HeaderValue, Response, StatusCode, header},
http::{HeaderValue, Response, header},
};
use serde::Serialize;
use crate::{
dev::log,
graph::{Format, Graph, SerialErrorCause},
prelude::*,
router::{GlobalState, handlers, handlers::mime::Mime},
router::{
GlobalState,
handlers::{self, error, mime},
},
};
/// Assembles an HTTP response given Asset.
fn assemble(asset: Asset, graph: &Graph) -> Response<Body> {
let set_content_type = |response: &mut Response<_>, content_type: &str| {
if let Ok(header_value) =
HeaderValue::from_str(&String::from(content_type))
{
response
.headers_mut()
.append(header::CONTENT_TYPE, header_value);
} else {
// This should be unreachable considering the possible mimetypes
// and their string representations are internal to en
log!(
WARN,
"Failed to create content type header value from {content_type}"
);
}
};
match asset.mime.kind() {
mime::Kind::Text => {
if let Some(text) = asset.text {
let mut response = Response::new(Body::from(text));
set_content_type(
&mut response,
&String::from(asset.mime.clone()),
);
response
} else {
// This should be unreachable, considering the constructors
// will convert to text even if a blob is passed
let mut response = error::make(
Some(500),
Some(
"Asset mimetype indicates text content, \
but none was found",
),
graph,
);
set_content_type(&mut response, "text/html");
response
}
},
mime::Kind::Font | mime::Kind::Blob | mime::Kind::Image => {
if let Some(blob) = asset.blob {
let mut response = Response::new(Body::from(blob));
set_content_type(
&mut response,
&String::from(asset.mime.clone()),
);
response
} else {
// This should be unreachable, considering the constructors
// will convert to blob even if a text is passed
let mut response = error::make(
Some(500),
Some(
"Asset mimetype indicates binary content, \
but none was found",
),
graph,
);
set_content_type(&mut response, "text/html");
response
}
},
}
}
#[derive(Debug)]
#[expect(clippy::upper_case_acronyms)]
pub enum AssetErrorKind {
NotFound,
IO,
UTF8,
Unknown,
}
#[derive(Debug)]
pub struct AssetError {
pub path: String,
pub kind: AssetErrorKind,
pub io_error: Option<std::io::Error>,
pub utf8_error: Option<FromUtf8Error>,
}
impl AssetError {
fn new(
path: &str,
kind: AssetErrorKind,
io_error: Option<std::io::Error>,
utf8_error: Option<FromUtf8Error>,
) -> AssetError {
AssetError {
path: String::from(path),
kind,
io_error,
utf8_error,
}
}
}
impl From<FromUtf8Error> for AssetError {
fn from(error: FromUtf8Error) -> AssetError {
AssetError::new("", AssetErrorKind::UTF8, None, Some(error))
}
}
impl From<String> for AssetError {
fn from(string: String) -> AssetError {
AssetError::new(&string, AssetErrorKind::Unknown, None, None)
}
}
impl std::fmt::Display for AssetError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
let mut message = match self.kind {
AssetErrorKind::IO => {
format!(
"File {} was found, but it could not be loaded",
self.path
)
},
AssetErrorKind::NotFound => {
String::from("The file was not found in the searched path")
},
AssetErrorKind::UTF8 => String::from(
"UTF8 decoding error: is the file properly encoded?",
),
AssetErrorKind::Unknown => {
String::from("An unknown error happened.")
},
};
if let Some(error) = &self.io_error {
message = format!(
"{message}\n\
The following I/O error has happened: \n{error:?}"
);
}
if let Some(error) = &self.utf8_error {
message = format!(
"{message}\n\
The following encoding error has happened: \n{error:?}"
);
}
write!(f, "{message}")
}
}
#[derive(Debug)]
struct Asset {
blob: Option<Vec<u8>>,
text: Option<String>,
mime: mime::Mime,
}
impl Asset {
fn new(blob: &[u8], mime: mime::Mime) -> Result<Asset, AssetError> {
match mime.kind() {
mime::Kind::Text => Ok(Asset {
text: Some(String::from_utf8(blob.to_vec())?),
blob: None,
mime,
}),
mime::Kind::Font | mime::Kind::Image | mime::Kind::Blob => {
Ok(Asset {
text: None,
blob: Some(blob.to_vec()),
mime,
})
},
}
}
fn from_str(str: &str, mime: mime::Mime) -> Asset {
match mime.kind() {
mime::Kind::Text => Asset {
text: Some(String::from(str)),
blob: None,
mime,
},
mime::Kind::Font | mime::Kind::Image | mime::Kind::Blob => Asset {
text: None,
blob: Some(String::from(str).into_bytes()),
mime,
},
}
}
}
/// Given a relative path, returns the file contents or a default fallback.
///
/// The `path` argument is relative to the `static/public` directory.
///
/// Defaults are found in the `fixed::DEFAULTS` map.
///
/// Returns a `FallbackError` if neither is found or an I/O error ocurred.
fn fallback(path: &str, graph: &Graph) -> Result<Asset, AssetError> {
let target = format!("static/public/assets/{path}");
let defaults: HashMap<&str, &str> = TEXTS.iter().copied().collect();
let fonts: HashMap<&str, &'static Font> = FONTS.iter().copied().collect();
let mime = mime::Mime::guess(path);
match std::fs::read(&target) {
// A matching file exists on disk and is accessible
Ok(content) => Ok(Asset {
blob: Some(content),
text: None,
mime,
}),
Err(io_error) => {
// A matching file does not exist on disk
if io_error.kind() == ErrorKind::NotFound {
if let Some(content) = defaults.get(path) {
Ok(Asset::from_str(content, mime))
} else {
let not_found_error = Err(AssetError::new(
path,
AssetErrorKind::NotFound,
Some(io_error),
None,
));
if !graph.meta.config.serve_fonts {
return not_found_error
}
match fonts.get(path) {
// A matching font exists
Some(content) => Asset::new(content.blob, mime),
None => not_found_error,
}
}
// A matching file exists on disk and is not accessible
} else {
Err(AssetError::new(
path,
AssetErrorKind::IO,
Some(io_error),
None,
))
}
},
}
}
/// Handles requests for static files.
///
/// This handler receives and extracts requests from `/static/{path}`.
pub async fn file(
Path(path): Path<String>,
State(state): State<GlobalState>,
) -> Response<Body> {
let instant = now();
let target = format!("static/public/{path}");
let content = match std::fs::read(&target) {
Ok(s) => s,
Err(e) => {
let mut error_message = String::from(
"The requested file does not exist, the server does not have \
permission to access it or a filesystem error ocurred.",
match fallback(&path, &state.graph) {
Ok(asset) => {
let response = assemble(asset, &state.graph);
tlog!(
&instant,
"Assembled {} response for {path}",
response.status()
);
response
},
Err(asset_error) => {
let mut error_message =
if matches!(asset_error.kind, AssetErrorKind::NotFound) {
String::from("The requested file was not found.")
} else {
String::from(
"The requested file exists, but the server lacks \
permission to access it or another I/O error ocurred.",
)
};
if log::env_level() >= DEBUG {
error_message = format!(
"<p>{error_message}</p>\
<p>Targeted path: <code>{target}</code></p>\
<p>Error message:</p> <pre>{e}</pre>"
<p>Targeted path: <code>{path}</code></p>\
<p>Error:</p> <pre>{asset_error}</pre>"
);
}
log!(ERROR, "{error_message}");
return super::error::by_code(
Some(404),
Some(&error_message),
&state.graph,
);
error::make(Some(404), Some(&error_message), &state.graph)
},
};
let mut response = Response::new(Body::from(content));
*response.status_mut() = StatusCode::OK;
let header = header::CONTENT_TYPE;
let content_type = Mime::guess(&path);
if let Ok(header_value) =
HeaderValue::from_str(&String::from(content_type.clone()))
{
response.headers_mut().append(header, header_value);
} else {
log!(
WARN,
"Failed to create content type header value from {content_type:?}"
);
}
tlog!(&instant, "Assembled response for {content_type:?} {path}");
response
}
pub async fn serial(
@ -67,7 +315,7 @@ pub async fn serial(
let config = &state.graph.meta.config;
let make_error = |code: u16, message: &str| -> Response<Body> {
handlers::error::by_code(
handlers::error::make(
Some(code),
Some(
format!(
@ -125,8 +373,256 @@ pub async fn serial(
}
}
static TEXTS: &[(&str, &str)] = &[
(
"assets/style.css",
include_str!("../../../static/public/assets/style.css"),
),
(
"assets/fonts/fonts.css",
include_str!("../../../static/public/assets/fonts/fonts.css"),
),
(
"assets/favicon.svg",
include_str!("../../../static/public/assets/favicon.svg"),
),
];
pub static FONTS: &[(&str, &Font)] = &[
(
"assets/fonts/cormorant/cormorant-infant-latin-300-normal.woff2",
&Font {
name: "Cormorant Infant",
attribution: &Attribution {
project_name: "Cormorant",
author: "Christian Thalmann",
project_url: "https://github.com/CatharsisFonts/Cormorant",
author_url: "https://github.com/CatharsisFonts",
license_header: include_str!(
"../../../static/public/assets/fonts/\
cormorant/header.LICENSE"
),
},
blob: include_bytes!(
"../../../static/public/assets/fonts/\
cormorant/cormorant-infant-latin-300-normal.woff2"
),
license: &OFL,
},
),
(
"assets/fonts/cormorant/cormorant-infant-latin-300-italic.woff2",
&Font {
name: "Cormorant Infant Italic",
attribution: &Attribution {
project_name: "Cormorant",
author: "Christian Thalmann",
project_url: "https://github.com/CatharsisFonts/Cormorant",
author_url: "https://github.com/CatharsisFonts",
license_header: include_str!(
"../../../static/public/assets/fonts/\
cormorant/header.LICENSE"
),
},
blob: include_bytes!(
"../../../static/public/assets/fonts/\
cormorant/cormorant-infant-latin-300-italic.woff2"
),
license: &OFL,
},
),
(
"assets/fonts/maven/maven-pro-latin-400-normal.woff2",
&Font {
name: "Maven Pro",
attribution: &Attribution {
project_name: "Maven",
author: "Joe Prince and Project Authors",
author_url: "https://github.com/m4rc1e/mavenproFont/blob/\
main/AUTHORS.txt",
project_url: "https://github.com/m4rc1e/mavenproFont",
license_header: include_str!(
"../../../static/public/assets/fonts/\
maven/header.LICENSE"
),
},
blob: include_bytes!(
"../../../static/public/assets/fonts/\
maven/maven-pro-latin-400-normal.woff2"
),
license: &OFL,
},
),
(
"assets/fonts/mononoki/mononoki-latin-400-normal.woff2",
&Font {
name: "Mononoki",
attribution: &Attribution {
project_name: "Mononoki",
author: "Matthias Tellen",
author_url: "https://github.com/madmalik",
project_url: "https://madmalik.github.io/mononoki/",
license_header: include_str!(
"../../../static/public/assets/fonts/\
mononoki/header.LICENSE"
),
},
blob: include_bytes!(
"../../../static/public/assets/fonts/\
mononoki/mononoki-latin-400-normal.woff2"
),
license: &OFL,
},
),
(
"assets/fonts/rawengulk/RawengulkLight.woff2",
&Font {
name: "Rawengulk Light",
attribution: &Attribution {
project_name: "Rawengulk",
author: "gluk Fonts",
author_url: "https://www.glukfonts.pl",
project_url: "https://www.glukfonts.pl/font.php?font=Rawengulk",
license_header: include_str!(
"../../../static/public/assets/fonts/\
rawengulk/header.LICENSE"
),
},
license: &OFL,
blob: include_bytes!(
"../../../static/public/assets/fonts/\
rawengulk/RawengulkLight.woff2"
),
},
),
(
"assets/fonts/reforma/Reforma1969-Blanca.woff2",
&Font {
name: "Reforma 1969 Blanca",
attribution: &REFORMA_ATTRIBUTION,
license: &CCND,
blob: include_bytes!(
"../../../static/public/assets/fonts/\
reforma/Reforma1969-Blanca.woff2"
),
},
),
(
"assets/fonts/reforma/Reforma1969-BlancaItalica.woff2",
&Font {
name: "Reforma 1969 Blanca Italica",
attribution: &REFORMA_ATTRIBUTION,
license: &CCND,
blob: include_bytes!(
"../../../static/public/assets/fonts/\
reforma/Reforma1969-BlancaItalica.woff2"
),
},
),
(
"assets/fonts/reforma/Reforma1969-Gris.woff2",
&Font {
name: "Reforma 1969 Blanca Gris",
attribution: &REFORMA_ATTRIBUTION,
license: &CCND,
blob: include_bytes!(
"../../../static/public/assets/fonts/\
reforma/Reforma1969-Gris.woff2"
),
},
),
(
"assets/fonts/reforma/Reforma1969-GrisItalica.woff2",
&Font {
name: "Reforma 1969 Blanca Gris Italica",
attribution: &REFORMA_ATTRIBUTION,
license: &CCND,
blob: include_bytes!(
"../../../static/public/assets/fonts/\
reforma/Reforma1969-GrisItalica.woff2"
),
},
),
];
static REFORMA_ATTRIBUTION: Attribution = Attribution {
project_name: "Reforma",
project_url: "https://pampatype.com/reforma",
author: "PampaType",
author_url: "https://pampatype.com",
license_header: include_str!(
"../../../static/public/assets/fonts/\
reforma/header.LICENSE"
),
};
#[derive(Serialize)]
pub struct Font<'f> {
name: &'f str,
attribution: &'f Attribution<'f>,
license: &'f License<'f>,
blob: &'f [u8],
}
#[derive(Serialize)]
pub struct Attribution<'a> {
project_name: &'a str,
project_url: &'a str,
author: &'a str,
author_url: &'a str,
license_header: &'a str,
}
#[derive(Serialize)]
pub struct License<'l> {
name: &'l str,
kind: &'l LicenseKind,
text: &'l str,
url: &'l str,
}
#[derive(Serialize)]
#[expect(non_camel_case_types, clippy::upper_case_acronyms)]
pub enum LicenseKind {
SIL_OFL_1_1,
CC_BY_ND_4_0_INTERNATIONAL,
}
impl std::fmt::Display for LicenseKind {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
let s = match self {
LicenseKind::SIL_OFL_1_1 => "SIL Open Font License 1.1",
LicenseKind::CC_BY_ND_4_0_INTERNATIONAL => {
"Creative Commons Attribution-NoDerivatives 4.0 International"
},
};
write!(f, "{s}")
}
}
static OFL: License = License {
name: "SIL Open Font License 1.1",
kind: &LicenseKind::SIL_OFL_1_1,
url: "assets/licenses/SIL_OFL_1_1.txt",
text: include_str!(
"../../../static/public/assets/fonts/_canon/SIL_OFL_1_1.body.LICENSE"
),
};
static CCND: License = License {
name: "Creative Commons Attribution-NoDerivatives 4.0 International",
kind: &LicenseKind::CC_BY_ND_4_0_INTERNATIONAL,
url: "/assets/licenses/CC_BY_ND_4_0_INTERNATIONAL.txt",
text: include_str!(
"../../../static/public/assets/fonts/_canon/\
CC_BY_ND_4_0_INTERNATIONAL.body.LICENSE"
),
};
#[cfg(test)]
mod tests {
use axum::http::status::StatusCode;
use super::*;
async fn wrap_serial(format: &str) -> Response<Body> {
@ -174,4 +670,99 @@ mod tests {
let response = file(Path("/k/j/m".to_string()), State(state)).await;
assert!(response.status() == StatusCode::NOT_FOUND);
}
#[test]
fn error_from_utf8error() {
let bytes = vec![0, 159];
let utf8error = String::from_utf8(bytes.clone()).unwrap_err();
let error = AssetError::from(utf8error);
assert!(error.utf8_error.is_some());
assert_eq!(error.utf8_error.unwrap().into_bytes(), bytes);
}
#[test]
fn error_from_string() {
let payload = "r5MDnkEojW9HZDAG";
let asset_error = AssetError::from(payload.to_string());
println!("{asset_error}");
assert!(asset_error.path.contains(payload));
}
#[test]
fn new_text_asset() {
let asset = Asset::new(&[1, 0, 1], mime::Mime::Txt).unwrap();
assert!(asset.blob.is_none());
assert!(asset.text.is_some());
assert_eq!(asset.text.unwrap(), "\u{1}\0\u{1}");
}
#[test]
fn new_blob_asset() {
let asset = Asset::new(&[1, 0, 1], mime::Mime::Png).unwrap();
assert!(asset.blob.is_some());
assert!(asset.text.is_none());
assert_eq!(asset.blob.unwrap(), &[1, 0, 1]);
}
#[test]
fn asset_from_str() {
let payload = "\u{1}\0\u{6}";
let asset = Asset::from_str(payload, mime::Mime::Ico);
assert_eq!(asset.blob.unwrap(), &[1, 0, 6]);
}
#[test]
fn new_asset_utf8_error() {
let bad_bytes = [0xff, 0xc0, 0xf5, 0xc1, 0x80];
let error = Asset::new(&bad_bytes, mime::Mime::Txt).unwrap_err();
assert!(matches!(&error.kind, AssetErrorKind::UTF8));
assert!(format!("{error}").contains("UTF8 decoding error"));
}
#[test]
fn not_found_fallback_error() {
let error = fallback("not_found.png", &Graph::default()).unwrap_err();
assert!(matches!(&error.kind, AssetErrorKind::NotFound));
assert!(
format!("{error}")
.contains("The file was not found in the searched path")
);
}
}
#[cfg(test)]
#[expect(clippy::panic_in_result_fn)]
mod serial_tests {
use std::{fs, os::unix::fs::PermissionsExt as _};
use super::*;
use crate::dev::test::{Directories, Error};
#[test]
fn io_asset_error() -> Result<(), Error> {
let dirs = Directories::setup("io_asset_error")?;
let assets = dirs.assets.clone();
let file = assets.join("unreadable.png");
fs::write(&file, [1, 0, 1])?;
let mut permissions = fs::metadata(&file)?.permissions();
permissions.set_mode(0o200);
fs::set_permissions(&file, permissions)?;
let error = fallback("unreadable.png", &Graph::default()).unwrap_err();
assert!(matches!(&error.kind, AssetErrorKind::IO));
assert!(
format!("{error}")
.contains("was found, but it could not be loaded")
);
Ok(())
}
}

View file

@ -83,7 +83,17 @@ impl From<Mime> for String {
}
}
pub enum Kind {
Text,
Font,
Image,
Blob,
}
impl Mime {
/// Guesses the mimetype given the extension of a filename or path.
///
/// Only considers the last dot-delimited fragment of `path`.
pub fn guess(path: &str) -> Mime {
if let Some(pair) = path.rsplit_once('.') {
Mime::from(pair.1)
@ -91,6 +101,21 @@ impl Mime {
Mime::Unknown
}
}
/// Returns one of four kind of mimetypes among text, font, image and blob.
///
/// This is mainly used when serving assets through the `fixed` module in
/// order to determine what `Asset` field to use when assemblimg a response
/// body.
pub const fn kind(&self) -> Kind {
use Mime::*;
match self {
Txt | Csv | Css | Toml | Xml | Json | Js | Svg => Kind::Text,
Ttf | Otf | Woff | Woff2 => Kind::Font,
Ico | Jpeg | Png | Apng | Gif | Webp | Avif => Kind::Image,
Pdf | Epub | Unknown => Kind::Blob,
}
}
}
#[cfg(test)]

View file

@ -15,6 +15,14 @@ pub async fn about(State(state): State<GlobalState>) -> Response<Body> {
handlers::template::with_graph("about", state).await
}
pub async fn legal(State(state): State<GlobalState>) -> Response<Body> {
let mut context = tera::Context::default();
context.insert("graph", &state.graph);
context.insert("fonts", &crate::router::handlers::fixed::FONTS);
handlers::template::with_context("legal", &context, 500, None, false)
}
pub async fn tree(State(state): State<GlobalState>) -> Response<Body> {
let instant = now();

View file

@ -6,6 +6,7 @@ use axum::{
};
use crate::{
dev::log,
prelude::*,
router::{GlobalState, handlers::raw::make_response},
};
@ -107,6 +108,7 @@ static DEFAULTS: &[(&str, &str)] = &[
("base.html", include_str!("../../../templates/base.html")),
("index.html", include_str!("../../../templates/index.html")),
("about.html", include_str!("../../../templates/about.html")),
("legal.html", include_str!("../../../templates/legal.html")),
("data.html", include_str!("../../../templates/data.html")),
("empty.html", include_str!("../../../templates/empty.html")),
("error.html", include_str!("../../../templates/error.html")),
@ -135,6 +137,13 @@ fn load_templates() -> Result<tera::Tera, tera::Error> {
let root = PathBuf::from("templates");
let default_names: Vec<&str> = DEFAULTS.iter().map(|(n, _)| *n).collect();
log!(
DEBUG,
"Reading templates from {}, canonical form {:?}",
root.display(),
root.canonicalize()
);
match fs::read_dir(&root) {
Ok(dir) => {
for file_opt in dir {
@ -431,4 +440,157 @@ mod tests {
assert_eq!(&contents, map_contents);
}
}
#[test]
fn rendering_error_html_contains_inner_error() {
let outer_payload = "Gl0c7CyArjlG1Zgvj3D5BFmZT6zRz5Ky";
let inner_payload = "t53pvXCf0JqUzwiM5BZbYxAQadYSJ9XW";
let inner_error = tera::Error::msg(inner_payload);
let error = RenderingError::new(outer_payload, 501, &inner_error);
assert!(error.template.html.contains(inner_payload));
assert!(error.template.html.contains(outer_payload));
}
#[test]
fn rendering_error_display() {
let payload = "4LKNOSqfW0Ys3LALDAond8IIp5RgN7vK";
let error = RenderingError::new(payload, 501, &tera::Error::msg(""));
let display_string = format!("{error}");
assert!(display_string.contains(payload));
}
#[test]
fn empty_template_read_is_an_error() {
let result = read_template("", PathBuf::from(""));
assert!(result.is_err());
}
#[test]
fn template_read_without_permissions_is_an_error() {
let result = read_template("", PathBuf::from("/etc/shadow"));
assert!(result.is_err());
}
#[test]
fn template_read_without_a_default_is_an_error() {
let result = read_template(
"xkQwFZpqf5iz",
PathBuf::from("templates/Boy5CZQUk2oX"),
);
assert!(result.is_err());
}
#[test]
fn template_read_with_a_default_is_ok() {
let result =
read_template("base.html", PathBuf::from("templates/St1iFgeOrhCK"));
assert!(result.is_ok());
}
#[test]
fn template_read_with_a_file_is_ok() {
let result =
read_template("GpzjjAPhCTIr", PathBuf::from("templates/base.html"));
assert!(result.is_ok());
}
}
#[cfg(test)]
#[expect(clippy::panic_in_result_fn)]
mod serial_tests {
use std::{ffi::OsStr, os::unix::ffi::OsStrExt as _};
use super::*;
use crate::dev::test::{Directories, Error};
#[test]
#[cfg_attr(not(unix), ignore)]
fn invalid_utf8_template_filename() -> Result<(), Error> {
let dirs = Directories::setup("encoding")?;
let invalid_name = OsStr::from_bytes(&[0xff, 0xfe, 0x80]);
let file_path = dirs.templates.join(invalid_name);
fs::write(file_path, b"")?;
let template_load_result = load_templates();
let err = template_load_result.err().unwrap();
let error_message = err.to_string();
assert!(error_message.contains("not valid unicode"));
Ok(())
}
#[test]
fn custom_template() -> Result<(), Error> {
let dirs = Directories::setup("custom_template")?;
let file_name = "custom.html";
let file_path = dirs.templates.join(file_name);
fs::write(file_path, b"")?;
let engine = load_templates()?;
assert!(engine.get_template_names().any(|t| t == "custom.html"));
Ok(())
}
#[test]
fn custom_template_inheritance_error() -> Result<(), Error> {
let dirs = Directories::setup("custom_template")?;
let file_name = "custom.html";
let file_path = dirs.templates.join(file_name);
fs::write(file_path, br#"{% extends "nonexistent.html" %}"#)?;
let template_load_result = load_templates();
assert!(template_load_result.is_err());
Ok(())
}
#[test]
fn inner_template_no_op() -> Result<(), Error> {
let dirs = Directories::setup("inner_template")?;
let inner_dir = dirs.templates.join("inner");
fs::create_dir(&inner_dir)?;
let inner_template = inner_dir.join("inner.html");
fs::write(inner_template, br#"{% extends "nonexistent.html" %}"#)?;
let engine = load_templates()?;
let default_count = dirs.original.join("templates").read_dir()?.count();
let template_count = engine.get_template_names().count();
assert!(template_count == default_count);
Ok(())
}
#[test]
fn templates_dir_not_found_ok() -> Result<(), Error> {
let dirs = Directories::setup("not_found_error")?;
std::fs::remove_dir_all(&dirs.templates)?;
let template_load_result = load_templates();
template_load_result?;
Ok(())
}
#[test]
// Unexpected here means any error other than 'not found'
fn templates_dir_unexpected_error() -> Result<(), Error> {
let dirs = Directories::setup("unexpected_error")?;
log!(DEBUG, "Working directory is {:?}", std::env::current_dir());
std::fs::remove_dir_all(&dirs.templates)?;
let templates = dirs.test.join("templates");
fs::write(&templates, b"")?;
let template_load_result = load_templates();
assert!(template_load_result.is_err());
Ok(())
}
}

View file

@ -224,7 +224,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 +286,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 +381,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!(

View file

@ -121,7 +121,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 +216,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",
);

View file

@ -60,10 +60,7 @@ 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]

View file

@ -64,7 +64,7 @@ mod tests {
checkbox.checked = false;
assert_eq!(
format!("{}", Token::CheckBox(checkbox.clone())),
format!("{}", Token::CheckBox(checkbox)),
"Tk:CheckBox [empty]"
);
}

View file

@ -60,9 +60,6 @@ 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]");
}
}

View file

@ -80,7 +80,7 @@ mod tests {
);
item.depth = None;
assert_eq!(
format!("{}", Token::Item(item.clone())),
format!("{}", Token::Item(item)),
"Tk:Item [<unknown>] dRMy4"
);
}

View file

@ -28,7 +28,6 @@ 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");
}
}

View file

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

View file

@ -64,7 +64,7 @@ mod tests {
oblique.open = false;
assert_eq!(
format!("{}", Token::Oblique(oblique.clone())),
format!("{}", Token::Oblique(oblique)),
"Tk:Oblique [closed]"
);
}

View file

@ -89,7 +89,7 @@ mod tests {
paragraph.open = None;
assert_eq!(
format!("{}", Token::Paragraph(paragraph.clone())),
format!("{}", Token::Paragraph(paragraph)),
"Tk:Paragraph [unknown]"
);
}

View file

@ -85,7 +85,7 @@ mod tests {
preformat.open = None;
assert_eq!(
format!("{}", Token::PreFormat(preformat.clone())),
format!("{}", Token::PreFormat(preformat)),
"Tk:PreFormat [unknown]"
);
}

View file

@ -62,10 +62,7 @@ mod tests {
);
strike.open = false;
assert_eq!(
format!("{}", Token::Strike(strike.clone())),
"Tk:Strike [closed]"
);
assert_eq!(format!("{}", Token::Strike(strike)), "Tk:Strike [closed]");
}
#[test]

View file

@ -66,7 +66,7 @@ mod tests {
underline.open = false;
assert_eq!(
format!("{}", Token::Underline(underline.clone())),
format!("{}", Token::Underline(underline)),
"Tk:Underline [closed]"
);
}

View file

@ -3,16 +3,10 @@ use crate::syntax::content::{Parseable, parser::Lexeme};
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Verse {
open: Option<bool>,
citation: Option<String>,
}
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,44 @@ 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::*;
#[test]
fn lexed_verse_is_empty() {
let verse = Verse::lex(&Lexeme::default());
assert!(verse.open.is_none());
}
#[test]
fn flat_verse_is_empty() {
let verse = Verse::new(true);
assert!(verse.flatten().is_empty());
}
#[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);
assert_eq!(format!("{open}"), "Verse [open]");
let closed = Verse::new(false);
assert_eq!(format!("{closed}"), "Verse [closed]");
let unknown = Verse::lex(&Lexeme::default());
assert_eq!(format!("{unknown}"), "Verse [unknown]");
}
}

View file

@ -37,7 +37,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|.
@ -138,7 +138,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|, ou 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 |Documentation|, 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

2
static/public/assets/fonts/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
**/*.compact.LICENSE
**/compact.LICENSE

View file

@ -0,0 +1,21 @@
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
2533bdb563fb91d70cb719edca0a0cdc8f5cc347d567561b4a87e7509e02073d ./cormorant/compact.LICENSE
c110f34253aced57d6d4f02edce58b171dca3340591a1119e02ea084a4b78f93 ./cormorant/header.LICENSE
7d5da66dc426b59bbba125049b7016f2011f93724ddf7b7f97ce1911f958b963 ./maven/LICENSE
2533bdb563fb91d70cb719edca0a0cdc8f5cc347d567561b4a87e7509e02073d ./maven/compact.LICENSE
c63dd928ccd5c2c80491b84d1874227536dfced1f1f82cbd900ddc86c59b738b ./maven/header.LICENSE
1d2892790cc9522de02d3f01ba48d12742862b1a69d04d69752938591efabecd ./mononoki/LICENSE
2533bdb563fb91d70cb719edca0a0cdc8f5cc347d567561b4a87e7509e02073d ./mononoki/compact.LICENSE
20601bbaafe0fe8d6a39527785fc501f242ebae18d1aaa4d5d15a8ac4ff4fff3 ./mononoki/header.LICENSE
3e57bc17e8ece63050a2ac5aa99a80f87183289b18303d46311199875b4808b7 ./rawengulk/LICENSE
2533bdb563fb91d70cb719edca0a0cdc8f5cc347d567561b4a87e7509e02073d ./rawengulk/compact.LICENSE
4d8b5ec962dfeb2813bdeb0762e3b714e68e19f9fbcdb3481d12f018b125308b ./rawengulk/header.LICENSE
18837f5b671bd48dc6b595a475d8c45ab3e6ae33adb65d9bbeac59c58f77bc24 ./reforma/LICENSE
2edceb2f872692052b281629777bc5af5386601dd4c437f297f84846f9fa75cf ./reforma/compact.LICENSE
a3d29ef378426d0b1d9f17364a3d7532ad623a51c8c19a3badc74c23e5e93ef6 ./reforma/header.LICENSE

View file

@ -0,0 +1,9 @@
## Known issues
As documented by the source files and hashes in this directory, significant effort was made to preserve the original license files, determine that equally-licensed files have identical licenses and that the vendored license files match the upstream well-known official versions.
In particular, the vendored file for the Reforma font is in Markdown format and as such hard to match against the license file supplied by Creative Commons without substantial reductions in punctuation, spacing and external URLs.
However, because only this font uses such license, it is still a single copy that must end up embedded in the binary. As such, despite a missing matching hash, the vendored version is embedded as-is.
Due to this issue, it was decided that any future font that is a candidate for addition to the project MUST be licensed under some version of the SIL Open Font License.

View file

@ -0,0 +1,393 @@
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.

View file

@ -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.

View file

@ -0,0 +1 @@
https://creativecommons.org/licenses/by-nd/4.0/legalcode.txt

View file

@ -0,0 +1,97 @@
Copyright (c) <dates>, <Copyright Holder> (<URL|email>),
with Reserved Font Name <Reserved Font Name>.
Copyright (c) <dates>, <additional Copyright Holder> (<URL|email>),
with Reserved Font Name <additional Reserved Font Name>.
Copyright (c) <dates>, <additional Copyright Holder> (<URL|email>).
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
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.

View file

@ -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.

View file

@ -0,0 +1 @@
https://openfontlicense.org/documents/OFL.txt

View file

@ -0,0 +1,8 @@
Copyright 2015 The Cormorant Project Authors (github.com/CatharsisFonts/Cormorant) CormorantInfant-Italic[wght].ttf: Copyright 2015 The Cormorant Project Authors (github.com/CatharsisFonts/Cormorant)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

View file

@ -0,0 +1,8 @@
Copyright 2011 The Maven Pro Project Authors (https://github.com/m4rc1e/mavenproFont), with Reserved Font Name "Maven Pro".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

View file

@ -19,7 +19,7 @@ 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,
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
@ -92,4 +92,3 @@ 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.

View file

@ -1,20 +0,0 @@
# mononoki
> A font for programming and code review.
For a closer look [http://madmalik.github.io/mononoki/](http://madmalik.github.io/mononoki/).
## Features
* Alternate stylistic set with dotted zero, configurable with `ss01`.
## Installation
[Download mononoki.zip](https://github.com/madmalik/mononoki/releases/download/1.6/mononoki.zip) and unpack it.
* [macOS](http://support.apple.com/kb/HT2509), alternatively there is also a [homebrew formula](https://github.com/Homebrew/homebrew-cask/blob/main/Casks/font/font-m/font-mononoki.rb).
* [Windows](https://support.microsoft.com/en-us/office/add-a-font-b7c5f17c-4426-4b53-967f-455339c564c1)
* Linux/Unix - distro dependent, if you have a font manager installed on your system, open the font file and hit "Install". Alternatively, there are [mononoki-packages](https://repology.org/project/fonts:mononoki/versions) in many of the package repos, if you prefer installing via package manager.
## Credit
Box drawing characters created with [box drawing](https://github.com/adobe-type-tools/box-drawing).

View file

@ -0,0 +1,9 @@
Copyright (c) 2022, Matthias Tellen matthias.tellen@googlemail.com,
with Reserved Font Name mononoki.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

View file

@ -0,0 +1,7 @@
Copyright (c) 2010, gluk (gluksza@wp.pl),
with Reserved Font Name Rawengulk.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL

View file

@ -1,18 +0,0 @@
# Reforma
Reforma is a bespoke typeface designed for the Universidad Nacional de Córdoba. The UNC commissioned PampaType to create this typeface as part of the celebrations for the centenary of the University Reform, occurred in this house in 1918. Following Argentinas national education policy, libre and free, the typeface Reforma is freely available for anyone, under the Creative Commons license BY-ND 4.0 International. This full license is available at: https://creativecommons.org/licenses/by-nd/4.0/
© Copyright 2018 by the Universidad Nacional de Córdoba [AR]. Designed by Alejandro Lo Celso. Programmed by Guido Ferreyra. PampaType font foundry.
http://pampatype.com.
# Changelog
Version 1.000 (Roman and Italic) created 24/04/2018
First release
Versión 1.001 (Roman) creada 07/06/2018
Bug fix on dieresis

View file

@ -0,0 +1,6 @@
© Copyright 2018 by the Universidad Nacional de Córdoba [AR]. Designed by Alejandro Lo Celso. Programmed by Guido Ferreyra. PampaType font foundry.
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

View file

@ -0,0 +1,127 @@
#!/usr/bin/env sh
set -eu
log() {
printf ' [split] %s\n' "$@" >&2
}
get_marker() {
# extended regex syntax
cc_marker='^\#? ?Attribution-NoDerivatives 4.0 International$'
ofl_marker='^SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007$'
m_file="$1"
if grep -Eq "$ofl_marker" "$m_file"; then
printf '%s' "$ofl_marker"
elif grep -Eq "$cc_marker" "$m_file"; then
printf '%s' "$cc_marker"
else
log "$m_file matches no marker"
printf ''
fi
}
behead() {
b_file="$1"
b_marker="$2"
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
}
compact() {
c_file="$1"
c_marker="$2"
c_out_path="$3"
sed -En "/$c_marker/, \$p" "$c_file" \
| tr -d '[:space:]' \
> "$c_out_path"
}
log "Iterating over font directories"
for dir in *; do
[ -d "$dir" ] || 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" ""
compact "$license" "$marker" "$dir/compact.LICENSE"
fi
done
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
log "$file is empty"
exit 1
fi
done
sha256sum ./*/*LICENSE* > LICENSES.sha256sum
grep compact LICENSES.sha256sum | sort
unique_licenses=$(
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
)
if [ "$unique_hashes" -ne "$unique_licenses" ]; then
log "Number of distinct hashes and licenses don't match."
log "unique hashes: $unique_hashes"
log "unique licenses: $unique_licenses"
exit 1
fi

View file

@ -76,7 +76,7 @@
{% block body %}
{% endblock body %}
</main>
{% if graph.meta.config.footer %}
{% if graph.meta.config.footer or graph.meta.config.serve_fonts %}
<footer>
<hr>
<div>
@ -96,6 +96,10 @@
{{ now(utc=true) | date(format="%Y-%m-%d %H:%M") }} UTC
</time>
{% endif %}
{% if graph.meta.config.serve_fonts %}
&bullet;
<a href="/legal">legal</a>
{% endif %}
{% if graph.meta.config.footer_version %}
&bullet;
en v{{en_version}}

41
templates/legal.html Normal file
View file

@ -0,0 +1,41 @@
{% extends "base.html" %}
{% block title %}Legal{% endblock title %}
{%- block body %}
<h1>Legal</h1>
<p>The following licenses and attributions are made available here in accordance with their terms:</p>
<h2>Fonts</h2>
{% for font_tuple in fonts %}
{% set font = font_tuple.1 %}
<h3>{{ font.name }}</h3>
<p>
From
<a href="{{ font.attribution.project_url }}">
{{ font.attribution.project_name -}}
</a>,
by
<a href="{{ font.attribution.author_url }}">
{{ font.attribution.author -}}
</a>.
</p>
<p><strong>License:</strong>
<a href="{{ font.license.url }}">
{{ font.license.name -}}
</a>
</p>
<details>
<summary>
Expand full license text
</summary>
<p>
{{ font.attribution.license_header | linebreaksbr | safe }}
{{ font.license.text | linebreaksbr | safe }}
</p>
</details>
{% endfor %}
{%- endblock body %}

View file

@ -1,21 +0,0 @@
#!/usr/bin/env sh
set -eu
suffix=$(printf '%s' "$1" | sed 's/.*\.//')
tag="en:$suffix"
if podman container exists "$tag"; then
podman stop --time 3 "$tag"
fi
if [ "$suffix" = 'debian-dev' ]; then
cp ../../target/release/en en
elif [ "$suffix" = 'alpine-dev' ]; then
cp ../../target/x86_64-unknown-linux-musl/release/en en
fi
podman build \
--tag "$tag" \
-f "Containerfile.$suffix"
rm en

View file

@ -1,12 +0,0 @@
#!/usr/bin/env sh
set -eu
suffix=$(printf '%s' "$1" | sed 's/.*\.//')
name="en-$suffix"
tag="en:$suffix"
podman run \
--replace \
--name "$name" \
--publish 3008:80 \
"$tag"

View file

@ -1,3 +0,0 @@
[meta]
config = {
'

View file

@ -1,13 +0,0 @@
{
"nodes": {
"JSON": {
"text": "",
"title": "JSON",
"links": [],
"id": "JSON",
"hidden": false,
"connections": []
}
},
"root_node": "JSON"
}