Generating the fortran doc¶
This module was written to generated documentation from docstrings for Fortran 2003 codes.
Docstring format¶
For types, functions, and subroutiness
!! For short docstring
!- For long docstring
Also for input and output parameters, we add a comment at the end of the variable declaration, so that they are added to the long docstring.:
function Phi_eff_ (this, vr) result (Phi_eff)
!! Calculate the effective potential (units: G M_star/R_pole) at vr
!- (units: R_pole)
!-
class(star_t), intent(in) :: this !- :param this: a :class:`star_t` object
real(WP), intent(in) :: vr(:) !- :param vr: a position
real(WP) :: Phi_eff !- :return Phi_eff: the potential as position vr
Will render as:
-
Phi_eff_
(this, vr) result (Phi_eff)¶ Calculate the effective potential (units: G M_star/R_pole) at vr (units: R_pole)
- Parameters
this – a
star_t
objectvr – a position
- Return Phi_eff
the potential as position vr
Note
Note the use of :class:`star_t`
to create a link to the star_t class.
API-style information¶
-
class
autoFortran.
doc_func
(line, module)¶ Object containing a function documentation
-
add_long
(line)¶ Adding a line to the long function documentation array
-
add_short
(line)¶ Adding a line to the short function documentation array
-
write
(f, name='function')¶ Write the information of the module function in the open file
The name is to know whether the def line contains ‘function’ or ‘subroutine’
-
-
class
autoFortran.
doc_type
(line, module)¶ Object containing a module type documentation
-
add_header
(line)¶ Adding a line to the header documentation array
-
add_long
(line)¶ Adding a line to the long function documentation array
-
add_short
(line)¶ Adding a line to the short function documentation array
-
write
(f)¶ Write the information of the module function in the open file
-
-
class
autoFortran.
fortran_module
(filename, module)¶ Structure object of a fortran 2003 module
This class stores the information about a fortran module.
- Important information about the style of the docstrings
Do not put a comment on the same line as a function/subroutine definition
The short description is flagged with !!
The long description is flagged with !-
-
info
()¶ Display the information the module
-
write
(f)¶ print the information the module to a rst file