From 3c25cd589c78c73fde4e8e7b9571eab3c5906c05 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 28 Jan 2018 22:30:18 +0100 Subject: [PATCH] doxygen: strip HTML tags from function param types in search. --- doxygen/dox2html5.py | 9 +++++++-- doxygen/test/search/Dir/File.h | 2 +- doxygen/test/test_search.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index 522bcab6..64ef448a 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -1563,14 +1563,19 @@ def build_search_data(state: State) -> bytearray: # TODO: examples? + strip_tags_re = re.compile('<.*?>') + def strip_tags(text): + return strip_tags_re.sub('', text) + for result in state.search: name_with_args = result.name name = result.name suffix_length = 0 if hasattr(result, 'params') and result.params is not None: - name_with_args += '(' + ', '.join(result.params) + ')' + params = strip_tags(', '.join(result.params)) + name_with_args += '(' + params + ')' name += '()' - suffix_length += len(', '.join(result.params)) + suffix_length += len(html.unescape(params)) if hasattr(result, 'suffix') and result.suffix: name_with_args += result.suffix # TODO: escape elsewhere so i don't have to unescape here diff --git a/doxygen/test/search/Dir/File.h b/doxygen/test/search/Dir/File.h index 967cc666..72819d5b 100644 --- a/doxygen/test/search/Dir/File.h +++ b/doxygen/test/search/Dir/File.h @@ -20,7 +20,7 @@ class Class { void foo() &&; /**< @overload */ /** @brief Function with arguments */ - void foo(with, arguments); + void foo(const Enum&, Typedef); }; /** @brief A variable */ diff --git a/doxygen/test/test_search.py b/doxygen/test/test_search.py index 9029b1a9..1e1251a4 100755 --- a/doxygen/test/test_search.py +++ b/doxygen/test/test_search.py @@ -339,7 +339,7 @@ macro [14] 6: Namespace::Class::foo() [0] -> classNamespace_1_1Class.html#aaeba4096356215868370d6ea476bf5d9 7: Namespace::Class::foo() const [1, suffix_length=6] -> classNamespace_1_1Class.html#ac03c5b93907dda16763eabd26b25500a 8: Namespace::Class::foo() && [1, suffix_length=3] -> classNamespace_1_1Class.html#ac9e7e80d06281e30cfcc13171d117ade -9: Namespace::Class::foo(with, arguments) [1, suffix_length=15] -> classNamespace_1_1Class.html#ac03e8437172963981197eb393e0550d3 +9: Namespace::Class::foo(const Enum&, Typedef) [1, suffix_length=20] -> classNamespace_1_1Class.html#abd560769b0863ca5d64905e8e0fc231b 10: Namespace::Enum::Value [0] -> namespaceNamespace.html#add172b93283b1ab7612c3ca6cc5dcfeaa689202409e48743b914713f96d93947c 11: Namespace::Enum [0] -> namespaceNamespace.html#add172b93283b1ab7612c3ca6cc5dcfea 12: Namespace::Typedef [0] -> namespaceNamespace.html#abe2a245304bc2234927ef33175646e08 -- 2.30.2