From 642408468401f6ddebc06c4f3ffbfb5066fb9aba Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Thu, 11 Mar 2021 14:15:01 +0100 Subject: doc(web): use htmlman from depot.users.sterni MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In an effort to prevent me from copying the same piece of code into every repository of mine that contains a man page and to prevent me from coming up with hacky, specific solutions, I have cleaned up the piece of code I had for web documentation and added it to tvl's depot: https://code.tvl.fyi/about/users/sterni/htmlman?id=2cd2b58a04cd86e8bf1d72e9c0a67ad8c8e9c8dd It has less features (no html documentation…) and the URLs change, but this a good way forward, I think: The readme and similar stuff can be viewed on GitHub, we only really need man pages. --- .github/workflows/deploy-doc.yml | 6 +- README.md | 2 +- doc/web.nix | 235 ++++++--------------------------------- 3 files changed, 35 insertions(+), 208 deletions(-) diff --git a/.github/workflows/deploy-doc.yml b/.github/workflows/deploy-doc.yml index 4175143..d3c710a 100644 --- a/.github/workflows/deploy-doc.yml +++ b/.github/workflows/deploy-doc.yml @@ -16,12 +16,10 @@ jobs: with: name: buchstabensuppe authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - # permission change taken from curry-club-augsburg.de - name: Build web output run: | - nix-build doc/web.nix - cp -RL result tmp - chmod -R +w tmp + nix-build -A deploy doc/web.nix + ./result -w tmp - name: Deploy output to GitHub Pages uses: JamesIves/github-pages-deploy-action@3.7.1 with: diff --git a/README.md b/README.md index 3096686..9031417 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ how to interact with a flipdot display. mainly it involves: you can also play around with its cli: the following command renders “Hello World” black on white using GNU Unifont onto a flipdot display (or simulator) running on `localhost:2323`. -See [bs-renderflipdot(1)](https://sternenseemann.github.io/buchstabensuppe/man/bs-renderflipdot.1.html) +See [bs-renderflipdot(1)](https://sternenseemann.github.io/buchstabensuppe/bs-renderflipdot.1.html) for more usage details. ``` diff --git a/doc/web.nix b/doc/web.nix index cfc77cb..fcf8489 100644 --- a/doc/web.nix +++ b/doc/web.nix @@ -1,208 +1,37 @@ -{ pkgs ? (import {}) }: +{ depotSrc ? builtins.fetchGit { + url = "https://code.tvl.fyi"; + ref = "canon"; + rev = "2cd2b58a04cd86e8bf1d72e9c0a67ad8c8e9c8dd"; + } +}: let - manPages = [ - { name = "bs-renderflipdot"; section = 1; } - ]; - - readmeDeps = [ - "bs-renderflipdot.c" - "doc/flipdot-render.png" - ]; - - lib = pkgs.lib; - root = ./..; - repoRoot = builtins.path { - name = "buchstabensuppe-src"; - path = root; - filter = pkgs.nix-gitignore.gitignoreFilter - (builtins.readFile ./../.gitignore) root; - }; - - # TODO: man inclusion -Oman - buildManPage = { name, section }: - let - out = "$out/man/${name}.${toString section}.html"; - in '' - echo ${lib.escapeShellArg (commonHead 1 "${name}(${toString section})")} \ - > ${out} - echo "
" >> ${out} - ${pkgs.mandoc}/bin/mandoc -Thtml -Ofragment \ - ${repoRoot}/doc/man/${name}.${toString section} \ - >> ${out} - echo "
" >> ${out} - ''; - - readme = pkgs.runCommandLocal "README.html" {} '' - echo ${lib.escapeShellArg (commonHead 1 "buchstabensuppe/README")} > $out - echo "
" >> $out - ${pkgs.lowdown}/bin/lowdown ${repoRoot}/README.md >> $out - echo "
" >> $out - ''; - - normalize = pkgs.fetchurl { - url = "https://necolas.github.io/normalize.css/8.0.1/normalize.css"; - sha256 = "04jmvybwh2ks4dlnfa70sb3a3z3ig4cv0ya9rizjvm140xq1h22q"; - }; - - style = pkgs.writeText "style.css" '' - body { - font-size: 1em; - font-family: serif; - background-color: #efefef; - line-height: 1.5; - } - - h1, h2, h3, h4, h5, h6 { - font-family: 'Source Sans Pro', 'Open Sans', sans-serif; - } - - a:link, a:visited { - color: #3e7eff; - } - - header, main, footer { - margin-top: 0; - margin-bottom: 0; - margin-left: auto; - margin-right: auto; - max-width: 800px; - background-color: white; - padding: 5px 10px; - } - - /* markdown */ - - pre { - background-color: #efefef; - overflow: auto; - padding: 10px; - } - - img { - max-width: 100%; - } - - blockquote { - border-left: 5px solid #efefef; - margin-left: 0; - padding-left: 10px; - } - - /* man page related */ - table.head, table.foot { - width: 100%; - } - - table.head { - padding-bottom: 20px; - } - - table.foot { - padding-top: 20px; - } - - table.head td, table.foot td { - text-align: center; - padding: 0; - } - - table.head td:nth-last-child(1), - table.foot td:nth-last-child(1) { - text-align: right; - } + depot = import depotSrc { }; +in - table.head td:nth-child(1), - table.foot td:nth-child(1) { - text-align: left; +depot.users.sterni.htmlman { + title = "buchstabensuppe"; + pages = [ + { + name = "bs-renderflipdot"; + section = 1; } + ]; + manDir = ./man; + description = '' + * [Source (GitHub)](https://github.com/sternenseemann/buchstabensuppe) + * [Source (Mirror)](https://code.sterni.lv/buchstabensuppe/) + + buchstabensuppe is a simple font rendering library intended + for rendering fonts on binary black and white displays + with low resolutions, for example + [OpenLab's flipdot display](https://wiki.openlab-augsburg.de/Flipdots). + The goal is to implement font rendering that + is adequate for the situation and as correct as possible + (e. g. does text shaping, …). + + Documentation is still a bit sparse, but shall be improved. + For now most information is in the + [README](https://github.com/sternenseemann/buchstabensuppe/blob/main/README.md). ''; - - commonHead = depth: title: - let - styleDir = lib.concatStrings (builtins.genList (x: "../") depth); - in '' - - - - - ${title} - - - ''; - - index = pkgs.writeText "index.html" '' - ${commonHead 0 "buchstabensuppe"} - -
-

buchstabensuppe

- -
-
-
-

description

-

- buchstabensuppe is a simple font rendering library intended - for rendering fonts for binary black and white displays - with low resolutions, for example - - OpenLab's flipdot display - . The goal is to implement font rendering that - is adequate for the situation and as correct as possible - (e. g. do text shaping, …). -

-

- Documentation is still a bit sparse, but shall be improved. - For now most information is in the - README. -

-
- -
-

man pages

- - -
-
- - - ''; - -in - -pkgs.runCommandLocal "buchstabensuppe-web" {} '' - mkdir -p $out/man - mkdir -p $out/readme - cat ${normalize} ${style} > $out/style.css - cp ${index} $out/index.html - - ${lib.concatMapStrings buildManPage manPages} - - cp ${readme} $out/readme/README.html - - ${lib.concatMapStrings (dep: '' - mkdir -p "$(dirname "$out/readme/${dep}")" - cp "${repoRoot}/${dep}" "$out/readme/${dep}" - '') readmeDeps} -'' +} -- cgit 1.4.1