Skip to content

Commit c354649

Browse files
committed
Merge branch 'main' into update-intro-tutorial
2 parents e50c116 + 0857812 commit c354649

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1823
-1674
lines changed

+matnwb/+common/+compatibility/mustBeFile.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ function mustBeFile(filePath)
99
arguments
1010
filePath (1,1) string
1111
end
12+
13+
% Skip check for s3 uris to support reading remote files
14+
if startsWith(filePath, "s3://")
15+
return
16+
end
1217

1318
if verLessThan('matlab', '9.9') %#ok<VERLESSMATLAB>
1419
% Custom implementation (MATLAB < R2020b)

docs/source/_static/html/tutorials/behavior.html

Lines changed: 26 additions & 29 deletions
Large diffs are not rendered by default.

docs/source/_static/html/tutorials/dimensionMapNoDataPipes.html

Lines changed: 12 additions & 11 deletions
Large diffs are not rendered by default.

docs/source/_static/html/tutorials/dynamic_tables.html

Lines changed: 112 additions & 60 deletions
Large diffs are not rendered by default.

docs/source/_static/html/tutorials/ecephys.html

Lines changed: 871 additions & 843 deletions
Large diffs are not rendered by default.

docs/source/_static/html/tutorials/icephys.html

Lines changed: 70 additions & 57 deletions
Large diffs are not rendered by default.

docs/source/_static/html/tutorials/images.html

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

docs/source/_static/html/tutorials/intro.html

Lines changed: 220 additions & 294 deletions
Large diffs are not rendered by default.

docs/source/_static/html/tutorials/js/copy-buttons.js

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,50 @@
4040

4141
// copy click handler
4242
btn.addEventListener('click', async () => {
43+
const normalize = s => s
44+
.replace(/\u00A0/g, ' ') // NBSP → space
45+
.replace(/\u202F/g, ' ') // narrow NBSP → space
46+
.replace(/[\u200B\uFEFF]/g, '') // ZWSP/BOM → remove
47+
.replace(/\s+$/, ''); // trim end (preserve blank lines)
48+
4349
const lines = [];
44-
let outputsNode = null;
4550

46-
block.childNodes.forEach(node => {
47-
if (node.nodeType !== 1) return;
48-
if (node.classList.contains('outputs')) {
49-
outputsNode = node;
51+
Array.from(block.children).forEach(el => {
52+
if (!el.classList || !el.classList.contains('inlineWrapper')) return;
53+
54+
if (!el.classList.contains('outputs')) {
55+
// normal code line
56+
lines.push(normalize(el.textContent || ''));
5057
return;
5158
}
52-
if (node !== btn) lines.push(node.innerText || '');
59+
60+
// outputs wrapper: include ONLY the first child (echo) and skip the rest
61+
const firstChild = el.firstElementChild;
62+
if (firstChild) {
63+
const t = normalize(firstChild.textContent || '');
64+
if (t.length) lines.push(t);
65+
}
66+
// do not process remaining children of .outputs
5367
});
5468

55-
if (outputsNode) {
56-
const firstOut = outputsNode.innerText
57-
.split(/\r?\n/)
58-
.find(Boolean) || '';
59-
lines.push(firstOut);
60-
}
69+
const payload = lines.join('\n').replace(/\s+$/, '');
6170

62-
const payload = lines.join('').trimEnd();
6371
try {
6472
await navigator.clipboard.writeText(payload);
65-
btn.classList.add('copied');
66-
} finally {
67-
setTimeout(() => btn.classList.remove('copied'), 1200);
73+
} catch {
74+
// minimal fallback for non-secure contexts / older browsers
75+
const ta = document.createElement('textarea');
76+
ta.value = payload;
77+
ta.style.position = 'fixed';
78+
ta.style.top = '-1000px';
79+
document.body.appendChild(ta);
80+
ta.focus(); ta.select();
81+
document.execCommand('copy');
82+
document.body.removeChild(ta);
6883
}
84+
85+
btn.classList.add('copied');
86+
setTimeout(() => btn.classList.remove('copied'), 1200);
6987
});
7088
});
7189
}

docs/source/_static/html/tutorials/js/iframe-link-handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
}
2626

2727
if (document.readyState === "loading") {
28-
document.addEventListener("DOMContentLoaded", rewriteLinks);
28+
document.addEventListener("DOMContentLoaded", rewriteLinks());
2929
} else {
3030
rewriteLinks();
3131
}

0 commit comments

Comments
 (0)