From 657fb0007f39f07cc0401e0c5d03e25df6234aa4 Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Tue, 21 Jul 2026 20:19:46 -0500 Subject: Inital commit. --- trbldoc.sh | 940 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 940 insertions(+) create mode 100644 trbldoc.sh (limited to 'trbldoc.sh') diff --git a/trbldoc.sh b/trbldoc.sh new file mode 100644 index 0000000..99e89be --- /dev/null +++ b/trbldoc.sh @@ -0,0 +1,940 @@ +#!/bin/sh + +# trbldoc.sh +# A really awful documentation tool +# Installation +# Simply drop into /usr/local/bin/trbldoc and mark executable +# $ sudo cp trbldoc.sh /usr/local/bin/trbldoc +# $ sudo chmod +x /usr/local/bin/trbldoc +# Usage: +# trbldoc [options] +# Description: +# trbldoc works in several passes, first, it looks at each file in the +# folders, and for each file it looks for comments +# and extracts them as a series of "chunks" - +# unbroken lines of comments. Each chunk should declare +# a program. The text of the chunk will be fed into this program +# on standard in, and trbldoc expects html for this chunk on standard out. +# +# Then, it groups chunks according to their "@name " line, +# and orders them according to their "@priority n" line. +# If a comment doesn't have a name, is the file path the +# comment was found in. If a comment doesn't have a priority, it's priority +# is the line number the chunk started on. +# +# Chunks may additionaly have the following "documentation identifiers": +# @name - Override the file path this chunk was found +# in +# @exec ... - Override the program we use to +# process this chunk +# @file - Pretend this chunk came from another file +# e.g. if the file being documented is built from another +# (source) file. +# @ref - This chunk should be referenced by this name (instead of +# of it's @name). +# @priority - Higher values render first when assembling pages. +# helps keep important information at the top. +# +# The following template variables may be used anywhere in chunk body text +# and are substituted before the chunk's program is run: +# {{src_repo}} - source repository URL (see TRBLDOC_SRC_REPO). Useful +# for building links back to source files. +# {{ref_string}} - HTML link for this chunk's @ref directive, resolved +# via the matching ref_resolvers script. Empty if @ref is absent +# or the resolver produces no output. +# {{toc}} - full site navigation rendered as HTML list items. +# +# Then, it resolves refrences, replacing text of "@" with a link +# to the first chunk declaring "@ref " (by priority/source order). +# If no internal ref matches, it falls back to external resolvers: +# "@