From 2bcd6df0fd80205a03aa4787ddf411e9632c4fed Mon Sep 17 00:00:00 2001 From: Jordan Cook Date: Fri, 17 Jun 2022 16:02:17 -0500 Subject: Use sphinx-design dropdown instead of custom CSS/JS --- docs/_static/collapsible_container.css | 26 --------- docs/_static/collapsible_container.js | 10 ---- docs/conf.py | 2 - docs/examples.md | 104 ++++++++++++++++++++++++--------- docs/index.md | 7 ++- docs/user_guide/advanced_requests.md | 14 +++-- docs/user_guide/backends.md | 7 ++- docs/user_guide/backends/dynamodb.md | 22 +++++-- docs/user_guide/backends/mongodb.md | 6 +- docs/user_guide/compatibility.md | 40 +++++++++---- docs/user_guide/filtering.md | 3 - docs/user_guide/inspection.md | 8 ++- docs/user_guide/serializers.md | 42 +++++++++---- 13 files changed, 183 insertions(+), 108 deletions(-) delete mode 100644 docs/_static/collapsible_container.css delete mode 100644 docs/_static/collapsible_container.js (limited to 'docs') diff --git a/docs/_static/collapsible_container.css b/docs/_static/collapsible_container.css deleted file mode 100644 index bcad629..0000000 --- a/docs/_static/collapsible_container.css +++ /dev/null @@ -1,26 +0,0 @@ -/* Taken from: https://github.com/plone/training/blob/master/_static/custom.css */ - -.toggle { - /* background: none repeat scroll 0 0 #e7f2fa; */ - padding: 12px; - line-height: 24px; - margin-bottom: 24px; -} - -.toggle .admonition-title { - display: block; - clear: both; - cursor: pointer; -} - -.toggle .admonition-title:after { - content: " ▶"; -} - -.toggle .admonition-title.open:after { - content: " ▼"; -} - -.toggle p:last-child { - margin-bottom: 0; -} diff --git a/docs/_static/collapsible_container.js b/docs/_static/collapsible_container.js deleted file mode 100644 index 75042d6..0000000 --- a/docs/_static/collapsible_container.js +++ /dev/null @@ -1,10 +0,0 @@ -// Taken from: https://github.com/plone/training/blob/master/_templates/page.html - -$(document).ready(function() { - $(".toggle > *").hide(); - $(".toggle .admonition-title").show(); - $(".toggle .admonition-title").click(function() { - $(this).parent().children().not(".admonition-title").toggle(400); - $(this).parent().children(".admonition-title").toggleClass("open"); - }) -}); diff --git a/docs/conf.py b/docs/conf.py index 5162e87..a5dfadb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -119,9 +119,7 @@ apidoc_toc_file = False # HTML general settings html_favicon = join('_static', 'favicon.ico') -html_js_files = ['collapsible_container.js'] html_css_files = [ - 'collapsible_container.css', 'table.css', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css', ] diff --git a/docs/examples.md b/docs/examples.md index e1c3c4d..fdf593c 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -28,8 +28,12 @@ The following scripts can also be found in the :end-line: 4 ``` -:::{admonition} Example: [basic_sessions.py](https://github.com/requests-cache/requests-cache/blob/main/examples/basic_sessions.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[basic_sessions.py](https://github.com/requests-cache/requests-cache/blob/main/examples/basic_sessions.py) ```{literalinclude} ../examples/basic_sessions.py :lines: 6- ``` @@ -41,8 +45,12 @@ The following scripts can also be found in the :end-line: 4 ``` -:::{admonition} Example: [basic_patching.py](https://github.com/requests-cache/requests-cache/blob/main/examples/basic_patching.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[basic_patching.py](https://github.com/requests-cache/requests-cache/blob/main/examples/basic_patching.py) ```{literalinclude} ../examples/basic_patching.py :lines: 6- ``` @@ -54,8 +62,12 @@ The following scripts can also be found in the :end-line: 3 ``` -:::{admonition} Example: [expiration.py](https://github.com/requests-cache/requests-cache/blob/main/examples/expiration.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[expiration.py](https://github.com/requests-cache/requests-cache/blob/main/examples/expiration.py) ```{literalinclude} ../examples/expiration.py :lines: 5- ``` @@ -67,8 +79,12 @@ The following scripts can also be found in the :end-line: 4 ``` -:::{admonition} Example: [url_patterns.py](https://github.com/requests-cache/requests-cache/blob/main/examples/url_patterns.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[url_patterns.py](https://github.com/requests-cache/requests-cache/blob/main/examples/url_patterns.py) ```{literalinclude} ../examples/url_patterns.py :lines: 6- ``` @@ -80,8 +96,12 @@ The following scripts can also be found in the :end-line: 25 ``` -:::{admonition} Example: [pygithub.py](https://github.com/requests-cache/requests-cache/blob/main/examples/pygithub.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[pygithub.py](https://github.com/requests-cache/requests-cache/blob/main/examples/pygithub.py) ```{literalinclude} ../examples/pygithub.py :lines: 27- ``` @@ -93,8 +113,12 @@ The following scripts can also be found in the :end-line: 4 ``` -:::{admonition} Example: [threads.py](https://github.com/requests-cache/requests-cache/blob/main/examples/threads.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[threads.py](https://github.com/requests-cache/requests-cache/blob/main/examples/threads.py) ```{literalinclude} ../examples/threads.py :lines: 6- ``` @@ -106,8 +130,12 @@ The following scripts can also be found in the :end-line: 3 ``` -:::{admonition} Example: [log_requests.py](https://github.com/requests-cache/requests-cache/blob/main/examples/log_requests.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[log_requests.py](https://github.com/requests-cache/requests-cache/blob/main/examples/log_requests.py) ```{literalinclude} ../examples/log_requests.py :lines: 5- ``` @@ -119,8 +147,12 @@ The following scripts can also be found in the :end-line: 8 ``` -:::{admonition} Example: [external_config.py](https://github.com/requests-cache/requests-cache/blob/main/examples/external_config.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[external_config.py](https://github.com/requests-cache/requests-cache/blob/main/examples/external_config.py) ```{literalinclude} ../examples/external_config.py :lines: 10- ``` @@ -132,8 +164,12 @@ The following scripts can also be found in the :end-line: 8 ``` -:::{admonition} Example: [benchmark.py](https://github.com/requests-cache/requests-cache/blob/main/examples/benchmark.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[benchmark.py](https://github.com/requests-cache/requests-cache/blob/main/examples/benchmark.py) ```{literalinclude} ../examples/benchmark.py :lines: 10- ``` @@ -145,8 +181,12 @@ The following scripts can also be found in the :end-line: 4 ``` -:::{admonition} Example: [convert_cache.py](https://github.com/requests-cache/requests-cache/blob/main/examples/convert_cache.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[convert_cache.py](https://github.com/requests-cache/requests-cache/blob/main/examples/convert_cache.py) ```{literalinclude} ../examples/convert_cache.py :lines: 6- ``` @@ -159,8 +199,12 @@ The following scripts can also be found in the :end-line: 15 ``` -:::{admonition} Example: [custom_request_matcher.py](https://github.com/requests-cache/requests-cache/blob/main/examples/custom_request_matcher.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[custom_request_matcher.py](https://github.com/requests-cache/requests-cache/blob/main/examples/custom_request_matcher.py) ```{literalinclude} ../examples/custom_request_matcher.py :lines: 17- ``` @@ -173,8 +217,12 @@ The following scripts can also be found in the :end-line: 4 ``` -:::{admonition} Example: [time_machine_backtesting.py](https://github.com/requests-cache/requests-cache/blob/main/examples/time_machine_backtesting.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[time_machine_backtesting.py](https://github.com/requests-cache/requests-cache/blob/main/examples/time_machine_backtesting.py) ```{literalinclude} ../examples/time_machine_backtesting.py :lines: 6- ``` @@ -187,8 +235,12 @@ The following scripts can also be found in the :end-line: 5 ``` -:::{admonition} Example: [vcr.py](https://github.com/requests-cache/requests-cache/blob/main/examples/vcr.py) -:class: toggle +:::{dropdown} Example +:animate: fade-in-slide-down +:color: primary +:icon: file-code + +[vcr.py](https://github.com/requests-cache/requests-cache/blob/main/examples/vcr.py) ```{literalinclude} ../examples/vcr.py :lines: 7- ``` diff --git a/docs/index.md b/docs/index.md index f6e7e85..8a3e9c3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,8 +3,11 @@ Pre-release warning to reduce confusion on what '/latest' means; TODO: add script to make this conditional -->