From 1d7c689fd36b6952c0f6877ad9af562e3e10433a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 30 Apr 2018 16:21:54 +0200 Subject: [PATCH] doxygen: properly support CASE_SENSE_NAMES set to NO. I was working around the indexpage/index name mismatch by using for pages, but that doesn't work well when CASE_SENSE_NAMES is disabled. This fixes it. --- doxygen/dox2html5.py | 6 ++-- doxygen/test/compound_filename_case/Doxyfile | 15 +++++++++ .../_u_p_p_e_r_c_a_s_e.html | 32 +++++++++++++++++++ .../class_u_p_p_e_r_c_l_a_s_s.html | 31 ++++++++++++++++++ .../test/compound_filename_case/index.html | 31 ++++++++++++++++++ doxygen/test/compound_filename_case/input.h | 13 ++++++++ doxygen/test/test_compound.py | 13 ++++++++ 7 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 doxygen/test/compound_filename_case/Doxyfile create mode 100644 doxygen/test/compound_filename_case/_u_p_p_e_r_c_a_s_e.html create mode 100644 doxygen/test/compound_filename_case/class_u_p_p_e_r_c_l_a_s_s.html create mode 100644 doxygen/test/compound_filename_case/index.html create mode 100644 doxygen/test/compound_filename_case/input.h diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index 9d1d0bdf..6f3a53bd 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -1960,8 +1960,10 @@ def parse_xml(state: State, xml: str): # Compound name is page filename, so we have to use title there. The same # is for groups. compound.name = compounddef.find('title').text if compound.kind in ['page', 'group'] and compounddef.findtext('title') else compounddef.find('compoundname').text - # Compound URL is ID, except for index page - compound.url_base = (compounddef.find('compoundname').text if compound.kind == 'page' else compound.id) + # Compound URL is ID, except for index page, where it is named "indexpage" + # and so I have to override it back to "index". Can't use + # for pages because that doesn't reflect CASE_SENSE_NAMES. THANKS DOXYGEN. + compound.url_base = ('index' if compound.id == 'indexpage' else compound.id) compound.url = compound.url_base + '.html' # Save current compound URL for search data building and ID extraction state.current_compound = compound diff --git a/doxygen/test/compound_filename_case/Doxyfile b/doxygen/test/compound_filename_case/Doxyfile new file mode 100644 index 00000000..d14de34b --- /dev/null +++ b/doxygen/test/compound_filename_case/Doxyfile @@ -0,0 +1,15 @@ +INPUT = input.h +AUTOLINK_SUPPORT = NO +QUIET = YES +GENERATE_HTML = NO +GENERATE_LATEX = NO +GENERATE_XML = YES +XML_PROGRAMLISTING = NO + +M_PAGE_FINE_PRINT = +M_THEME_COLOR = +M_LINKS_NAVBAR1 = +M_LINKS_NAVBAR2 = +M_SEARCH_DISABLED = YES + +CASE_SENSE_NAMES = NO diff --git a/doxygen/test/compound_filename_case/_u_p_p_e_r_c_a_s_e.html b/doxygen/test/compound_filename_case/_u_p_p_e_r_c_a_s_e.html new file mode 100644 index 00000000..72126598 --- /dev/null +++ b/doxygen/test/compound_filename_case/_u_p_p_e_r_c_a_s_e.html @@ -0,0 +1,32 @@ + + + + + My Project » Uppercase page | My Project + + + + + +
+
+
+
+
+

+ My Project » + Uppercase page +

+

This should get saved to a correct place and also get correctly linked to.

+
+
+
+
+ + diff --git a/doxygen/test/compound_filename_case/class_u_p_p_e_r_c_l_a_s_s.html b/doxygen/test/compound_filename_case/class_u_p_p_e_r_c_l_a_s_s.html new file mode 100644 index 00000000..914ba5e8 --- /dev/null +++ b/doxygen/test/compound_filename_case/class_u_p_p_e_r_c_l_a_s_s.html @@ -0,0 +1,31 @@ + + + + + UPPERCLASS class | My Project + + + + + +
+
+
+
+
+

+ UPPERCLASS class +

+

An uppercase class.

+
+
+
+
+ + diff --git a/doxygen/test/compound_filename_case/index.html b/doxygen/test/compound_filename_case/index.html new file mode 100644 index 00000000..bace4630 --- /dev/null +++ b/doxygen/test/compound_filename_case/index.html @@ -0,0 +1,31 @@ + + + + + My Project + + + + + +
+
+ + diff --git a/doxygen/test/compound_filename_case/input.h b/doxygen/test/compound_filename_case/input.h new file mode 100644 index 00000000..72a338b7 --- /dev/null +++ b/doxygen/test/compound_filename_case/input.h @@ -0,0 +1,13 @@ +/** @mainpage + +- @subpage UPPERCASE +- @ref UPPERCLASS +*/ + +/** @page UPPERCASE Uppercase page + +This should get saved to a correct place and also get correctly linked to. +*/ + +/** @brief An uppercase class */ +class UPPERCLASS {}; diff --git a/doxygen/test/test_compound.py b/doxygen/test/test_compound.py index 42a43a32..8b2d2be0 100644 --- a/doxygen/test/test_compound.py +++ b/doxygen/test/test_compound.py @@ -206,3 +206,16 @@ class NamespaceMembersInFileScope(IntegrationTestCase): # The file should have just links to detailed docs self.assertEqual(*self.actual_expected_contents('File_8h.html')) + +class FilenameCase(IntegrationTestCase): + def __init__(self, *args, **kwargs): + super().__init__(__file__, 'filename_case', *args, **kwargs) + + def test(self): + self.run_dox2html5(wildcard='*.xml') + + # Verify that all filenames are "converted" to lowercase and the links + # work properly as well + self.assertEqual(*self.actual_expected_contents('index.html')) + self.assertEqual(*self.actual_expected_contents('_u_p_p_e_r_c_a_s_e.html')) + self.assertEqual(*self.actual_expected_contents('class_u_p_p_e_r_c_l_a_s_s.html')) -- 2.30.2