Skip to content

Commit

Permalink
i#4111 web: Update directory page hashed names
Browse files Browse the repository at this point in the history
Updates the menu entries for directory pages, replacing the hashed
names from the treeview generation with the hashed names for the
embedded generation.

Issue: #4111
  • Loading branch information
derekbruening committed Mar 22, 2021
1 parent 69434f0 commit 8ca399c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions api/docs/CMake_rundoxygen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,29 @@ if (embeddable)
string(REGEX REPLACE "var [^\n]* =\n" "" string "${string}")
# End in a comma for inlining.
string(REGEX REPLACE "\\];" "]," string "${string}")
# Update directory index names which are hashes that differ between the
# treeview and embed generations.
string(REGEX MATCHALL "\"[a-zA-Z_0-9]+\", \"dir_[a-f0-9]+\\.html\""
dir_hashes "${string}")
foreach (dir_hash ${dir_hashes})
string(REGEX REPLACE "\"([a-zA-Z_0-9]+)\".*" "\\1" key "${dir_hash}")
# We go search the dir_*.html embed files looking for key.
file(GLOB dir_html ${CMAKE_CURRENT_BINARY_DIR}/html/dir_*.html)
set(found_hash OFF)
foreach (html ${dir_html})
file(READ ${html} html_string)
if (html_string MATCHES "${key} Directory Reference")
get_filename_component(fname ${html} NAME)
string(REGEX REPLACE "\"${key}\", \"dir_[a-f0-9]+\\.html\""
"\"${key}\", \"${fname}\"" string "${string}")
set(found_hash ON)
break ()
endif ()
endforeach ()
if (NOT found_hash)
message(FATAL_ERROR "Cannot find corresonding page for ${key}")
endif ()
endforeach ()
endif ()
if (js MATCHES "page_user_docs.js")
# CMake 3.6+ guarantees the glob is sorted lexicographically, so we've already
Expand Down

0 comments on commit 8ca399c

Please sign in to comment.