From 8a0a8a49472dc879188215838e83ae00fc78fb3f Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 26 Feb 2013 16:35:08 +0100 Subject: first draft of TECO command documentation generator * the language reference is a manually written man-page template * containing special references for generated documentation (\#$...) * SciTECO script generate-docs.tes extracts TECO comments (/*$ ... */) from all source files and transforms them to Troff requests that are inserted into the document template. * TECO doc comments are a rather sophisticated markup: * first part until empty line is called header: simplified command syntax descriptions * the rest is called body: is automatically underlined, empty lines generate new paragraphs, lines beginning with "-" or numbers denote an indented unordered or numbered list item. * regular Troff requests/macros can be used for more sophisticated markup * since Autoconf substitutions are performed on the generated man-page, @VARIABLEs@ may be used in doc comments as well --- doc/generate-docs.tes | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100755 doc/generate-docs.tes (limited to 'doc/generate-docs.tes') diff --git a/doc/generate-docs.tes b/doc/generate-docs.tes new file mode 100755 index 0000000..93b0e9d --- /dev/null +++ b/doc/generate-docs.tes @@ -0,0 +1,125 @@ +#!/usr/bin/sciteco -m + +@{format_header}{ + fd--S .U.f :L"S.|Z'U.t Q.f,Q.tXa Q.f,Q.tD I + + ebQ#tm I\# GENERATED FROM Q.#sc ( Q.#sc\ I): +.SS Qa -a-10"N I + ' eq.{header} +j +j qa"Sq.tj|.,q.txa.,q.td i +.B Qa +'> +j +j\(->;> +j .,q.txa .,q.td eqa eq.{header}i +.IR Qa +> +jjj +j 0a-10"=d' +zj-a-10"=-d' + ebQ#tm g.{header}i +. + +} + +@{format_body}{ + i.LP + + jj + ! set margin for list paragraphs ! + j 0U.n< + Z-.-3"<1;' + .,.+3:S.LP"S Q.n">0L I.RE + 0U.n' | .,.+3:S.IP"S Q.n"=0L I.RS + %.n' ' ' + :L; + > Q.n"> ZJ I +.RE ' + j;-di +-s<-di +.I > + jj + ebQ#tm g.ci +. +. + +} + +! process command-line options ! +LR 0X#ou 2LR 0X#tm EBQ#tm EB L +[.f + <:L;R 0X.f EBQ.f EB L> +].f +-EF + +I\# +\# AUTOGENERATED FROM Q#tm +\# DO NOT EDIT MANUALLY!!! +\# + + +! find insertion point ! +FS +\#$COMMANDS + + + +< +< + ! extract comment ! + 2EB EQ* HX.#sc 2EB + s/*$; .-3u.#sc s*/ q.#sc+3,.-2x.ceq.c + ! q.#sc= ! + + j + j<0a-13"=df>'0a-10"=df>'0a- "=df>'0a- "=df>';> + zj<-a-13"=-df>'-a-10"=-df>'-a- "=-df>'-a- "=-df>';> + + ! extract header ! + h:fd + +"Fzj'0,.x.{header}0,.d + + eq.{header} + :M{format_header} + eq.c + :M{format_body} +> +EF +Q*-1"=1;' +> + +EWQ#ou +EX -- cgit v1.2.3