diff options
author | umarcor <unai.martinezcorral@ehu.eus> | 2022-02-07 17:52:26 +0100 |
---|---|---|
committer | umarcor <unai.martinezcorral@ehu.eus> | 2022-02-07 18:41:31 +0100 |
commit | d275c83869d154f2f6529f1e64391f90de9ee64b (patch) | |
tree | 89a36b39abd471fdd77823345663949993907293 | |
parent | 6f972aaf43085c362239e3980a26868df18c2fd8 (diff) | |
download | ghdl-d275c83869d154f2f6529f1e64391f90de9ee64b.tar.gz ghdl-d275c83869d154f2f6529f1e64391f90de9ee64b.tar.bz2 ghdl-d275c83869d154f2f6529f1e64391f90de9ee64b.zip |
doc: use theme_overrides and class 'shield' to fix the width of SHIELDs
-rw-r--r-- | doc/_static/theme_overrides.css | 59 | ||||
-rw-r--r-- | doc/_static/theme_overrides.old.css | 58 | ||||
-rw-r--r-- | doc/conf.py | 3 | ||||
-rw-r--r-- | doc/helpers.py | 18 |
4 files changed, 75 insertions, 63 deletions
diff --git a/doc/_static/theme_overrides.css b/doc/_static/theme_overrides.css index 4a5cae28e..c87b7353d 100644 --- a/doc/_static/theme_overrides.css +++ b/doc/_static/theme_overrides.css @@ -1,58 +1,3 @@ -/* Change font sizes*/ -html,body{font-size:98%;} -p{font-size:95%;margin-bottom:12px} -.wy-breadcrumbs li.wy-breadcrumbs-aside{font-size:95%} -.rst-versions{font-size:50%} -.rst-versions .rst-current-version {font-size: 165%} -.rst-versions dd{font-size:175%} -footer {font-size: 75%;} -.rst-footer-buttons {font-size: 140%;} - -/*Shrink left nav to 260px*/ -.wy-nav-side,.rst-versions,.wy-side-nav-search,.wy-menu-vertical{width: 260px} -.wy-nav-content-wrap{margin-left:260px;background:#fcfcfc;min-height:100%} -@media screen and (max-width: 768px){ - .wy-nav-top i {padding-top:7px} - .wy-nav-content-wrap{margin-left:0px} - .wy-nav-content-wrap.shift{margin-left:260px;position: static;} - .wy-nav-side.shift{width:260px;padding-bottom: 40px;} - .rst-versions{width:260px} - .wy-side-scroll{width:280px;} +.rst-content img.shield { + max-width: unset; } - -/*Fix shields in small screens*/ -@media screen and (max-width: 768px){img{width: auto}} -/*Fix shield sizes in WhoUsesGHDL*/ -.whouses>.wy-table-responsive img {width:auto;height:20px !important;;display:inline} -.whouses>.wy-table-responsive td {text-align:center} -.whouses>.wy-table-responsive>table>thead th{min-width:130px !important} -.whouses>.wy-table-responsive td:last-child{text-align: left} - -/*Remove 1 indentation space in the sidemenu items*/ -.wy-menu-vertical li.current a, .wy-menu-vertical li.toctree-l2.current > a{padding:0.4045em 1.618em} -.wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a{padding: 0.4045em 1.8em} -.wy-menu-vertical li.toctree-l3.current li.toctree-l4 > a{padding: 0.4045em 2.618em} - -/*Remove empty add*/ -div.wy-menu.rst-pro{display: none !important;max-width: 260px} - -/*Simplify 'versions' tab*/ -.rst-versions dt{display:none} -.rst-versions dd a[href$='.rst'] {display: none} -.rst-versions dd a[href$='/downloads/'] {display: none} -.rst-versions .wy-form{display:none !important;} -.rst-versions .rst-other-versions dd a{padding: 3px} -.rst-versions .rst-other-versions strong dd a{color: #27AE60} -.rst-versions .rst-other-versions hr{margin: 5px 0; margin-top: -14px} - -.rst-versions {border-top: none} - -/*Last doc build date*/ -.lastdocbuilddate {position:fixed;padding-top:30px;font-size:70%;color:#999} - -/*Reduce space between footnotes*/ -.footnotes > .wy-table-responsive {margin-top:-12px;margin-bottom:12px} - -/*Reduce margin below lists*/ -.rst-content .section ul, .rst-content .toctree-wrapper ul, article ul {margin-bottom: 12px} -.rst-content blockquote {margin-bottom: 12px;} diff --git a/doc/_static/theme_overrides.old.css b/doc/_static/theme_overrides.old.css new file mode 100644 index 000000000..4a5cae28e --- /dev/null +++ b/doc/_static/theme_overrides.old.css @@ -0,0 +1,58 @@ +/* Change font sizes*/ +html,body{font-size:98%;} +p{font-size:95%;margin-bottom:12px} +.wy-breadcrumbs li.wy-breadcrumbs-aside{font-size:95%} +.rst-versions{font-size:50%} +.rst-versions .rst-current-version {font-size: 165%} +.rst-versions dd{font-size:175%} +footer {font-size: 75%;} +.rst-footer-buttons {font-size: 140%;} + +/*Shrink left nav to 260px*/ +.wy-nav-side,.rst-versions,.wy-side-nav-search,.wy-menu-vertical{width: 260px} +.wy-nav-content-wrap{margin-left:260px;background:#fcfcfc;min-height:100%} +@media screen and (max-width: 768px){ + .wy-nav-top i {padding-top:7px} + .wy-nav-content-wrap{margin-left:0px} + .wy-nav-content-wrap.shift{margin-left:260px;position: static;} + .wy-nav-side.shift{width:260px;padding-bottom: 40px;} + .rst-versions{width:260px} + .wy-side-scroll{width:280px;} +} + +/*Fix shields in small screens*/ +@media screen and (max-width: 768px){img{width: auto}} +/*Fix shield sizes in WhoUsesGHDL*/ +.whouses>.wy-table-responsive img {width:auto;height:20px !important;;display:inline} +.whouses>.wy-table-responsive td {text-align:center} +.whouses>.wy-table-responsive>table>thead th{min-width:130px !important} +.whouses>.wy-table-responsive td:last-child{text-align: left} + +/*Remove 1 indentation space in the sidemenu items*/ +.wy-menu-vertical li.current a, .wy-menu-vertical li.toctree-l2.current > a{padding:0.4045em 1.618em} +.wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a{padding: 0.4045em 1.8em} +.wy-menu-vertical li.toctree-l3.current li.toctree-l4 > a{padding: 0.4045em 2.618em} + +/*Remove empty add*/ +div.wy-menu.rst-pro{display: none !important;max-width: 260px} + +/*Simplify 'versions' tab*/ +.rst-versions dt{display:none} +.rst-versions dd a[href$='.rst'] {display: none} +.rst-versions dd a[href$='/downloads/'] {display: none} +.rst-versions .wy-form{display:none !important;} +.rst-versions .rst-other-versions dd a{padding: 3px} +.rst-versions .rst-other-versions strong dd a{color: #27AE60} +.rst-versions .rst-other-versions hr{margin: 5px 0; margin-top: -14px} + +.rst-versions {border-top: none} + +/*Last doc build date*/ +.lastdocbuilddate {position:fixed;padding-top:30px;font-size:70%;color:#999} + +/*Reduce space between footnotes*/ +.footnotes > .wy-table-responsive {margin-top:-12px;margin-bottom:12px} + +/*Reduce margin below lists*/ +.rst-content .section ul, .rst-content .toctree-wrapper ul, article ul {margin-bottom: 12px} +.rst-content blockquote {margin-bottom: 12px;} diff --git a/doc/conf.py b/doc/conf.py index b01d17329..fc1888b6a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -86,6 +86,9 @@ html_theme_options = { 'home_breadcrumbs': False, 'vcs_pageview_mode': 'blob', } +html_css_files = [ + "theme_overrides.css", +] html_static_path = ['_static'] # '/public' will contain the output from gnatdoc diff --git a/doc/helpers.py b/doc/helpers.py index 9baddf700..5d099e729 100644 --- a/doc/helpers.py +++ b/doc/helpers.py @@ -26,13 +26,19 @@ def printShieldSrc(label, alt, img, target, latex=False): if latex: if label[-6:] == '/total': label = label[:-6] - print('.. |l' + re.compile('[\W_]+').sub('', label) + '| replace:: `' + label + '`_') - print('.. _' + label + ': ' + target + '\n') + idx = re.compile('[\W_]+').sub('', label) + print(f""" +.. |l{idx}| replace:: `{label}`_ +.. _{label}: {target} +""") else: - print('.. |' + label + '| image:: '+ img + '\n', - ' :target: ' + target + '\n', - ' :height: 22\n', - ' :alt: ' + alt + '\n') + print(f''' +.. |{label}| image:: {img} + :target: {target} + :height: 22 + :alt: {alt} + :class: shield +''') # # Create shields/badges from JSON file |