Files
klammertext/env/runtime.env

82 lines
4.4 KiB
Bash
Raw Permalink Normal View History

Typed arguments, calculated tables, spans, closed-world fonts, top-level fnt/ and env/ Sync with klammertext-dev through b90b0e09: - Argument types end to end: :python_cast values are applied (Python @eval receives real bools/numbers/lists), argument values are validated against their argtype patterns with the argtype's description as the error message, argtypes can declare :default (overridable per declaration), and parameterized type families are supported: rest(N) casts a rest argument to an N-dimensional list (bar-count = dimension). - Unified indexed_range syntax (selector with parenthesized subsets, composable mnemonic names) for table lines and spans. - Table klammer: caption fonts fixed in both targets, :column_width / :leading / :colsep wired, :colspan and :rowspan render (HTML attributes; \multicolumn / \multirow), calculated cell values (:calc) with prefix operators, display-precision semantics, :calc_format and :decimal period|comma. - Fonts: closed-world resolution on the Klammertext font store (infrastructure in mac/font_store; no Google Fonts links or fetch). Default fonts live in the top-level fnt/; additional fonts install into KLAMMERTEXT_FONTS directories via kdesc --font (list, samples, preview, install — classification by font metadata). CSS font family names are quoted (digit-initial families were silently lost). - Environment files moved from mac/env/ to the top-level env/; shell profiles source env/runtime.env. Dead per-host variants removed. - Container: fnt/ ships in the image; curl removed (no network use).
2026-07-22 18:17:43 +02:00
# env/runtime.env — single self-configuring runtime environment for Klammertext.
#
# Source this from your shell profile (~/.bashrc etc.):
Typed arguments, calculated tables, spans, closed-world fonts, top-level fnt/ and env/ Sync with klammertext-dev through b90b0e09: - Argument types end to end: :python_cast values are applied (Python @eval receives real bools/numbers/lists), argument values are validated against their argtype patterns with the argtype's description as the error message, argtypes can declare :default (overridable per declaration), and parameterized type families are supported: rest(N) casts a rest argument to an N-dimensional list (bar-count = dimension). - Unified indexed_range syntax (selector with parenthesized subsets, composable mnemonic names) for table lines and spans. - Table klammer: caption fonts fixed in both targets, :column_width / :leading / :colsep wired, :colspan and :rowspan render (HTML attributes; \multicolumn / \multirow), calculated cell values (:calc) with prefix operators, display-precision semantics, :calc_format and :decimal period|comma. - Fonts: closed-world resolution on the Klammertext font store (infrastructure in mac/font_store; no Google Fonts links or fetch). Default fonts live in the top-level fnt/; additional fonts install into KLAMMERTEXT_FONTS directories via kdesc --font (list, samples, preview, install — classification by font metadata). CSS font family names are quoted (digit-initial families were silently lost). - Environment files moved from mac/env/ to the top-level env/; shell profiles source env/runtime.env. Dead per-host variants removed. - Container: fnt/ ships in the image; curl removed (no network use).
2026-07-22 18:17:43 +02:00
# source /path/to/klammertext/K/env/runtime.env
#
Typed arguments, calculated tables, spans, closed-world fonts, top-level fnt/ and env/ Sync with klammertext-dev through b90b0e09: - Argument types end to end: :python_cast values are applied (Python @eval receives real bools/numbers/lists), argument values are validated against their argtype patterns with the argtype's description as the error message, argtypes can declare :default (overridable per declaration), and parameterized type families are supported: rest(N) casts a rest argument to an N-dimensional list (bar-count = dimension). - Unified indexed_range syntax (selector with parenthesized subsets, composable mnemonic names) for table lines and spans. - Table klammer: caption fonts fixed in both targets, :column_width / :leading / :colsep wired, :colspan and :rowspan render (HTML attributes; \multicolumn / \multirow), calculated cell values (:calc) with prefix operators, display-precision semantics, :calc_format and :decimal period|comma. - Fonts: closed-world resolution on the Klammertext font store (infrastructure in mac/font_store; no Google Fonts links or fetch). Default fonts live in the top-level fnt/; additional fonts install into KLAMMERTEXT_FONTS directories via kdesc --font (list, samples, preview, install — classification by font metadata). CSS font family names are quoted (digit-initial families were silently lost). - Environment files moved from mac/env/ to the top-level env/; shell profiles source env/runtime.env. Dead per-host variants removed. - Container: fnt/ ships in the image; curl removed (no network use).
2026-07-22 18:17:43 +02:00
# This is the runtime counterpart of the shared env/makefile.env: one file
# for every machine, with all machine-specific values AUTO-DETECTED. There is no
# per-host runtime.env.<host> file and no HOST/OS/SITE selector.
# - KLAMMERTEXT_HOME : derived from this file's own location (self-locating)
# - KLAMMERTEXT_TEXLIVE_BIN : newest ~/external/texlive/<year>/bin/<arch>
# Machine-unique, non-committable additions (extra library paths such as NVIDIA
Typed arguments, calculated tables, spans, closed-world fonts, top-level fnt/ and env/ Sync with klammertext-dev through b90b0e09: - Argument types end to end: :python_cast values are applied (Python @eval receives real bools/numbers/lists), argument values are validated against their argtype patterns with the argtype's description as the error message, argtypes can declare :default (overridable per declaration), and parameterized type families are supported: rest(N) casts a rest argument to an N-dimensional list (bar-count = dimension). - Unified indexed_range syntax (selector with parenthesized subsets, composable mnemonic names) for table lines and spans. - Table klammer: caption fonts fixed in both targets, :column_width / :leading / :colsep wired, :colspan and :rowspan render (HTML attributes; \multicolumn / \multirow), calculated cell values (:calc) with prefix operators, display-precision semantics, :calc_format and :decimal period|comma. - Fonts: closed-world resolution on the Klammertext font store (infrastructure in mac/font_store; no Google Fonts links or fetch). Default fonts live in the top-level fnt/; additional fonts install into KLAMMERTEXT_FONTS directories via kdesc --font (list, samples, preview, install — classification by font metadata). CSS font family names are quoted (digit-initial families were silently lost). - Environment files moved from mac/env/ to the top-level env/; shell profiles source env/runtime.env. Dead per-host variants removed. - Container: fnt/ ships in the image; curl removed (no network use).
2026-07-22 18:17:43 +02:00
# iray, local tools, etc.) go in an optional, gitignored env/runtime.env.local
# sourced at the end -- NOT in this shared file, so one machine's bundled
# libraries can't shadow another's system libraries.
# --- KLAMMERTEXT_HOME: self-locate (bash sets BASH_SOURCE; zsh sets $0) --------
Typed arguments, calculated tables, spans, closed-world fonts, top-level fnt/ and env/ Sync with klammertext-dev through b90b0e09: - Argument types end to end: :python_cast values are applied (Python @eval receives real bools/numbers/lists), argument values are validated against their argtype patterns with the argtype's description as the error message, argtypes can declare :default (overridable per declaration), and parameterized type families are supported: rest(N) casts a rest argument to an N-dimensional list (bar-count = dimension). - Unified indexed_range syntax (selector with parenthesized subsets, composable mnemonic names) for table lines and spans. - Table klammer: caption fonts fixed in both targets, :column_width / :leading / :colsep wired, :colspan and :rowspan render (HTML attributes; \multicolumn / \multirow), calculated cell values (:calc) with prefix operators, display-precision semantics, :calc_format and :decimal period|comma. - Fonts: closed-world resolution on the Klammertext font store (infrastructure in mac/font_store; no Google Fonts links or fetch). Default fonts live in the top-level fnt/; additional fonts install into KLAMMERTEXT_FONTS directories via kdesc --font (list, samples, preview, install — classification by font metadata). CSS font family names are quoted (digit-initial families were silently lost). - Environment files moved from mac/env/ to the top-level env/; shell profiles source env/runtime.env. Dead per-host variants removed. - Container: fnt/ ships in the image; curl removed (no network use).
2026-07-22 18:17:43 +02:00
# This file lives at $KLAMMERTEXT_HOME/env/runtime.env, so go up one level.
_kt_self="${BASH_SOURCE[0]:-$0}"
Typed arguments, calculated tables, spans, closed-world fonts, top-level fnt/ and env/ Sync with klammertext-dev through b90b0e09: - Argument types end to end: :python_cast values are applied (Python @eval receives real bools/numbers/lists), argument values are validated against their argtype patterns with the argtype's description as the error message, argtypes can declare :default (overridable per declaration), and parameterized type families are supported: rest(N) casts a rest argument to an N-dimensional list (bar-count = dimension). - Unified indexed_range syntax (selector with parenthesized subsets, composable mnemonic names) for table lines and spans. - Table klammer: caption fonts fixed in both targets, :column_width / :leading / :colsep wired, :colspan and :rowspan render (HTML attributes; \multicolumn / \multirow), calculated cell values (:calc) with prefix operators, display-precision semantics, :calc_format and :decimal period|comma. - Fonts: closed-world resolution on the Klammertext font store (infrastructure in mac/font_store; no Google Fonts links or fetch). Default fonts live in the top-level fnt/; additional fonts install into KLAMMERTEXT_FONTS directories via kdesc --font (list, samples, preview, install — classification by font metadata). CSS font family names are quoted (digit-initial families were silently lost). - Environment files moved from mac/env/ to the top-level env/; shell profiles source env/runtime.env. Dead per-host variants removed. - Container: fnt/ ships in the image; curl removed (no network use).
2026-07-22 18:17:43 +02:00
export KLAMMERTEXT_HOME="$(cd "$(dirname "$_kt_self")/.." && pwd)"
unset _kt_self
_kt_uname="$(uname -s)"
# --- KLAMMERTEXT_TEXLIVE_BIN: newest installed TeX Live under ~/external -------
# Klammertext's TeX Live installs are named by 4-digit year (2024, 2025, 2026).
# Match only those so unrelated dirs (e.g. a "texlive-2022-min" system install)
# are never selected; sort -V then picks the newest year.
if [ "$_kt_uname" = "Darwin" ]; then
_kt_arch="universal-darwin"
else
_kt_arch="$(uname -m)-linux" # e.g. x86_64-linux
fi
# Use `find` with a -path pattern, NOT a shell glob: on macOS/zsh an unmatched
# glob (no texlive installed) is a hard "no matches found" error, whereas find
# just returns nothing. The -path pattern keeps the 4-digit-year restriction.
_kt_tl="$(find "$HOME/external/texlive" -maxdepth 3 -type d \
-path "*/[0-9][0-9][0-9][0-9]/bin/$_kt_arch" 2>/dev/null \
| sort -V | tail -1)"
[ -n "$_kt_tl" ] && export KLAMMERTEXT_TEXLIVE_BIN="$_kt_tl"
unset _kt_tl _kt_arch
# --- PATH (TeX Live appended only if one was found) ---------------------------
export PATH="$KLAMMERTEXT_HOME/bin:$KLAMMERTEXT_HOME/tst${KLAMMERTEXT_TEXLIVE_BIN:+:$KLAMMERTEXT_TEXLIVE_BIN}:$PATH"
# --- Per-platform: LSan suppressions + shared library search path -------------
# The shared library path deliberately includes ONLY Klammertext's own .so dirs,
# NOT third-party bundled-library dirs. In particular NVIDIA iray's platforms/
# ships its own libfreetype.so and Qt6; if added here they shadow the system
# libraries, and iray's freetype drags in unversioned libharfbuzz.so/libbz2.so
# (absent without -dev packages), which breaks `import OpenImageIO` (SKS @image).
# Machine-specific library paths (iray included) go in runtime.env.local.
if [ "$_kt_uname" = "Darwin" ]; then
# macOS: no LD/DYLD_LIBRARY_PATH needed — libklammertext.so is found via the
# binaries' @loader_path rpath and document.so is dlopen'd by absolute path.
# LeakSanitizer is unsupported on macOS, so LSAN_OPTIONS does not apply.
:
else
# LSan suppressions for unactionable libpython/OpenImageIO leaks (see
# lsan.supp). Real leaks in Klammertext code are still reported; no effect
# in performance builds (OPTIMIZE=1, which disables ASan).
Typed arguments, calculated tables, spans, closed-world fonts, top-level fnt/ and env/ Sync with klammertext-dev through b90b0e09: - Argument types end to end: :python_cast values are applied (Python @eval receives real bools/numbers/lists), argument values are validated against their argtype patterns with the argtype's description as the error message, argtypes can declare :default (overridable per declaration), and parameterized type families are supported: rest(N) casts a rest argument to an N-dimensional list (bar-count = dimension). - Unified indexed_range syntax (selector with parenthesized subsets, composable mnemonic names) for table lines and spans. - Table klammer: caption fonts fixed in both targets, :column_width / :leading / :colsep wired, :colspan and :rowspan render (HTML attributes; \multicolumn / \multirow), calculated cell values (:calc) with prefix operators, display-precision semantics, :calc_format and :decimal period|comma. - Fonts: closed-world resolution on the Klammertext font store (infrastructure in mac/font_store; no Google Fonts links or fetch). Default fonts live in the top-level fnt/; additional fonts install into KLAMMERTEXT_FONTS directories via kdesc --font (list, samples, preview, install — classification by font metadata). CSS font family names are quoted (digit-initial families were silently lost). - Environment files moved from mac/env/ to the top-level env/; shell profiles source env/runtime.env. Dead per-host variants removed. - Container: fnt/ ships in the image; curl removed (no network use).
2026-07-22 18:17:43 +02:00
export LSAN_OPTIONS="suppressions=$KLAMMERTEXT_HOME/env/lsan.supp:print_suppressions=0"
export LD_LIBRARY_PATH="$KLAMMERTEXT_HOME/mac:$KLAMMERTEXT_HOME/sks/kutil:$KLAMMERTEXT_HOME/sks/document:$KLAMMERTEXT_HOME/doc/handbook${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
unset _kt_uname
Markdown to PDF: the mdpdf command, and the fonts it needs This snapshot carries sks/tns/, the translation directory, into the distribution for the first time, together with the two default font families its stylesheet names. sks/tns/ holds two converters in opposite directions. md_to_sks.py converts Markdown to Klammertext, recording what it cannot convert exactly as "#[MD ... ]#" markers so a draft carries its own worklist. md_to_pdf.py renders Markdown straight to PDF through a headless Chromium driven over the DevTools Protocol, bypassing Klammertext entirely -- the route for a document that is not ready to convert, and a permanent one for Markdown that Klammertext cannot represent well. Neither is loaded by the SKS; md_to_pdf needs markdown-it-py, which it keeps in a virtual environment of its own and creates with --setup. The everyday form of the second is the mdpdf command, a shell function in sks/tns/mdpdf.sh that env/runtime.env sources, so anyone with the Klammertext environment has it: mdpdf notes.md # writes notes.pdf beside it It supplies the house fonts, the size matching, and the code wrapping, completes on *.md at the TAB key, and takes its defaults from MDPDF_* variables so one can be changed in a shell profile without copying the function. It is POSIX shell rather than zsh, since runtime.env is sourced from bash profiles too. Two things the stylesheet does that a print stylesheet usually cannot. Code lines are wrapped to a column count MEASURED from the rendered page rather than written down -- the browser is asked how many characters a code box holds, over every box in the document, so the wrapping stays right when the fonts, sizes or margins change. And the page number is a CSS Paged Media margin box, which current Chromium implements, so it is set in the document's own face instead of the browser's generic sans. fnt/ gains EB Garamond and Source Sans 3, the serif and sans the stylesheet asks for by default. (from dev 97d4f244c737)
2026-08-09 15:54:05 +02:00
# --- The mdpdf command (Markdown -> PDF; sks/tns/mdpdf.sh) --------------------
# Sourced here rather than left to each user's profile, so the command exists
# wherever the rest of the Klammertext environment does. The file defines one
# shell function and registers completion for it: POSIX shell, no output, and
# harmless in a non-interactive shell.
if [ -f "$KLAMMERTEXT_HOME/sks/tns/mdpdf.sh" ]; then
. "$KLAMMERTEXT_HOME/sks/tns/mdpdf.sh"
fi
# --- Optional per-machine escape hatch (gitignored, absent by default) ---------
# Use an if-block (not `[ -f ] && .`) so that when the local file is absent this
# file's final exit status is 0 -- otherwise `source runtime.env` returns
# non-zero, breaking `source runtime.env && ...` and `set -e` callers.
Typed arguments, calculated tables, spans, closed-world fonts, top-level fnt/ and env/ Sync with klammertext-dev through b90b0e09: - Argument types end to end: :python_cast values are applied (Python @eval receives real bools/numbers/lists), argument values are validated against their argtype patterns with the argtype's description as the error message, argtypes can declare :default (overridable per declaration), and parameterized type families are supported: rest(N) casts a rest argument to an N-dimensional list (bar-count = dimension). - Unified indexed_range syntax (selector with parenthesized subsets, composable mnemonic names) for table lines and spans. - Table klammer: caption fonts fixed in both targets, :column_width / :leading / :colsep wired, :colspan and :rowspan render (HTML attributes; \multicolumn / \multirow), calculated cell values (:calc) with prefix operators, display-precision semantics, :calc_format and :decimal period|comma. - Fonts: closed-world resolution on the Klammertext font store (infrastructure in mac/font_store; no Google Fonts links or fetch). Default fonts live in the top-level fnt/; additional fonts install into KLAMMERTEXT_FONTS directories via kdesc --font (list, samples, preview, install — classification by font metadata). CSS font family names are quoted (digit-initial families were silently lost). - Environment files moved from mac/env/ to the top-level env/; shell profiles source env/runtime.env. Dead per-host variants removed. - Container: fnt/ ships in the image; curl removed (no network use).
2026-07-22 18:17:43 +02:00
if [ -f "$KLAMMERTEXT_HOME/env/runtime.env.local" ]; then
. "$KLAMMERTEXT_HOME/env/runtime.env.local"
fi