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.
```
objtype = 'interface'#
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, procedures, and interfaces 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'#