diff --git a/assets/css/custom.css b/assets/css/custom.css index 004d7564aa2..47d79e74905 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -365,7 +365,12 @@ legend { font-weight: 400; } -#rapids-sphinx-container { +#rapids-pydata-container .rapids-home-container__home-btn::before { + font-family: "Font Awesome 5 Free"; + font-weight: 900; +} + +#rapids-jtd-container { margin: 0 0 34px; } @@ -428,6 +433,10 @@ legend { transform: rotate(180deg); } +#rapids-pydata-container .rapids-selector__selected::after { + font-family: "Font Awesome 5 Free"; +} + .rapids-selector--hidden .rapids-selector__selected::after { transform: rotate(0); } @@ -436,7 +445,8 @@ legend { margin-left: 5px; } -#rapids-sphinx-container .rapids-selector__selected::after { +#rapids-jtd-container .rapids-selector__selected::after, +#rapids-pydata-container .rapids-selector__selected::after { position: absolute; right: 0; } @@ -482,8 +492,8 @@ a.rapids-selector__menu-item--selected { } .label-title { - margin: 0; - font-size: inherit !important; + margin: 0; + font-size: inherit !important; vertical-align: inherit !important; font-weight: bold; } diff --git a/customization/customize_doc.py b/customization/customize_doc.py index a002ee64b1d..feda43c956b 100755 --- a/customization/customize_doc.py +++ b/customization/customize_doc.py @@ -205,11 +205,13 @@ def delete_existing_elements(soup): doxygen_title_area = "#titlearea > table" sphinx_home_btn = ".wy-side-nav-search .icon.icon-home" sphinx_doc_version = ".wy-side-nav-search .version" - existing_sphinx_container = "#rapids-sphinx-container" + existing_jtd_container = "#rapids-jtd-container" + existing_pydata_container = "#rapids-pydata-container" existing_doxygen_container = "#rapids-doxygen-container" for element in [ - existing_sphinx_container, + existing_jtd_container, + existing_pydata_container, existing_doxygen_container, sphinx_doc_version, sphinx_home_btn, @@ -217,6 +219,7 @@ def delete_existing_elements(soup): f"#{SCRIPT_TAG_ID}", f"#{STYLE_TAG_ID}", f"#{FA_TAG_ID}", + "#rapids-sphinx-container" # old sphinx-selector. this can be removed once no more HTML files contain this element (i.e. after they're all re-processed) ]: delete_element(soup, element) @@ -227,15 +230,22 @@ def is_sphinx_or_doxygen(soup): by parsing the HTML. Returns a string identifier and reference element that is used for inserting the library/version selectors to the doc. """ - sphinx_identifier = ".wy-side-nav-search" + # Sphinx Themes + jtd_identifier = ".wy-side-nav-search" # Just-the-docs theme + pydata_identifier = ".bd-sidebar" # Pydata theme + + # Doxygen doxygen_identifier = "#titlearea" - if soup.select(sphinx_identifier): - return "sphinx", soup.select(sphinx_identifier)[0] + if soup.select(jtd_identifier): + return "jtd", soup.select(jtd_identifier)[0] if soup.select(doxygen_identifier): return "doxygen", soup.select(doxygen_identifier)[0] + if soup.select(pydata_identifier): + return "pydata", soup.select(pydata_identifier)[0] + raise Exception(f"Couldn't identify {FILEPATH} as either Doxygen or Sphinx") @@ -246,7 +256,7 @@ def main(): """ print(f"--- {FILEPATH} ---") with open(FILEPATH) as fp: - soup = BeautifulSoup(fp, "html.parser") + soup = BeautifulSoup(fp, "html5lib") doc_type, reference_el = is_sphinx_or_doxygen(soup) @@ -276,7 +286,7 @@ def main(): soup.head.append(style_tab) with open(FILEPATH, "w") as fp: - fp.write(str(soup)) + fp.write(soup.decode(formatter="html5")) if __name__ == "__main__": diff --git a/customization/customize_docs_in_folder.sh b/customization/customize_docs_in_folder.sh index 1766179a4ad..6d75c4359f0 100755 --- a/customization/customize_docs_in_folder.sh +++ b/customization/customize_docs_in_folder.sh @@ -31,13 +31,14 @@ if [ ! -d "${FOLDER_TO_CUSTOMIZE}" ]; then fi SCRIPT_SRC_FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # directory of where this script is located -SPHINX_SEARCH_TERM='class="wy-side-nav-search"' +JTD_SEARCH_TERM='class="wy-side-nav-search"' DOXYGEN_SEARCH_TERM='id="titlearea"' +PYDATA_SEARCH_TERM='class="col-12 col-md-3 bd-sidebar"' # IFS is changed due to cuxfilter docs having spaces in their filenames OIFS="$IFS" IFS=$'\n' -for FILE in $(grep "${SPHINX_SEARCH_TERM}\|${DOXYGEN_SEARCH_TERM}" -rl \ +for FILE in $(grep "${JTD_SEARCH_TERM}\|${DOXYGEN_SEARCH_TERM}\|${PYDATA_SEARCH_TERM}" -rl \ --include=\*.html \ --exclude-dir=stable \ --exclude-dir=nightly \