diff --git a/ford/sourceform.py b/ford/sourceform.py index 0f08068a..c4526cfe 100644 --- a/ford/sourceform.py +++ b/ford/sourceform.py @@ -605,7 +605,7 @@ def find_child( def _should_display(self, item) -> bool: """Return True if item should be displayed""" - if self.settings.hide_undoc and not item.doc: + if self.settings.hide_undoc and not item.doc_list: return False return item.permission in self.display diff --git a/test/test_project.py b/test/test_project.py index 469df53d..711f803f 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -1362,3 +1362,23 @@ def test_links_in_deferred_bound_methods(copy_fortran_file): links = {link.text: link["href"] for link in docstring.find_all("a")} assert links["foo_t"].endswith("foo_t.html") assert links["foo"].endswith("foo_t.html#boundprocedure-foo") + + +def test_hide_undoc(copy_fortran_file): + data = """\ + module foo + contains + !> A subroutine with a docstring + subroutine with_doc + end subroutine with_doc + + subroutine no_doc + end subroutine no_doc + end module + """ + + settings = copy_fortran_file(data) + settings.hide_undoc = True + project = create_project(settings) + + assert len(project.modules[0].subroutines) == 1