Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions assets/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
24 changes: 17 additions & 7 deletions customization/customize_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,21 @@ 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,
doxygen_title_area,
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)

Expand All @@ -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")


Expand All @@ -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)

Expand Down Expand Up @@ -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__":
Expand Down
5 changes: 3 additions & 2 deletions customization/customize_docs_in_folder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down