Skip to content

Commit 8abf979

Browse files
committed
Fix doxygen parser converting Ford admonitions
Fixes #717
1 parent 6d9f1e7 commit 8abf979

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

ford/sourceform.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ def translate_doxy_meta(doc_list: list[str]) -> list[str]:
170170
for line, comment in enumerate(doc_list):
171171
if match := DOXY_META_RE.match(comment):
172172
meta_type = match["key"]
173+
# Don't convert our admonitions
174+
if meta_type in {"note", "warning", "todo", "bug", "history"}:
175+
continue
173176
meta_content = match["value"].strip()
174177
meta_type = DOXYGEN_TRANSLATION.get(meta_type, meta_type)
175178
if meta_type != "param":

test/test_sourceform.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,3 +2399,22 @@ def test_doxygen_see_link(parse_fortran_file):
23992399
fortran_file = parse_fortran_file(data)
24002400
assert fortran_file.modules[1].doc_list[0].strip() == "[[a]] with a description"
24012401
assert fortran_file.modules[0].doc_list[0].strip() == "[[b]]"
2402+
2403+
2404+
def test_doxygen_eating_admonitions_bug717(parse_fortran_file):
2405+
"""Ensure the doxygen parser doesn't convert our admonitions"""
2406+
2407+
data = """\
2408+
!> @note this should remain
2409+
module test
2410+
end module test
2411+
"""
2412+
2413+
fortran_file = parse_fortran_file(data)
2414+
md = MetaMarkdown()
2415+
2416+
module = fortran_file.modules[0]
2417+
module.markdown(md)
2418+
2419+
# This is tied to the format of the admonitions class
2420+
assert 'div class="alert alert-info"' in module.doc

0 commit comments

Comments
 (0)