This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Including code


There is, of course, the opposite approach; maintain the code in the 
document, dumping it to external files as needed (for example to compile it).

Not knowing exactly what you're doing, it's not clear if this approach is 
viable for you.  But I do something like it all the time, as the combined 
documentation and code is much easier to maintain that separate files for each.

If you're interested in the approach, a web search on "literate 
programming" will turn up many references, and extending DocBook to enable 
it is reasonably straightforward (my efforts in this direction can be found 
at 
http://www.west-point.org/users/usma1978/36200/LitProg/LiterateProgramming.html).

At 05:31 PM 7/3/01 -0700, Vladimir Ivanovic wrote:
>I'm writing a manual that includes many code fragments. The manual has
>several chapters that are separate files (see "DocBook:...", p. 30). I
>would prefer not to insert the actual code into my DocBook chapters, but
>rather just a reference to a file that contains the code. Then I can
>include code I know compiles and passes a sanity check.
>
>Currently, the only way I know how to accomplish this is to define some
>ENTITYs in the master file which refer to the included code. But ---
>here's the ugly part --- the definition is in one file, and the use is
>in another. For me it's not too bad because I have only a handful of
>files, but I can imagine that in the general case it might be a
>nightmare.
>
>Is there any way of including a file without having to change the master
>file?
>
>Thanks.
>
>-- Vladimir

Mark B. Wroth
<mark@astrid.upland.ca.us>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]