-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
ENH: Collapse only in doc gen #12145
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
Conversation
|
Looks quite good to me! 😍 |
|
Appears to have worked on CircleCI. @drammock feel free to review/merge if you're happy |
|
I'm sill seeing #12130 in the doc link you posted, btw
|
firefox is also OK. I think this is Safari misbehaving. MDN docs say:
and (though not relevant here)
|
|
@drammock If I read the specs correctly, what Chrome and FF do is an implementation detail and Safari is following the standard too
I think we'll need to find a different solution to do the collapsibles if we want to ensure interoperability |
|
How abou trying: <details>
<summary>...</summary>
...
</details> |
I think you're mistaken; the elements in question are
EDIT: in other words, the part you quoted about "other elements" doesn't apply; these aren't "other" elements they're table elements. |
|
Ah, that makes sense!! In any case, it's not working as expected in Safari 😢 |
|
Yes, I put together this <details>
<summary>General!</summary>
<table class="table table-hover table-striped table-sm table-responsive small">
<tr>
<th class="collapsible_header" colspan="2" style="font-weight: bold; text-align: left;">
<label for={{ section_ids[0] }}>
{{sections[0]}}
</label>
</th>
</tr>
<tr class="{{ section_ids[0] }}">
<th>Measurement date</th>
{% if meas_date is not none %}
<td>{{ meas_date }}</td>
{% else %}
<td>Unknown</td>
{% endif %}
</tr>
<tr class="{{ section_ids[0] }}">
<th>Experimenter</th>
{% if experimenter is not none %}
<td>{{ experimenter }}</td>
{% else %}
<td>Unknown</td>
{% endif %}
</tr>
<tr class="{{ section_ids[0] }}">
<th>Participant</th>
{% if subject_info is defined and subject_info is not none %}
{% if 'his_id' in subject_info.keys() %}
<td>{{ subject_info['his_id'] }}</td>
{% endif %}
{% else %}
<td>Unknown</td>
{% endif %}
</tr>
</table>
</details>MWE: # %%
import mne
sample_dir = mne.datasets.sample.data_path()
sample_fname = sample_dir / "MEG" / "sample" / "sample_audvis_raw.fif"
raw = mne.io.read_raw_fif(sample_fname, preload=True)
raw.crop(tmax=60)
raw.info
# %%
report = mne.Report()
report.add_raw(raw, title="Raw")
report.save("/tmp/foo.html", overwrite=True)But we'd still need a way to control the initial collapse state, I don't have time for any further investigations today (it's bed time for me) (You can't see it in the screenshots but the vertical space is cleared.) |
nice solution! should be straightforward to do the same jinja if/else trick with the |
|
We just need to ensure it keeps working in both Jupyter and the docs … fingers crossed |
|
@drammock feel free to push a commit if you want, I won't have time to look until tonight at the earliest (and maybe next week) |
Nice find, this should do the trick! |
|
And from CircleCI, the default:
And with some clicking:
|
| {# Complete tags for curlylint #} | ||
| {{ if 0 }} | ||
| <html lang="{{ lang | safe }}"> | ||
| <body> | ||
| <div> | ||
| <div> | ||
| {{ endif }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added curlylint. It necessitated adding stuff like this, which I actually don't mind -- it helps us document a bit what HTML tags we have opened and/or will close later.
pyproject.toml
Outdated
| django_forms_rendering = true | ||
| html_has_lang = true | ||
| image_alt = true | ||
| # indent = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to comment this one out because we are not consistent. A follow-up PR could uncomment this and fix all files, and we could add it to .gitignore.
|
very nice!! |
|
failures are Jinja-related here: |
|
there was a jinja error ( |
|
given that Details |
|
OK I've purged curlylint; should get the CIs green again. |
😱 thanks @drammock agreed it's not worth keeping around yet |
|
here's the rendered tutorial, still looks good (auto-collapsed) https://output.circle-artifacts.com/output/job/72aeac1a-9296-4049-abd5-529cd83e85b8/artifacts/0/html/auto_tutorials/intro/30_info.html#dropping-channels-from-an-info-object |
* upstream/main: (35 commits) [DOC] Add documentation for setting montage order (mne-tools#12160) Fix inferring fiducials from EEGLAB (mne-tools#12165) Try to fix ICA Report (mne-tools#12167) BUG: Fix bug with Report.add_ica component number (mne-tools#12156) MAINT: Add rstcheck to CIs and pre-commit (mne-tools#12163) DOC: fix sphinx style typos (mne-tools#12161) MAINT: Fix linkcheck (mne-tools#12162) ENH: Add multiple label support to source_band_induced_power, source_induced_power (mne-tools#12026) Allow automated metadata generation to be bounded by "row events" instead of explicit time windows (mne-tools#12118) ENH: Collapse only in doc gen (mne-tools#12145) [pre-commit.ci] pre-commit autoupdate (mne-tools#12155) BUG: Fix bug with interior points not showing (mne-tools#12148) ENH: Warn about versions in sys_info (mne-tools#12146) Fix in conftest.py (mne-tools#12150) ENH: set color for bad channel with spatial_colors=True (mne-tools#12142) DOC: Better documentation of realign_raw (mne-tools#12135) Add mne-icalabel wildcard (mne-tools#12143) Remove LGTM.com configuration file (mne-tools#12139) DOC: Fix typo found by codespell (mne-tools#12140) DOC: Document governance updates (mne-tools#12133) ...
* upstream/main: (26 commits) FIX: Fix bug with coreg scalars (mne-tools#12164) Changed casting rule in np.clip to allow reading of raw GDF files (mne-tools#12168) [DOC] Add documentation for setting montage order (mne-tools#12160) Fix inferring fiducials from EEGLAB (mne-tools#12165) Try to fix ICA Report (mne-tools#12167) BUG: Fix bug with Report.add_ica component number (mne-tools#12156) MAINT: Add rstcheck to CIs and pre-commit (mne-tools#12163) DOC: fix sphinx style typos (mne-tools#12161) MAINT: Fix linkcheck (mne-tools#12162) ENH: Add multiple label support to source_band_induced_power, source_induced_power (mne-tools#12026) Allow automated metadata generation to be bounded by "row events" instead of explicit time windows (mne-tools#12118) ENH: Collapse only in doc gen (mne-tools#12145) [pre-commit.ci] pre-commit autoupdate (mne-tools#12155) BUG: Fix bug with interior points not showing (mne-tools#12148) ENH: Warn about versions in sys_info (mne-tools#12146) Fix in conftest.py (mne-tools#12150) ENH: set color for bad channel with spatial_colors=True (mne-tools#12142) DOC: Better documentation of realign_raw (mne-tools#12135) Add mne-icalabel wildcard (mne-tools#12143) Remove LGTM.com configuration file (mne-tools#12139) ...
Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com> Co-authored-by: Daniel McCloy <dan@mccloy.info>








Closes #12130
Closes #12131
Closes #12149
If we eventually want a way to control this behavior we could add env var, context manager, etc. but not implemented here (YAGNI from #12131). Locally seems to work: