VACUMM / sphinx-fortran

Fortran domain and autodoc extensions to Sphinx
Other
45 stars 29 forks source link

DOC comments from `recursive subroutine`s are not read #7

Open ostueker opened 7 years ago

ostueker commented 7 years ago

I was just playing around with sphinx-python (version 1.0.1) and noticed that the header and inline comments are not extracted when the recursive keyword precedes a subroutine.

Example:

With this Fortran Code:

recursive SUBROUTINE add_tree_node(current, value)
! Add new tree_node into the tree.

    TYPE (tree_node), pointer :: current ! pointer to current tree
    REAL :: value                        ! value of new tree node

    IF (.NOT.associated(current)) THEN
        allocate(current)
        current%value = value
    ELSEIF (value < current%value) THEN
        CALL add_tree_node(current%left, value)
    ELSE
        CALL add_tree_node(current%right, value)
    END IF
END SUBROUTINE add_tree_node

and sphinx-fortran directive: .. f:autosrcfile:: tree_sort_module.f90

I get this after generating with make text:

subroutine  tree_sort_module/add_tree_node(current, value)

   Parameters:
      * **current*** [**tree_node**,**pointer**]*

      * **value*** [**real**]*

   Called from:
      "tree_sort"

Once I remove the recursive keyword, the comments get properly included in the docs:

subroutine  tree_sort_module/add_tree_node(current, value)

   Add new tree_node into the tree.

   Parameters:
      * **current*** [**tree_node**,**pointer**]* :: pointer to
        current tree

      * **value*** [**real**]* :: value of new tree node

   Called from:
      "add_tree_node()", "tree_sort"

   Call to:
      "add_tree_node()"