Directives#

class FortranFunction(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]#

Bases: FortranObject

Manual declaration for a Fortran function.

In reStructuredText:

.. f:function:: det(a)

   Computes the determinant of ``a``.

In MyST Markdown:

```{f:function} det(a)
Computes the determinant of `a`.
```
objtype = 'function'#
class FortranInterface(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]#

Bases: FortranObject

Manual declaration for a Fortran interface or generic interface.

In reStructuredText:

.. f:interface:: solve

   Generic interface for linear solvers.

In MyST Markdown:

```{f:interface} solve
Generic interface for linear solvers.
```

The specific procedures lumped together by the interface are listed under a “Procedures” field and linked to their documentation (parsed or declared with f:function/f:subroutine). By default they are taken from the interface of the same name in fortran_sources (the first module, then submodule, defining it).

Options:

  • :module: module or submodule in which to look up the parsed interface, when several of them define an interface with that name.

  • :procedures: comma-separated specific procedures, overriding the parsed list (e.g. to list only some of them, or to document an interface that is not parsed). Names unknown to the parsed interface are reported as warnings.

.. f:interface:: solve
   :module: linear_solvers
   :procedures: solve_real, solve_complex

   Generic interface for linear solvers.
objtype = 'interface'#
option_spec = {'module': <function unchanged_required>, 'no-contents-entry': <function flag>, 'no-index': <function flag>, 'no-index-entry': <function flag>, 'no-typesetting': <function flag>, 'nocontentsentry': <function flag>, 'noindex': <function flag>, 'noindexentry': <function flag>, 'procedures': <function unchanged>}#

Mapping of option names to validator functions.

transform_content(content_node: desc_content) → None[source]#

Can be used to manipulate the content.

Called after creating the content through nested parsing, but before the object-description-transform event is emitted, and before the info-fields are transformed.

class FortranModule(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]#

Bases: Directive

Render a parsed Fortran module and its public members.

This directive resolves a module from parsed sources and renders module docs, variables, derived types, interfaces, and procedures in one section.

Options:

  • :show-private: include private module members and private type internals (components/type-bound procedures). By default, private elements are hidden.

In reStructuredText:

.. f:module:: linalg
   :show-private:

In MyST Markdown:

```{f:module} linalg
:show-private:
```
option_spec = {'show-private': <function flag>}#

Mapping of option names to validator functions.

required_arguments = 1#

Number of required directive arguments.

run()[source]#
class FortranObject(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]#

Bases: ObjectDescription[str]

Base class for manual Fortran object directives.

Use these directives when you want to declare API objects directly in docs, instead of relying on parsed fortran_sources.

In reStructuredText:

.. f:function:: solve_linear_system(a, b)

   Solves ``Ax = b``.

In MyST Markdown (requires MyST directive fences):

```{f:function} solve_linear_system(a, b)
Solves `Ax = b`.
```
add_target_and_index(name: str, sig: str, signode: desc_signature) → None[source]#

Add cross-reference IDs and entries to self.indexnode, if applicable.

name is whatever handle_signature() returned.

handle_signature(sig: str, signode: desc_signature) → str[source]#

Parse the signature sig.

The individual nodes are then appended to signode. If ValueError is raised, parsing is aborted and the whole sig is put into a single desc_name node.

The return value should be a value that identifies the object. It is passed to add_target_and_index() unchanged, and otherwise only used to skip duplicates.

has_content = True#

May the directive have content?

required_arguments = 1#

Number of required directive arguments.

class FortranProgram(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]#

Bases: Directive

Render a parsed Fortran program.

This directive looks up a program from the domain parsed result (typically populated from fortran_sources) and renders:

  • program title and docstring block,

  • optional source code,

  • use dependencies,

  • optional internal procedures.

Options:

  • :no-show-code: hide the program source block.

  • :procedures: force rendering internal procedures.

  • :no-procedures: hide internal procedures.

In reStructuredText:

.. f:program:: simulation_main
   :no-show-code:

In MyST Markdown:

```{f:program} simulation_main
:no-show-code:
```
option_spec = {'no-procedures': <function flag>, 'no-show-code': <function flag>, 'procedures': <function flag>}#

Mapping of option names to validator functions.

required_arguments = 1#

Number of required directive arguments.

run()[source]#
class FortranSubmodule(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]#

Bases: Directive

Render a parsed Fortran submodule and its members.

Use this for projects that split implementation into submodules and want automatic API pages similar to f:module.

Options:

  • :show-private: include private submodule members and private type internals (components/type-bound procedures). By default, private elements are hidden.

In reStructuredText:

.. f:submodule:: linalg_impl
   :show-private:

In MyST Markdown:

```{f:submodule} linalg_impl
:show-private:
```
option_spec = {'show-private': <function flag>}#

Mapping of option names to validator functions.

required_arguments = 1#

Number of required directive arguments.

run()[source]#
class FortranSubroutine(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]#

Bases: FortranObject

Manual declaration for a Fortran subroutine.

In reStructuredText:

.. f:subroutine:: normalize(vec)

   Normalizes ``vec`` in place.

In MyST Markdown:

```{f:subroutine} normalize(vec)
Normalizes `vec` in place.
```
objtype = 'subroutine'#
class FortranType(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]#

Bases: FortranObject

Manual declaration for a Fortran derived type.

In reStructuredText:

.. f:type:: mesh_t

   Unstructured mesh container.

In MyST Markdown:

```{f:type} mesh_t
Unstructured mesh container.
```
objtype = 'type'#