Skip to content

Commit

Permalink
doc: fixes to the asciicast infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Sep 8, 2024
1 parent fc8c937 commit 37ec808
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 250 deletions.
41 changes: 41 additions & 0 deletions docs/assets/asciinema-player/asciicast-load.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var slideshow = remark.create({
highlightStyle: 'monokai',
highlightLanguage: 'remark',
highlightLines: true,
countIncrementalSlides: false,
highlightSpans: true,
ratio: '16:9'
});

// Now retrieve all IDs of asciinema casts
const allcasts = new Map();

slideshow.on('afterShowSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
var element = document.getElementsByClassName("remark-visible")[0].getElementsByClassName('asciicast')
if (element.length == 0 ) {
return;
}

if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).play();
return;
}

var castid = element[0].attributes["id"].value;
var castsrc = element[0].attributes["data-src"].value;
allcasts.set(slideNumber, AsciinemaPlayer.create(
castsrc,
document.getElementById(castid),
{ autoPlay: true, speed: 2, idle_time_limit: 8, rows: 23 }
));
});

slideshow.on('beforeHideSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).pause();
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -989,53 +989,6 @@

</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script>
var slideshow = remark.create({
highlightStyle: 'monokai',
highlightLanguage: 'remark',
highlightLines: true,
countIncrementalSlides: false,
highlightSpans: true,
ratio: '16:9'
});

// Now retrieve all IDs of asciinema casts
const allcasts = new Map();

slideshow.on('afterShowSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
var element = document.getElementsByClassName("remark-visible")[0].getElementsByClassName('asciicast')
if (element.length == 0 ) {
return;
}

if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).play();
return;
}

var castid = element[0].attributes["id"].value;
allcasts.set(slideNumber, AsciinemaPlayer.create(
'images/fix-typo.cast',
document.getElementById('636539'),
{ autoPlay: true, speed: 2, idle_time_limit: 8, rows: 27 }
));
// allcasts.set(slideNumber, AsciinemaPlayer.create(
// 'https://asciinema.org/a/' + castid + '.cast',
// document.getElementById(castid),
// { autoPlay: true, speed: 2, idle_time_limit: 8, rows: 17 }
// ));
});

slideshow.on('beforeHideSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).pause();
}
});

</script>
<script src="/assets/asciinema-player/asciicast-load.js"></script>
</body>
</html>
41 changes: 2 additions & 39 deletions docs/assets/fmriprep-bootcamp-geneva2024/day1-02-bids/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1350,8 +1350,8 @@
};
// Use: ![:doi](10.5129/10234)
remark.macros.doi = function () {
var doi = this;
return '<a href="https://doi.org/' + doi + '">' + doi + '</a>';
var doi = this;
return '<a href="https://doi.org/' + doi + '">' + doi + '</a>';
};

var slideshow = remark.create({
Expand All @@ -1362,43 +1362,6 @@
highlightSpans: true,
ratio: '16:9'
});

// Now retrieve all IDs of asciinema casts
const allcasts = new Map();

slideshow.on('afterShowSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
var element = document.getElementsByClassName("remark-visible")[0].getElementsByClassName('asciicast')
if (element.length == 0 ) {
return;
}

if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).play();
return;
}

var castid = element[0].attributes["id"].value;
allcasts.set(slideNumber, AsciinemaPlayer.create(
'images/fix-typo.cast',
document.getElementById('636539'),
{ autoPlay: true, speed: 2, idle_time_limit: 8, rows: 27 }
));
// allcasts.set(slideNumber, AsciinemaPlayer.create(
// 'https://asciinema.org/a/' + castid + '.cast',
// document.getElementById(castid),
// { autoPlay: true, speed: 2, idle_time_limit: 8, rows: 17 }
// ));
});

slideshow.on('beforeHideSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).pause();
}
});
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@
.perma-sidebar[
<p class="rotate">
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0; height: 20px; padding-top: 6px;" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a>
<span style="padding-left: 10px; font-weight: 600;">Day 1 :: Data & HPC</span>
<span style="padding-left: 10px; font-weight: 600;">Day 1 :: BIDS Hands-on</span>
</p>
]

Expand Down Expand Up @@ -498,68 +498,31 @@
# Logging in into a cluster and setting up conda

.boxed-content.pad-top[
<div class="asciicast" id="636539"></div>
<div class="asciicast" id="636539" data-src="images/setting-conda.cast"></div>
]

---

# Exploring the bootcamp's dataset

