Skip to content

Commit fbcd6cc

Browse files
authored
Merge pull request #1724 from UlrichB22/slideshow2
SlideShow macro: add docs and key control
2 parents 5d33343 + 525c54b commit fbcd6cc

File tree

4 files changed

+56
-18
lines changed

4 files changed

+56
-18
lines changed

docs/user/moinwiki.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,8 @@ extra features. The following is a table of MoinMoin's macros.
826826
+-------------------------------------------+------------------------------------------------------------+
827827
| ``<<ShowWikiDict()>>`` | Displays metadata defined in wikidict attribute |
828828
+-------------------------------------------+------------------------------------------------------------+
829+
| ``<<SlideShow()>>`` | Displays a link to start a slideshow for the current item |
830+
+-------------------------------------------+------------------------------------------------------------+
829831
| ``<<TableOfContents(2)>>`` | Shows a table of contents up to level 2 |
830832
+-------------------------------------------+------------------------------------------------------------+
831833
| ``<<TitleIndex()>>`` | Lists all itemnames for the namespace of the current item, |
@@ -896,6 +898,11 @@ fixed_height and anniversary.
896898
- <<MonthCalendar(month=12)>> Calendar of current Page, this year's december
897899
- <<MonthCalendar(year=2022,month=12)>> Calendar of December, 2022
898900

901+
The **SlideShow** macro creates a link to start a presentation for the current item. The slides
902+
are separated by level 1 and 2 headings. The text before the first heading is ignored. Navigation
903+
within the slideshow can be controlled via corresponding buttons at the edge or bottom of the
904+
browser screen or using the left and right arrow keys.
905+
899906

900907
Smileys and Icons
901908
=================

src/moin/help/help-en/MoinWikiMacros.data

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,28 @@ represents sample output.
548548

549549
{'dog': 'Hund', 'cat': 'Katze'}
550550

551+
=== SlideShow ===
552+
553+
A slideshow can be defined on a single wiki page, with the slides separated by level 1 and 2 headings.
554+
The text before the first heading is ignored. The macro creates a link to start the presentation.
555+
556+
Navigating through the slides works by various means:
557+
558+
* Use the left and right arrow keys to move to the previous and next slide
559+
* Alternatively, you can click on the gray navigation links on the left and right edges of the screen
560+
* There are icons at the bottom to switch to the first or last slide and to exit presentation mode
561+
* Use the up and down arrow keys to scroll up and down within the content if it does not fit in the browser window
562+
* The browser's built-in zoom function can be used to adjust the size of the presentation to your needs
563+
564+
'''Markup:'''
565+
566+
{{{
567+
<<SlideShow()>>
568+
}}}
569+
570+
'''Result:'''
571+
572+
<<SlideShow()>>
551573

552574
=== TitleIndex ===
553575

src/moin/help/help-en/MoinWikiMacros.meta

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"address": "127.0.0.1",
44
"comment": "",
55
"contenttype": "text/x.moin.wiki;charset=utf-8",
6-
"dataid": "f1524f1f521a4600b3cb55caa557b558",
6+
"dataid": "e5c04311b38c46029e237c0c12f3aa40",
77
"externallinks": [
88
"https://fontawesome.com/search?o=r&m=free",
99
"https://moinmo.in/HelpOnMacros/Include"
@@ -19,16 +19,16 @@
1919
],
2020
"itemtype": "default",
2121
"language": "en",
22-
"mtime": 1710879680,
22+
"mtime": 1723402687,
2323
"name": [
2424
"MoinWikiMacros"
2525
],
2626
"name_old": [],
2727
"namespace": "help-en",
2828
"rev_number": 1,
29-
"revid": "d61a54ba4e924b418d421b6b27c74616",
30-
"sha1": "f3443067aeb6adf5ef47ec171052bfb01b0855d3",
31-
"size": 13603,
29+
"revid": "dfc263543dd84e4b9fbe6b64dd983b58",
30+
"sha1": "0064f57340dac2f337760e88e5bd57fc9ef550b1",
31+
"size": 14479,
3232
"summary": "",
3333
"tags": [
3434
"macros",

src/moin/templates/slideshow.html

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,38 @@
2727
let slides = document.getElementsByClassName("moin-slides");
2828
showSlide(slideNo);
2929

30+
document.addEventListener("keydown", (event) => {
31+
if (event.code === "ArrowLeft") {
32+
prevSlide();
33+
}
34+
if (event.code === "ArrowRight") {
35+
nextSlide();
36+
}
37+
});
38+
3039
function nextSlide() {
31-
if (slideNo < slides.length) {
32-
showSlide(slideNo += 1);
33-
}
40+
if (slideNo < slides.length) {
41+
showSlide((slideNo += 1));
42+
}
3443
}
3544

3645
function prevSlide() {
37-
if (slideNo > 1) {
38-
showSlide(slideNo -= 1);
39-
}
46+
if (slideNo > 1) {
47+
showSlide((slideNo -= 1));
48+
}
4049
}
4150

4251
function lastSlide() {
43-
showSlide(slides.length);
52+
showSlide(slides.length);
4453
}
4554

4655
function showSlide(n) {
47-
let i;
48-
slideNo = n;
49-
for (i = 0; i < slides.length; i++) {
50-
slides[i].style.display = "none";
51-
}
52-
slides[slideNo - 1].style.display = "block";
56+
let i;
57+
slideNo = n;
58+
for (i = 0; i < slides.length; i++) {
59+
slides[i].style.display = "none";
60+
}
61+
slides[slideNo - 1].style.display = "block";
5362
}
5463
</script>
5564
{% endblock %}

0 commit comments

Comments
 (0)