3030from sphinx .config import Config
3131from sphinx .errors import ExtensionError
3232
33- from rocm_docs import formatting , util
33+ from rocm_docs import formatting , theme , util
3434
3535if sys .version_info < (3 , 11 ):
3636 import importlib .abc as importlib_abc
@@ -405,15 +405,24 @@ def _get_context(
405405
406406
407407def _update_theme_configs (
408- app : Sphinx , current_project : _Project | None , current_branch : str
408+ app : Sphinx ,
409+ current_project : _Project | None ,
410+ current_branch : str ,
411+ flavor : str ,
409412) -> None :
410413 """Update configurations for use in theme.py"""
411- latest_version = requests .get (
412- "https://raw.githubusercontent.com/ROCm/rocm-docs-core/data/latest_version.txt"
413- ).text .strip ("\r \n " )
414- latest_version_string = f"docs-{ latest_version } "
414+ latest_version_list = requests .get (
415+ "https://raw.githubusercontent.com/ROCm/rocm-docs-core/new_data/latest_version.txt"
416+ ).text .strip ()
417+ latest_version_dict = theme ._parse_version (latest_version_list )
418+ latest_version = latest_version_dict .get (flavor , "latest" )
419+ latest_version_string_list = ["latest" ]
420+ if latest_version != "latest" :
421+ # Some component's docs branch has "docs-" prefix, others do not
422+ latest_version_string_list += [f"docs-{ latest_version } " , latest_version ]
423+
415424 release_candidate = requests .get (
416- "https://raw.githubusercontent.com/ROCm/rocm-docs-core/data /release_candidate.txt"
425+ "https://raw.githubusercontent.com/ROCm/rocm-docs-core/new_data /release_candidate.txt"
417426 ).text .strip ("\r \n " )
418427 release_candidate_string = f"docs-{ release_candidate } "
419428
@@ -423,7 +432,7 @@ def _update_theme_configs(
423432
424433 doc_branch_pattern = r"^docs-\d+\.\d+\.\d+$"
425434
426- if current_branch in [ latest_version_string , "latest" ] :
435+ if current_branch in latest_version_string_list :
427436 app .config .projects_version_type = util .VersionType .LATEST_RELEASE
428437 elif current_branch .startswith (release_candidate_string ):
429438 app .config .projects_version_type = util .VersionType .RELEASE_CANDIDATE
@@ -509,11 +518,20 @@ def _update_config(app: Sphinx, _: Config) -> None:
509518 Path (app .srcdir , app .config .external_toc_path ),
510519 context ,
511520 )
521+
522+ if not config_provided_by_user (app , "html_theme_options" ):
523+ app .config .html_theme_options = {"flavor" : "rocm" }
524+
512525 # Store the context to be referenced later
513526 app .config .projects_context = context
514527
515528 _set_doxygen_html (app , current_project )
516- _update_theme_configs (app , current_project , branch )
529+ _update_theme_configs (
530+ app ,
531+ current_project ,
532+ branch ,
533+ app .config .html_theme_options .get ("flavor" , "rocm" ),
534+ )
517535
518536
519537def _setup_projects_context (
0 commit comments