.boxed-content[
.center[[https://openneuro.org/datasets/ds005454/versions/1.0.0](https://openneuro.org/datasets/ds005454/versions/1.0.0)]

<iframe src="https://openneuro.org/datasets/ds005454/versions/1.0.0" width="100%" height="500px" style="border: 0" />
]

---

# First interaction with datalad

.boxed-content.pad-top[
<div class="asciicast" id="636540"></div>
<div class="asciicast" id="636540" data-src="images/setting-datalad.cast"></div>
]

???

</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script>
var slideshow = remark.create({
highlightStyle: 'monokai',
highlightLanguage: 'remark',
highlightLines: true,
countIncrementalSlides: false,
highlightSpans: true,
ratio: '16:9'
});

// Now retrieve all IDs of asciinema casts
const allcasts = new Map();

slideshow.on('afterShowSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
var element = document.getElementsByClassName("remark-visible")[0].getElementsByClassName('asciicast')
if (element.length == 0 ) {
return;
}

if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).play();
return;
}

var castid = element[0].attributes["id"].value;
allcasts.set(slideNumber, AsciinemaPlayer.create(
'images/setting-conda.cast',
document.getElementById('636539'),
{ autoPlay: true, speed: 2, idle_time_limit: 8, rows: 23 }
));
allcasts.set(slideNumber, AsciinemaPlayer.create(
'images/setting-datalad.cast',
document.getElementById('636540'),
{ autoPlay: true, speed: 2, idle_time_limit: 8, rows: 23 }
));
});

slideshow.on('beforeHideSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).pause();
}
});

</script>
<script src="/assets/asciinema-player/asciicast-load.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -503,54 +503,7 @@


</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script>
var slideshow = remark.create({
highlightStyle: 'monokai',
highlightLanguage: 'remark',
highlightLines: true,
countIncrementalSlides: false,
highlightSpans: true,
ratio: '16:9'
});

// Now retrieve all IDs of asciinema casts
const allcasts = new Map();

slideshow.on('afterShowSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
var element = document.getElementsByClassName("remark-visible")[0].getElementsByClassName('asciicast')
if (element.length == 0 ) {
return;
}

if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).play();
return;
}

var castid = element[0].attributes["id"].value;
allcasts.set(slideNumber, AsciinemaPlayer.create(
'images/setting-conda.cast',
document.getElementById('636539'),
{ autoPlay: true, speed: 2, idle_time_limit: 8, rows: 23 }
));
// allcasts.set(slideNumber, AsciinemaPlayer.create(
// 'https://asciinema.org/a/' + castid + '.cast',
// document.getElementById(castid),
// { autoPlay: true, speed: 2, idle_time_limit: 8, rows: 17 }
// ));
});

slideshow.on('beforeHideSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).pause();
}
});

</script>
<script src="https://remarkjs.com/downloads/remark-latest.min.js" />
<script src="/assets/asciinema-player/asciicast-load.js" />
</body>
</html>
64 changes: 1 addition & 63 deletions docs/assets/fmriprep-bootcamp-geneva2024/home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -709,68 +709,6 @@

</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script>
// Use: ![:img Alt text with spaces but not commas, 50%](image.png)
remark.macros.img = function (altText, width) {
var url = this;
return '<img alt="' + altText + '" src="' + url + '" style="width: ' + width + '" />';
};
// Use: ![:video](10.5129/10234)
remark.macros.video = function (width) {
var url = this;
return '<video src="' + url + '" width="' + width + '" preload="auto" controls />';
};
// Use: ![:doi](10.5129/10234)
remark.macros.doi = function () {
var doi = this;
return '<a href="https://doi.org/' + doi + '">' + doi + '</a>';
};

var slideshow = remark.create({
highlightStyle: 'monokai',
highlightLanguage: 'remark',
highlightLines: true,
countIncrementalSlides: false,
highlightSpans: true,
ratio: '16:9'
});

// Now retrieve all IDs of asciinema casts
const allcasts = new Map();

slideshow.on('afterShowSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
var element = document.getElementsByClassName("remark-visible")[0].getElementsByClassName('asciicast')
if (element.length == 0 ) {
return;
}

if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).play();
return;
}

var castid = element[0].attributes["id"].value;
allcasts.set(slideNumber, AsciinemaPlayer.create(
'images/fix-typo.cast',
document.getElementById('636539'),
{ autoPlay: true, speed: 2, idle_time_limit: 8, rows: 27 }
));
// allcasts.set(slideNumber, AsciinemaPlayer.create(
// 'https://asciinema.org/a/' + castid + '.cast',
// document.getElementById(castid),
// { autoPlay: true, speed: 2, idle_time_limit: 8, rows: 17 }
// ));
});

slideshow.on('beforeHideSlide', function (slide) {
// Slide is the slide being navigated
var slideNumber = slide.getSlideIndex();
if (allcasts.has(slideNumber)) {
allcasts.get(slideNumber).pause();
}
});
</script>
<script src="/assets/asciinema-player/asciicast-load.js"></script>
</body>
</html>

0 comments on commit 37ec808

Please sign in to comment.