From 525c54b5fabf189f71faeb1cce4b18a665aa6e0f Mon Sep 17 00:00:00 2001 From: UlrichB22 <97119703+UlrichB22@users.noreply.github.com> Date: Sun, 11 Aug 2024 21:02:07 +0200 Subject: [PATCH] SlideShow macro: add docs and key control --- docs/user/moinwiki.rst | 7 +++++ src/moin/help/help-en/MoinWikiMacros.data | 22 ++++++++++++++ src/moin/help/help-en/MoinWikiMacros.meta | 10 +++---- src/moin/templates/slideshow.html | 35 ++++++++++++++--------- 4 files changed, 56 insertions(+), 18 deletions(-) diff --git a/docs/user/moinwiki.rst b/docs/user/moinwiki.rst index ae900444d..091fe9ca2 100644 --- a/docs/user/moinwiki.rst +++ b/docs/user/moinwiki.rst @@ -826,6 +826,8 @@ extra features. The following is a table of MoinMoin's macros. +-------------------------------------------+------------------------------------------------------------+ | ``<>`` | Displays metadata defined in wikidict attribute | +-------------------------------------------+------------------------------------------------------------+ +| ``<>`` | Displays a link to start a slideshow for the current item | ++-------------------------------------------+------------------------------------------------------------+ | ``<>`` | Shows a table of contents up to level 2 | +-------------------------------------------+------------------------------------------------------------+ | ``<>`` | Lists all itemnames for the namespace of the current item, | @@ -896,6 +898,11 @@ fixed_height and anniversary. - <> Calendar of current Page, this year's december - <> Calendar of December, 2022 +The **SlideShow** macro creates a link to start a presentation for the current item. The slides +are separated by level 1 and 2 headings. The text before the first heading is ignored. Navigation +within the slideshow can be controlled via corresponding buttons at the edge or bottom of the +browser screen or using the left and right arrow keys. + Smileys and Icons ================= diff --git a/src/moin/help/help-en/MoinWikiMacros.data b/src/moin/help/help-en/MoinWikiMacros.data index eedc4f3fc..2b3e56bbe 100644 --- a/src/moin/help/help-en/MoinWikiMacros.data +++ b/src/moin/help/help-en/MoinWikiMacros.data @@ -548,6 +548,28 @@ represents sample output. {'dog': 'Hund', 'cat': 'Katze'} +=== SlideShow === + +A slideshow can be defined on a single wiki page, with the slides separated by level 1 and 2 headings. +The text before the first heading is ignored. The macro creates a link to start the presentation. + +Navigating through the slides works by various means: + + * Use the left and right arrow keys to move to the previous and next slide + * Alternatively, you can click on the gray navigation links on the left and right edges of the screen + * There are icons at the bottom to switch to the first or last slide and to exit presentation mode + * Use the up and down arrow keys to scroll up and down within the content if it does not fit in the browser window + * The browser's built-in zoom function can be used to adjust the size of the presentation to your needs + +'''Markup:''' + +{{{ + <> +}}} + +'''Result:''' + + <> === TitleIndex === diff --git a/src/moin/help/help-en/MoinWikiMacros.meta b/src/moin/help/help-en/MoinWikiMacros.meta index 4f201f5cd..77ff4af81 100644 --- a/src/moin/help/help-en/MoinWikiMacros.meta +++ b/src/moin/help/help-en/MoinWikiMacros.meta @@ -3,7 +3,7 @@ "address": "127.0.0.1", "comment": "", "contenttype": "text/x.moin.wiki;charset=utf-8", - "dataid": "f1524f1f521a4600b3cb55caa557b558", + "dataid": "e5c04311b38c46029e237c0c12f3aa40", "externallinks": [ "https://fontawesome.com/search?o=r&m=free", "https://moinmo.in/HelpOnMacros/Include" @@ -19,16 +19,16 @@ ], "itemtype": "default", "language": "en", - "mtime": 1710879680, + "mtime": 1723402687, "name": [ "MoinWikiMacros" ], "name_old": [], "namespace": "help-en", "rev_number": 1, - "revid": "d61a54ba4e924b418d421b6b27c74616", - "sha1": "f3443067aeb6adf5ef47ec171052bfb01b0855d3", - "size": 13603, + "revid": "dfc263543dd84e4b9fbe6b64dd983b58", + "sha1": "0064f57340dac2f337760e88e5bd57fc9ef550b1", + "size": 14479, "summary": "", "tags": [ "macros", diff --git a/src/moin/templates/slideshow.html b/src/moin/templates/slideshow.html index 0c27d4d94..c6228471e 100644 --- a/src/moin/templates/slideshow.html +++ b/src/moin/templates/slideshow.html @@ -27,29 +27,38 @@ let slides = document.getElementsByClassName("moin-slides"); showSlide(slideNo); + document.addEventListener("keydown", (event) => { + if (event.code === "ArrowLeft") { + prevSlide(); + } + if (event.code === "ArrowRight") { + nextSlide(); + } + }); + function nextSlide() { - if (slideNo < slides.length) { - showSlide(slideNo += 1); - } + if (slideNo < slides.length) { + showSlide((slideNo += 1)); + } } function prevSlide() { - if (slideNo > 1) { - showSlide(slideNo -= 1); - } + if (slideNo > 1) { + showSlide((slideNo -= 1)); + } } function lastSlide() { - showSlide(slides.length); + showSlide(slides.length); } function showSlide(n) { - let i; - slideNo = n; - for (i = 0; i < slides.length; i++) { - slides[i].style.display = "none"; - } - slides[slideNo - 1].style.display = "block"; + let i; + slideNo = n; + for (i = 0; i < slides.length; i++) { + slides[i].style.display = "none"; + } + slides[slideNo - 1].style.display = "block"; } {% endblock %}