You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Libdoc shows an empty "Returns" section (and empty argument doc rows) for every keyword when the doc format is reST #5879
Since Robot Framework 7.5, every keyword in the HTML output of Libdoc has a "Returns" section if the library uses ROBOT_LIBRARY_DOC_FORMAT = "reST", even when the keyword has no return type and its docstring has no Returns section. The section has a heading and an empty "Doc" column.
Argument rows are affected in the same way: arguments without documentation get the has-doc class and an empty doc row.
With the ROBOT and HTML doc formats, this does not happen.
Cause
LibraryDoc.convert_docs_to_html() in robot/libdocpkg/model.py also converts empty docs:
The template uses {{#if (or (hasVisibleReturnType returnType) returnDoc)}} and {{#if doc}}. The non-empty HTML for an empty reST (or TEXT) doc is truthy, so the section and the doc rows are shown.
Reproduction
EmptyReturns.py:
ROBOT_LIBRARY_DOC_FORMAT="reST"defno_return_doc(value: str) ->None:
"""Keyword without a *Returns* section."""defwith_return_doc(value: str) ->str:
"""Keyword with a *Returns* section. *Returns:* The value. """returnvalue
$ libdoc --format JSON EmptyReturns.py out.json
No Return Doc returnDoc = '<div class="document">\n</div>\n' args[0].doc = '<div class="document">\n</div>\n'
With Return Doc returnDoc = '<div class="document">\n<p>The value.</p>\n</div>\n'
# with ROBOT_LIBRARY_DOC_FORMAT = "ROBOT"
No Return Doc returnDoc = ''
With Return Doc returnDoc = '<p>The value.</p>'
libdoc EmptyReturns.py EmptyReturns.html shows a "Returns" heading for No Return Doc.
Expected
An empty doc stays empty after the conversion to HTML, so Libdoc shows no "Returns" section and no argument doc rows for keywords without that documentation.
Possible fix
Do not format empty docs, either in convert_docs_to_html() or once in DocFormatter.html():
Activity