Previous: Documentation in Source Code, Up: Complete Examples


D.2 Documentation and Source Code Apart

     Example: myunit.pas  
      1  unit MyUnit;
      2
      3  interface
      4
      5  function Max(A, B: Integer) : Integer;
      6  function Min(A, B: Integer) : Integer;
      7  function Multiply(A, B: Integer) : Integer;
      8
      9  implementation
     10  end.

     Example: documentation.txt  
      1  Package: MyPkg
      2  ##############
      3
      4  Unit: MyUnit
      5  ============
      6
      7    ``MyUnit`` contains some essential routines.
      8
      9    This routines are the result of many years of **hard work**.
     10
     11    I hope they will help to save mankind.
     12
     13  Function: Max -- Return largest of two values.
     14  ----------------------------------------------
     15
     16    ``Max`` returns the maximum of ``A`` and ``B``.
     17
     18    Parameters:
     19      - A -- first value
     20      - B -- second value
     21
     22   See Also: <<Min>>
     23
     24  Function: Min -- Return smallest of two values.
     25  -----------------------------------------------
     26
     27    ``Min`` returns the minimum of ``A`` and ``B``.
     28
     29   Parameters:
     30      - A -- first value
     31      - B -- second value
     32
     33   See Also: <<Max>>
     34
     35  Function: Multiply -- Multiplies 2 integers.
     36  --------------------------------------------
     37
     38    Parameters:
     39      - A -- first integer
     40      - B -- second integer
     41
     42    Result:
     43
     44      The two integers multiplied together.
     45
     46  End Unit: MyUnit
     47  ================
     48
     49  End Package: MyPkg
     50  ##################

     Example: Building documentation  
     ~$ txt2fpdoc -o documentation.xml documentation.txt
     ~$ fpdoc --package=mypkg --descr=documentation.xml --dont-trim \
          --format=html --output=out --input=myunit.pas