From 6b34873c962d6fa3ccc0671c4675bf0a73e51d65 Mon Sep 17 00:00:00 2001 From: Victor Wheeler Date: Tue, 24 Jun 2025 00:34:21 -0600 Subject: [PATCH] chore(api_doc_builder): fix TOC ordering on API pages. (#8421) --- docs/api_doc_builder.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/api_doc_builder.py b/docs/api_doc_builder.py index ab516619d9..a2c3eb80f7 100644 --- a/docs/api_doc_builder.py +++ b/docs/api_doc_builder.py @@ -698,6 +698,12 @@ def _recursively_create_api_rst_files(depth: int, elig_h_file_count += subdir_eligible_h_file_count if elig_h_file_count > 0: + # Sort both lists. + # Evidently the Linux-Python's implementation of `listdir()` does not + # automatically produce a sorted list. + elig_sub_dirs.sort() + elig_h_files.sort() + # Create index.rst plus .RST files for any direct .H files in dir. _create_rst_files_for_dir(src_root_len, src_dir_bep,