Source Code Documentation
The documentation of source code is an important part of modern software development. Several tools for automatic source code documentation are available for Fortran projects:
- Doxygen (GNU GPLv2)
- A popular documentation generator that supports several programming languages, among them Fortran. Doxygen allows pretty printing, call graph generation, man page generation, as well as output to LaTeX and HTML.
- f90doc (MIT)
- A simple documentation tool for Fortran 90 that outputs HTML pages.
- f90tohtml (MIT)
- A Perl script that converts Fortran 90 source code to HTML and creates a clickable calling tree.
- FORD (GNU GPLv3)
- An automatic documentation generator for modern Fortran (> 90), written in Python. Offers LaTeX support, online search, syntax highlighting, and custom style sheets. Uses Markdown for formatting.
- FortranDOC (GNU GPLv3)
- A Fortran 95 program for source code documentation, with LaTeX output. It also features a graphical user interface.
- ROBOdoc (GNU GPLv3)
- ROBOdoc is a documentation tool for various programming languages,
including Fortran. For each block (
function
,subroutine
, derivedtype
, …) a specially formatted header must be written. The output format can be set to HTML, LaTeX, ASCII, XML DocBook, or RTF. - SphinxFortran (CeCILL)
- Fortan 90 extension for the Python documentation generator Sphinx.
Depends on the Python packages
sphinx
andnumpy
.
FORD
The documentation generator
FORD
is based on Python 3. The tool can be installed into a virtual environment using
venv
and pip
:
$ python3 -m venv virtual-environment/
$ source virtual-environment/bin/activate
$ python3 -m pip install ford
Or, instead, just install FORD into the Python user install directory, without creating a virtual environment first:
$ python3 -m pip install --user ford
FORD requires a project description in Markdown format. Save the file
project.md
in your workspace directory, containing:
project: Super Cool Fortran Project
summary: A brief description of my project.
author: Jane Doe
author_description: I program things in Fortran.
date: October 2, 2018
project_website: https://supercoolfortranproject.org/
project_github: https://github.com/example/fortranproject
This documentation has been generated with [FORD](https://github.com/Fortran-FOSS-Programmers/ford).
You can add a description in Markdown here.
Now is the time for all good men to come to the aid of the party.
Please see the project’s wiki for further details. Run the FORD compiler inside your project directory:
$ ford project.md -d ./src
The project file named project.md
and the source code path
./src
are given as arguments. By default, the documentation will be
saved to directory ./doc
. Open the HTML file
./doc/index.html
in your browser.
References
- Fortran Wiki: Automatic documentation
< Build Automation | [Index] | Online Resources > |