#!/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: # "@