Skip to content

Commit

Permalink
Merge branch 'master' into forum-tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby authored Nov 17, 2022
2 parents 86d6656 + 8660f67 commit 70a9814
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 11 deletions.
22 changes: 22 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
codecov:
notify:
after_n_builds: 12

coverage:
status:
project:
default:
target: 0%
http:
target: 0%
flags:
- http
patch:
default:
target: 0%
http:
target: 0%
flags:
- http

flags:
http:
paths:
- discord/http.py
10 changes: 10 additions & 0 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,13 @@ img[src="_images/snake_dark.svg"] {
.sidebar-logo {
max-width: 60%;
}

/*.sidebar-tree {*/
/* font-family: "Saira", monospace;*/
/*}*/

.has-selector-alternative {
transition: max-height 0.2s ease-out;
max-height: 0;
overflow: hidden;
}
46 changes: 46 additions & 0 deletions docs/_static/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,50 @@ document.addEventListener("DOMContentLoaded", () => {
// insert ourselves after the element
parent.insertBefore(table, element.nextSibling);
});

// This can be replaced once the css :has() selector is mainstream
// https://developer.mozilla.org/en-US/docs/Web/CSS/:has
// .reference.internal:has(code) + ul
const tocObjects = document.querySelectorAll(
".toc-tree li > .reference.internal:not(:only-child) code",
);
tocObjects.forEach((e) => {
e.parentElement.parentElement
.querySelector(".reference.internal + ul")
.classList.add("has-selector-alternative");
});
});

// We could use this css instead, but it doesn't allow for the transition
// :not(.scroll-current) > .reference.internal:has(code) + ul:not(:has(.scroll-current))

const getCurrentTocObject = (e) => {
let target = null;
let next = e.target;
while (true) {
if (
next.firstElementChild.classList.contains("reference") &&
next.firstElementChild.firstElementChild?.localName === "code"
) {
target = next;
next = target.parentElement.parentElement;
} else {
break;
}
}
return target?.querySelector("ul");
};

document.addEventListener("gumshoeActivate", (e) => {
const target = getCurrentTocObject(e);
if (target) {
target.style.maxHeight = target.scrollHeight + "px";
}
});

document.addEventListener("gumshoeDeactivate", (e) => {
const target = getCurrentTocObject(e);
if (target) {
target.style.maxHeight = "0px";
}
});
2 changes: 1 addition & 1 deletion docs/api/enums.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ of :class:`enum.Enum`.

.. attribute:: forum

User can only write in threads, similar functionality to a forum, currently in experiment.
User can only write in threads, similar functionality to a forum.

.. versionadded:: 2.0

Expand Down
4 changes: 2 additions & 2 deletions docs/ext/bridge/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _discord_ext_bridge:

``discord.ext.bridge`` -- A module that bridges slash commands to prefixed commands
===================================================================================
discord.ext.bridge
==================

.. versionadded:: 2.0

Expand Down
4 changes: 2 additions & 2 deletions docs/ext/commands/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _discord_ext_commands:

``discord.ext.commands`` -- Bot commands framework
==================================================
discord.ext.commands
====================

``Pycord`` offers a lower level aspect on interacting with Discord. Often times, the library is used for the creation of
bots. However this task can be daunting and confusing to get correctly the first time. Many times there comes a repetition in
Expand Down
4 changes: 2 additions & 2 deletions docs/ext/pages/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _discord_ext_pages:

``discord.ext.pages`` -- A pagination extension module
======================================================
discord.ext.pages
=================

.. versionadded:: 2.0

Expand Down
4 changes: 2 additions & 2 deletions docs/ext/tasks/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _discord_ext_tasks:

``discord.ext.tasks`` -- asyncio.Task helpers
=============================================
discord.ext.tasks
=================

.. versionadded:: 1.1.0

Expand Down
14 changes: 14 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,36 @@ Extensions
These extensions help you during development when it comes to common tasks.

.. toctree::
:caption: Extensions
:maxdepth: 1
:hidden:

ext/commands/index.rst
ext/tasks/index.rst
ext/pages/index.rst
ext/bridge/index.rst

- :doc:`ext/commands/index` - Bot commands framework
- :doc:`ext/tasks/index` - asyncio.Task helpers
- :doc:`ext/pages/index` - A pagination extension module
- :doc:`ext/bridge/index` - A module that bridges slash commands to prefixed commands

Meta
----

If you're looking for something related to the project itself, it's here.

.. toctree::
:caption: Meta
:maxdepth: 1
:hidden:

changelog
version_guarantees
migrating_to_v1
migrating_to_v2

- :doc:`changelog` - The changelog for the library.
- :doc:`version_guarantees` - The version guarantees for the library.
- :doc:`migrating_to_v1` - How to migrate from v0.x to v1.x.
- :doc:`migrating_to_v2` - How to migrate from v1.x to v2.x.
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pylint~=2.15.5
pytest~=7.2.0
pytest-asyncio~=0.20.2
# pytest-order~=1.0.1
mypy~=0.990
mypy~=0.991
coverage~=6.5
pre-commit==2.20.0
codespell==2.2.2
Expand Down
2 changes: 1 addition & 1 deletion requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ sphinxcontrib_trio==1.1.2
sphinxcontrib-websupport==1.2.4
myst-parser==0.18.1
sphinxext-opengraph==0.7.2
sphinx-copybutton==0.5.0
sphinx-copybutton==0.5.1
furo@ git+https://github.com/BobDotCom/furo@temp
sphinx-autodoc-typehints==1.19.5

0 comments on commit 70a9814

Please sign in to comment.