diff --git a/.forgejo/workflows/setup-tools.sh b/.forgejo/workflows/setup-tools.sh index ff6e814..dfcb6f8 100755 --- a/.forgejo/workflows/setup-tools.sh +++ b/.forgejo/workflows/setup-tools.sh @@ -9,12 +9,21 @@ CARGO_LLVM_COV_SHA256SUM="57f491aedf7cdb261538ceb49cbb1ee9d27df7ca205a5e1a009caa CARGO_AUDIT_VERSION="0.22.1" CARGO_AUDIT_TAG="cargo-audit%2Fv$CARGO_AUDIT_VERSION" CARGO_AUDIT_SHA256SUM="1890badd5f15831a9af4b074399fcd21e6f7c0fe42c84e9254cdffc9f813765c" +TAPLO_VERSION="0.10.0" +TAPLO_SHA256SUM="8fe196b894ccf9072f98d4e1013a180306e17d244830b03986ee5e8eabeb6156" +TYPOS_VERSION="1.47.2" +TYPOS_SHA256SUM="7aef58932fc123b4cf4b40d86468e89a3297d80169051d7cfd13a235e05fc426" TRIPLE="x86_64-unknown-linux-gnu" TRIPLE_MUSL="x86_64-unknown-linux-musl" fetch() { - repo="$1"; tag="$2"; filename="$3"; digest="$4"; binary="$5" + repo="$1" + tag="$2" + filename="$3" + digest="$4" + binary="$5" + renamed_binary="${6:-$binary}" [ -d /tmp/tools ] || mkdir -p /tmp/tools @@ -24,9 +33,19 @@ fetch() { printf '%s %s\n' "$digest" "/tmp/$filename" > /tmp/digest sha256sum --check /tmp/digest - tar xf "/tmp/$filename" -C /tmp/tools - find /tmp/tools -type f -executable -name "$binary" \ - -exec mv -v '{}' /usr/local/bin ';' + + if printf '%s' "$filename" | grep -qE '\.tar\.|\.tgz$'; then + tar xf "/tmp/$filename" -C /tmp/tools + elif printf '%s' "$filename" | grep -q '\.gz$'; then + gunzip -c "/tmp/$filename" > "/tmp/tools/$binary" + else + echo "Fatal: can't determine how to unpack $filename" + exit 1 + fi + + find /tmp/tools -type f -name "$binary" \ + -exec mv -v '{}' "/usr/local/bin/$renamed_binary" ';' + chmod +x "/usr/local/bin/$renamed_binary" } fetch casey/just "$JUST_VERSION" \ @@ -40,3 +59,11 @@ fetch taiki-e/cargo-llvm-cov "v$CARGO_LLVM_COV_VERSION" \ fetch rustsec/rustsec "$CARGO_AUDIT_TAG" \ "cargo-audit-$TRIPLE-v$CARGO_AUDIT_VERSION.tgz" \ "$CARGO_AUDIT_SHA256SUM" cargo-audit + +fetch tamasfe/taplo "$TAPLO_VERSION" \ + "taplo-linux-x86_64.gz" \ + "$TAPLO_SHA256SUM" taplo-linux-x86_64 taplo + +fetch crate-ci/typos "v$TYPOS_VERSION" \ + "typos-v$TYPOS_VERSION-$TRIPLE_MUSL.tar.gz" \ + "$TYPOS_SHA256SUM" typos diff --git a/.justfile b/.justfile index 28649d6..9ae185c 100644 --- a/.justfile +++ b/.justfile @@ -51,7 +51,7 @@ alias wc := run-watch-containerized [private] assess-quick: - {{ just_cmd }} lint check test-cover-quick + {{ just_cmd }} lint check test-cover-quick spell [private] assess-run-quick: @@ -347,7 +347,7 @@ verify: exit 1 fi {{ just_cmd }} \ - todos-assess version-assess deny \ + todos-assess version-assess spell schema-lint deny \ format-assess lint-assess check \ test "" cover-assess @@ -381,6 +381,16 @@ alias ta := todos-assess deny: cargo deny check +# Check for spelling mistakes +[group: 'assess'] +spell: + typos + +# Lint the default and builtin graphs against the schema +[group: 'assess'] +schema-lint: + test -z "$(grep -LF '#:schema ./graph-schema.json' static/*.toml)" + taplo lint static/*.toml # BUILD diff --git a/Cargo.toml b/Cargo.toml index 130e36b..a3b9a52 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -268,3 +268,12 @@ zero_sized_map_values = "warn" negative_feature_names = "warn" redundant_feature_names = "warn" wildcard_dependencies = "warn" + +[package.metadata.typos.default] +extend-ignore-re = [ + "oficial do Brasil", + "Creative Commons ND", + "Creative Commons BY-ND", + "CC_BY_ND_", + "(?ms)^mod tests \\{.*^\\}", +] diff --git a/src/router/handlers/fixed.rs b/src/router/handlers/fixed.rs index d9bd120..bf905ed 100644 --- a/src/router/handlers/fixed.rs +++ b/src/router/handlers/fixed.rs @@ -216,7 +216,7 @@ impl Asset { /// /// Defaults are found in the `fixed::DEFAULTS` map. /// -/// Returns a `FallbackError` if neither is found or an I/O error ocurred. +/// Returns a `FallbackError` if neither is found or an I/O error occurred. fn fallback(path: &str, graph: &Graph) -> Result { let target = format!("static/public/assets/{path}"); let defaults: HashMap<&str, &str> = TEXTS.iter().copied().collect(); @@ -292,7 +292,7 @@ pub async fn file( } else { String::from( "The requested file exists, but the server lacks \ - permission to access it or another I/O error ocurred.", + permission to access it or another I/O error occurred.", ) }; if log::env_level() >= DEBUG { diff --git a/static/graph.toml b/static/graph.toml index b961c43..efd69d4 100644 --- a/static/graph.toml +++ b/static/graph.toml @@ -6,13 +6,13 @@ root_node = "Introduction" text = """ ## What is en? -en is a writing tool. It was designed with complex, conceptually heavy projects, where the relationships between terms matter and possibly have their own attributes. You can use it to write non-linear, connected textual works and have their references to which other mapped out as a |graph| of metadata-rich, interrelated information. This very website is running en. +en is a writing tool. It was designed for complex, conceptually heavy projects, where the relationships between terms matter and possibly have their own attributes. You can use it to write non-linear, connected textual works and have their references to which other mapped out as a |graph| of metadata-rich, interrelated information. This very website is running en. It works by ingesting plain text files written in |TOML|, a file format that focuses on being human-readable but that can also be directly interpreted by computer programs. These files contain your node definitions and allow en to construct a human-readable website that makes your graphs' nodes browsable, searchable and listed in relation to each other or as a shallow tree of nodes. It also serves this graph as raw data for integration with other tools that can further analyze and transform what you have written. ## Motivation -en was created out of the desire to write a web of encyclopedic-style long-form texts documenting a personal worldview. It aims to remove the constraints imposed by trying to mimic the linearity of a typical nonfiction book. +en was created out of the desire to write a book that did not follow a linear progression. But it can be used for note-taking, studying, documentation, encyclopedic content and any other format that benefits from a focus on the connections between pages. It aims to remove the constraints imposed by trying to mimic the linearity of typical nonfiction writing. It's described as a "writing instrument" because it's not so much about the presentation or even the web format. While that's the medium for this particular implementation, you can notice en serves its raw data in both TOML and JSON. It's first and foremost about mapping out and structuring written thoughts. @@ -908,11 +908,22 @@ text = """ ## Upcoming ## `v0.5.0-alpha` -- [ ] Custom kind for connections - [ ] Docs for custom assets and templates +- [ ] Custom kind for connections +- [ ] Hide tree leaves from the top level - [x] Fix anchors containing `/` and `#` considered node IDs - [x] Fix `PreFormat` blocks rendering HTML tags +## `v0.6.0-alpha` +- [ ] Custom header include + +## `v0.7.0-alpha` +- [ ] Frontmatter format +- [ ] Multi-file graphs + +## `v0.8.0-alpha` +- [ ] Full-text search +
## Backlog @@ -943,12 +954,10 @@ text = """ - [ ] By most linked to - [ ] By most linked - Tree - - [ ] Hide tree leaves from the top level - [ ] Branch deeper - Customization - [ ] Custom assets (favicon, CSS) - [x] Drop all hardcoded assets endpoints - - [ ] Custom header include - [x] Custom templates - [ ] user-supplied loading order (e.g. through filenames) - [ ] Themes @@ -974,8 +983,6 @@ text = """ ### I/O formats #### Input -- [ ] Frontmatter format -- [ ] Multi-file graphs - [ ] Multi-graph #### Output @@ -991,9 +998,6 @@ text = """ - [ ] Reduce whitespace - See: |https://keats.github.io/tera/docs/#whitespace-control| -### Server -- [ ] Full-text search - ### Documentation - [ ] Generate `meta.config` docs from JSON schema diff --git a/static/welcome.toml b/static/welcome.toml index 7ff2d33..90341de 100644 --- a/static/welcome.toml +++ b/static/welcome.toml @@ -1,3 +1,5 @@ +#:schema ./graph-schema.json + [nodes.GettingStarted] title = "Getting Started" text = """