-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #543 from analogdevicesinc/tfcollins/doctools
Tfcollins/doctools
- Loading branch information
Showing
5 changed files
with
57 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,7 @@ | ||
:root { | ||
/* Defaults */ | ||
--display-dark-stuff: none; | ||
--display-light-stuff: block; | ||
--sidebar-highligh-color-hover: black; | ||
--sidebar-highligh-color: white; | ||
--display-dark-stuff: none; | ||
--display-light-stuff: block; | ||
#indexlogo img, #badges img { | ||
background: none; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
:root { | ||
/* Change to dark if user prefers dark */ | ||
--display-dark-stuff: block; | ||
--display-light-stuff: none; | ||
--sidebar-highligh-color-hover: white; | ||
--sidebar-highligh-color: black; | ||
--display-dark-stuff: block; | ||
--display-light-stuff: none; | ||
} | ||
} | ||
|
||
|
||
[data-theme=light] { | ||
--sidebar-highligh-color-hover: black; | ||
--sidebar-highligh-color: white; | ||
--display-dark-stuff: none; | ||
--display-light-stuff: block; | ||
} | ||
|
||
[data-theme=dark] { | ||
--sidebar-highligh-color-hover: white; | ||
--sidebar-highligh-color: black; | ||
--display-dark-stuff: block; | ||
--display-light-stuff: none; | ||
} | ||
|
||
/* Pad sidebar entries so radius does not touch content or browser*/ | ||
body>div>aside>div>div>div.sidebar-scroll>div>ul { | ||
padding-right: 10px; | ||
padding-left: 10px; | ||
} | ||
|
||
/* Disable sidebar title */ | ||
.sidebar-brand-text { | ||
display: none; | ||
} | ||
|
||
/* Add better highlighting on selected sidebar entry */ | ||
.sidebar-tree .current>.reference { | ||
border-radius: 25px; | ||
color: var(--sidebar-highligh-color); | ||
padding-bottom: 1px; | ||
padding-top: 5px; | ||
} | ||
|
||
/* Add better highlighting on selected second level sidebar entry */ | ||
.toctree-l2 .current.reference.internal { | ||
border-radius: 25px; | ||
color: var(--sidebar-highligh-color); | ||
padding-bottom: 1px; | ||
padding-top: 1px; | ||
margin: 2px; | ||
} | ||
|
||
/* Add better highlighting on selected hovered sidebar entry */ | ||
.sidebar-tree .current>.reference:hover { | ||
color: var(--sidebar-highligh-color-hover); | ||
border: 1px solid var(--sidebar-highligh-color-hover); | ||
padding-bottom: 1px; | ||
padding-top: 4px; | ||
} | ||
|
||
/* Add better highlighting on selected second level hovered sidebar entry */ | ||
.toctree-l2 .current.reference.internal:hover { | ||
color: var(--sidebar-highligh-color-hover); | ||
border: 1px solid var(--sidebar-highligh-color-hover); | ||
padding-bottom: 1px; | ||
padding-top: 1px; | ||
margin: 2px; | ||
} | ||
|
||
|
||
/* Hide/display logo on index page based on theme */ | ||
#indexlogo_light { | ||
display: var(--display-dark-stuff); | ||
} | ||
|
||
#indexlogo_dark { | ||
display: var(--display-light-stuff); | ||
} | ||
|
||
element.style { | ||
display: none; | ||
} | ||
|
||
/* Animate page entries */ | ||
.article-container > article:nth-child(3) { | ||
animation-duration: 0.2s; | ||
animation-delay: 0s; | ||
animation-name: fadeInBottom; | ||
} | ||
|
||
@keyframes fadeInBottom { | ||
from { | ||
opacity: 0; | ||
transform: translateY(1%); | ||
} | ||
to { opacity: 1 } | ||
#badges img { | ||
display: inline-block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from os import chdir, listdir, mkdir, path | ||
|
||
from PIL import Image | ||
from sphinx.util.fileutil import copy_asset_file | ||
|
||
|
||
def builder_inited(app): | ||
chdir(app.builder.srcdir) | ||
|
||
outdir = app.builder.outdir | ||
for p in ["_static", "logos"]: | ||
outdir = path.join(outdir, p) | ||
if not path.exists(outdir): | ||
mkdir(outdir) | ||
|
||
def copy_asset(app, src, fname): | ||
src_uri = path.abspath(path.join(src, fname)) | ||
build_uri = path.join(outdir, fname) | ||
copy_asset_file(src_uri, build_uri) | ||
return build_uri | ||
|
||
# Move logos over to doc build directory | ||
for filename in listdir(path.join("..", "..", "images")): | ||
if filename.endswith(".png"): | ||
fn = copy_asset(app, path.join("..", "..", "images"), filename) | ||
|
||
im = Image.open(fn) | ||
# Remove left 30% of image | ||
im = im.crop((int(im.size[0] * 0.45), 0, int(im.size[0] * 1), im.size[1])) | ||
im.save(fn.replace(".png", "_cropped.png")) | ||
|
||
|
||
def setup(app): | ||
app.connect("builder-inited", builder_inited) | ||
|
||
return { | ||
"parallel_read_safe": True, | ||
"parallel_write_safe": True, | ||
"version": "0.1", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
sphinx>=2.0 | ||
myst-parser | ||
furo | ||
sphinx-favicon | ||
https://github.com/analogdevicesinc/doctools/releases/download/latest/adi-doctools.tar.gz | ||
sphinxcontrib-mermaid | ||
sphinx-simplepdf | ||
pillow |