Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use sphinx-design and theme's light/dark image selectors #10671

Merged
merged 21 commits into from
Jun 2, 2022

Conversation

drammock
Copy link
Member

@drammock drammock commented May 24, 2022

No description provided.

@drammock
Copy link
Member Author

Circle failure reported upstream: mcmtroffaes/pybtex-docutils#21

@larsoner
Copy link
Member

In the meantime, it's possible that adding is ignored and will be removed in Docutils to our ignores in conf.py might work around the issue

@drammock
Copy link
Member Author

@mcmtroffaes is usually very quick, let's wait a day and see rather than hastily doing a version-pin or adding a warning-ignore

@drammock
Copy link
Member Author

Another failure, reported upstream: numpy/numpydoc#399

seems like using sphinx 5.0 beta (which allows docutils 0.18) is behind these.

@drammock
Copy link
Member Author

drammock commented Jun 1, 2022

dang, forgot to add sphinx_design to docs requirements. stand by.

@larsoner
Copy link
Member

larsoner commented Jun 1, 2022

/home/circleci/project/doc/auto_tutorials/inverse/70_eeg_mri_coords.rst:125: ERROR: Unknown directive type "collapse".
/home/circleci/project/doc/overview/cite.rst:16: ERROR: Error in "dropdown" directive:
unknown option: "class".
/home/circleci/project/doc/overview/cite.rst:35: ERROR: Error in "dropdown" directive:
unknown option: "class".

@hoechenberger
Copy link
Member

@drammock can you please ping me once it builds? I can then have a look and will review :) thanks!

@drammock
Copy link
Member Author

drammock commented Jun 1, 2022

argh, sorry, seems I ran my git grep from within doc/ instead of on the whole repo. I'll find/fix the others now.

_assemble(node, self)
return [node]


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No suitable replacement for .. details:: in sphinx-design?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, seems like it wasn't even being used:

$ git grep ".. details::"
doc/sphinxext/sphinx_bootstrap_divs/__init__.py:70:# .. details::
doc/sphinxext/sphinx_bootstrap_divs/__init__.py:73:    """Class for .. details:: directive."""

I think that means we can delete the entire sphinx-bootstrap-divs extension?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, feel free!

$ mamba create --override-channels --channel=conda-forge --name=mne mne


.. tab-item:: macOS (M1 / Apple Silicon)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire bit is already gone in main and has been backported

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dang, I must have messed up the rebase this morning. thanks for catching that. I just pushed a fix.

.. collapse:: |hand-paper| If you get an error...
:class: danger
.. dropdown:: If you get an error...
:icon: alert-fill
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here (and in other dropdowns) we can also later add things like :color: warning or :color: danger, but at present they don't work yet; see executablebooks/sphinx-design#70

Comment on lines 39 to 48
.. button-link:: https://github.com/mne-tools/mne-installers/releases/download/v1.0.3/MNE-Python-1.0.3_0-macOS_Intel.pkg
:ref-type: ref
:color: primary
:shadow:
:class: font-weight-bold

|cloud-download-alt| |ensp| Download for macOS

**Supported platforms:**
macOS 10.15 (Catalina) and newer (Intel and Apple Silicon)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where the changes in #10693 would end up I think

Comment on lines +122 to +132
let all_tab_nodes = document.querySelectorAll(
'.platform-selector-tabset')[0].children;
let input_nodes = [...all_tab_nodes].filter(
child => child.nodeName === "INPUT");
let tab_label_nodes = [...document.querySelectorAll('.sd-tab-label')];
let correct_label = tab_label_nodes.filter(
label => label.textContent.trim().toLowerCase() === platform)[0];
let hash = correct_label.getAttribute('for');
let correct_input = input_nodes.filter(node => node.id === hash)[0];
correct_input.checked = true;
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's probably a more elegant way to code this in JS, maybe @hoechenberger knows? Crossref for why it's so convoluted: executablebooks/sphinx-design#68

_assemble(node, self)
return [node]


Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, seems like it wasn't even being used:

$ git grep ".. details::"
doc/sphinxext/sphinx_bootstrap_divs/__init__.py:70:# .. details::
doc/sphinxext/sphinx_bootstrap_divs/__init__.py:73:    """Class for .. details:: directive."""

I think that means we can delete the entire sphinx-bootstrap-divs extension?

:shadow:
:class: font-weight-bold

|cloud-download-alt| |ensp| Download Installers
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (the cloud-download-alt) currently doesn't render correctly, probably should just get removed for now. Upstream issue: executablebooks/sphinx-design#66

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind my comments below, then! Feel free to comment out the icons for now then

@larsoner
Copy link
Member

larsoner commented Jun 1, 2022

@larsoner
Copy link
Member

larsoner commented Jun 1, 2022

(fontawesome HTML is in the buttons)

@drammock
Copy link
Member Author

drammock commented Jun 1, 2022

Something is wrong in https://output.circle-artifacts.com/output/job/31d5cf6e-0351-41c2-9738-bceed9164c77/artifacts/0/dev/install/index.html

yep, I noted that in my review. Question is whether to wait for upstream fix, or live without the icons for now

@drammock drammock changed the title use theme's light/dark selectors for homepage logo use sphinx-design and theme's light/dark image selectors Jun 1, 2022
Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoechenberger
Copy link
Member

I will take a look tomorrow!

In any case we should probably not merge until we have native Apple Silicon installers ready, no?

I believe will get there until Friday.

@larsoner
Copy link
Member

larsoner commented Jun 1, 2022

I think it's easiest to merge this, then deal with M1 whenever it's ready

@hoechenberger
Copy link
Member

Ah sorry I was mistaken, I thought the phrasing in this PR already assumed we had native M1 builds. Seems my brain is a bit tired :) I'll review tomorrow morning CEST and merge, ok? :)

@hoechenberger
Copy link
Member

I added a bit morge top-margin, otherwise all looks great to me! fantastic work!

@hoechenberger
Copy link
Member

The Circle error is related to some setup problem. I successfully built with my changes locally. Going ahead and merging this one.

@hoechenberger hoechenberger merged commit fc53916 into mne-tools:main Jun 2, 2022
@hoechenberger
Copy link
Member

Thanks @drammock!!

@drammock drammock deleted the use-theme-dkmode branch June 3, 2022 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants