Re: Confusion over modes, etc

Subject: Re: Confusion over modes, etc
From: Brandon Ibach <bibach@xxxxxxxxxxxxxx>
Date: Tue, 9 Nov 1999 23:23:51 -0600
Quoting Arien Malec <amalec@xxxxxxxx>:
> I've got a DTD for writing program specifications and documentation.
> Documents are structured like this (simplified):
> 
> MODULE = NAME, SHORT-DOC, LONG-DOC, FUNCTIONS
> FUNCTIONS = FUNCTION*
> FUNCTION = NAME, SHORT-DOC, LONG-DOC, PARAMS
> PARAMS = PARAM*
> PARAM = NAME, TYPE, SHORT-DOC
> 
> I'd like the function documentation part of the final paper document to
> look something like this:
> 
> Function [FUNCTION NAME]
> Overview
> [FUNCTION SHORT-DOC]
> Declaration
> function [FUNCTION NAME] ([PARAM NAME] [PARAM TYPE], ...);
> Documentation
> [FUNCTION LONG-DOC]
> Parameters
> Parameter [PARAM NAME] [PARAM SHORT-DOC]
> 
   This looks simple enough.  Just have the rule for the function
element build the whole structure, processing the params once with a
mode to generate the declaration list, and once without to generate
the "Parameters" section (or something like that).
   Perhaps something like:
(element FUNCTION
  (let ((fname (select-elements (children (current-node)) "NAME"))
        (fsdoc (select-elements (children (current-node)) "SDOC"))
        (fldoc (select-elements (children (current-node)) "LDOC"))
        (fprms (select-elements (children (current-node)) "PARAMS")))
    (sosofo-append
      (process-node-list fname) (process-node-list fsdoc)
      (literal "Declaration\U-000Afunction ")
      (process-node-list (children fname))
      (with-mode decl (process-node-list fprms))
      (process-node-list fldoc) (process-node-list fprms))))

   Here, the rules for the name, sdoc, ldoc and params elements will
need to generate the appropriate text ("Function", "Overview", etc.)
for their sections, whereas the rule for the params element in the
decl mode will produce the parameter listing in the Declaration
section.
   Hope this clears things up...

-Brandon :)


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread