From 4a924a7b9d7af01a15e96731fb3668d72ed8fc2a Mon Sep 17 00:00:00 2001 From: Paul-Elliot Date: Fri, 29 May 2026 16:49:38 +0200 Subject: [PATCH 1/7] Add auto-next capability --- src/compiler/special_attrs.ml | 4 +++- src/engine/runtime/step/action_scheduler.ml | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/compiler/special_attrs.ml b/src/compiler/special_attrs.ml index 78933eb2..491510f5 100644 --- a/src/compiler/special_attrs.ml +++ b/src/compiler/special_attrs.ml @@ -12,6 +12,7 @@ let svg = "svg" let pdf_resolution = "pdf-resolution" let pause_block = "pause-block" let as_html = "as-html" +let auto_next = "auto-next" let all_attrs = [ @@ -28,5 +29,6 @@ let all_attrs = svg; pdf_resolution; pause_block; - as_html + as_html; + auto_next ] diff --git a/src/engine/runtime/step/action_scheduler.ml b/src/engine/runtime/step/action_scheduler.ml index c07c139d..2a77b47a 100644 --- a/src/engine/runtime/step/action_scheduler.ml +++ b/src/engine/runtime/step/action_scheduler.ml @@ -76,13 +76,19 @@ let setup_actions window () = in () -let next ~mode window () = +let ( !! ) = Jstr.v + +let rec next ~mode window () = match find_next_pause_or_step () with | None -> None | Some pause -> let res = let> () = Actions.exit ~mode window pause in let> () = AttributeActions.do_ ~mode window pause in - Undoable.return () + match Brr.El.at !!"auto-next" pause with + | None -> Undoable.return () + | Some _ -> + let n = next ~mode window () in + Option.value ~default:(Undoable.return ()) n in Some res From e058c8213d9ecf6eb93d74ffbdee1a6e2df866ef Mon Sep 17 00:00:00 2001 From: Paul-Elliot Date: Fri, 29 May 2026 23:17:08 +0200 Subject: [PATCH 2/7] Fix toc in auto-next situation --- .../table_of_content/table_of_content.ml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/engine/runtime/table_of_content/table_of_content.ml b/src/engine/runtime/table_of_content/table_of_content.ml index 5fab5e9e..489e7678 100644 --- a/src/engine/runtime/table_of_content/table_of_content.ml +++ b/src/engine/runtime/table_of_content/table_of_content.ml @@ -60,11 +60,11 @@ let generate window root = [] |> List.rev |> List.concat in - let rec loop undo entries step categorized_els = + let rec loop ~auto_next undo entries step categorized_els = match categorized_els with | `Title t :: res -> let entries = entry_title t :: entries in - loop undo entries step res + loop ~auto_next undo entries step res | `Action a :: res -> if Step.Action_scheduler.is_action a then let* res = @@ -74,13 +74,18 @@ let generate window root = let> () = undo in Fut.return res in - let step = step + 1 in - let entries = entry_action window step :: entries in - loop undo entries step categorized_els - else loop undo entries step res + let step = if auto_next then step else step + 1 in + let entries = + if auto_next then entries else entry_action window step :: entries + in + let auto_next = Brr.El.at !!"auto-next" a |> Option.is_some in + loop ~auto_next undo entries step categorized_els + else loop ~auto_next undo entries step res | [] -> Fut.return (undo, List.rev entries) in - let* undo, entries = loop (Undoable.return ()) [] 0 categorized_els in + let* undo, entries = + loop ~auto_next:false (Undoable.return ()) [] 0 categorized_els + in let* (), undo = undo in let+ () = undo () in let els = entry_action window 0 :: entries in From 6fb783dc285190813d35130d08e5dd3a56ce57bf Mon Sep 17 00:00:00 2001 From: Paul-Elliot Date: Fri, 29 May 2026 23:21:37 +0200 Subject: [PATCH 3/7] Add changelog entry for #240 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e98af07..a8496407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## unrelease + +### Added + +- `auto-next` attribute to automatically continue to the next action (#240) + ## [v0.11.0] Brazlip (Sunday, the 24th of May, 2026) ### Added From 16e0162727f37dcd7eca162b6d6e294d60a29e61 Mon Sep 17 00:00:00 2001 From: Paul-Elliot Date: Fri, 29 May 2026 23:33:56 +0200 Subject: [PATCH 4/7] Add documentation for `auto-next`` --- docs/actions-api.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/actions-api.rst b/docs/actions-api.rst index 20fa10b5..a62014d1 100644 --- a/docs/actions-api.rst +++ b/docs/actions-api.rst @@ -60,6 +60,34 @@ It is possible to have multiple actions in a single attribute. They will be exec {#three .unrevealed} Some more content. +Actions are executed in "reading order", from top left to bottom right. The +presenter need to press the "next" key to trigger the next action. + +.. code-block:: + + {#one} + Some content. + + {center="~duration:2 ~margin:10 one" reveal="two three"} + The action above is executed first. + + {#two .unrevealed unreveal="three"} + The action above is executed second. + + {#three .unrevealed} + Some more content. + +When the ``auto-next`` attribute is included in the attribute set, the next +action is executed without requiring the user pressing the "next" key. + +.. code-block:: + + {reveal="two"} + The action above is executed first. + + {#two .unrevealed center} + The action above is executed directly after the first one. + .. contents:: Actions table of content :local: From 0e6959c67914fd3a0b0105763b2d96ec7836c3c7 Mon Sep 17 00:00:00 2001 From: Paul-Elliot Date: Fri, 29 May 2026 23:39:08 +0200 Subject: [PATCH 5/7] Add a test for auto-next --- test/compiler/auto-next.t/auto-next.md | 13 +++++++++++++ test/compiler/auto-next.t/run.t | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/compiler/auto-next.t/auto-next.md create mode 100644 test/compiler/auto-next.t/run.t diff --git a/test/compiler/auto-next.t/auto-next.md b/test/compiler/auto-next.t/auto-next.md new file mode 100644 index 00000000..fdef8298 --- /dev/null +++ b/test/compiler/auto-next.t/auto-next.md @@ -0,0 +1,13 @@ +a + +{pause} + +b + +{pause auto-next} + +c + +{pause} + +d \ No newline at end of file diff --git a/test/compiler/auto-next.t/run.t b/test/compiler/auto-next.t/run.t new file mode 100644 index 00000000..197b3bdb --- /dev/null +++ b/test/compiler/auto-next.t/run.t @@ -0,0 +1,9 @@ +Testing auto-next + + $ slipshow compile auto-next.md + +There should be 3 steps: a, then b appears, then c and d appears. + +Also, check the toc! + +$ cp auto-next.html /tmp/ \ No newline at end of file From 2d609b1636698c3b9ae356e54b9feba47398c6ab Mon Sep 17 00:00:00 2001 From: Paul-Elliot Date: Fri, 29 May 2026 23:56:18 +0200 Subject: [PATCH 6/7] Fix doc typos --- docs/actions-api.rst | 4 ++-- test/compiler/auto-next.t/run.t | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/actions-api.rst b/docs/actions-api.rst index a62014d1..cf8416a1 100644 --- a/docs/actions-api.rst +++ b/docs/actions-api.rst @@ -61,7 +61,7 @@ It is possible to have multiple actions in a single attribute. They will be exec Some more content. Actions are executed in "reading order", from top left to bottom right. The -presenter need to press the "next" key to trigger the next action. +presenter needs to press the "next" key to trigger the next action. .. code-block:: @@ -82,7 +82,7 @@ action is executed without requiring the user pressing the "next" key. .. code-block:: - {reveal="two"} + {reveal="two" auto-next} The action above is executed first. {#two .unrevealed center} diff --git a/test/compiler/auto-next.t/run.t b/test/compiler/auto-next.t/run.t index 197b3bdb..7379b2d1 100644 --- a/test/compiler/auto-next.t/run.t +++ b/test/compiler/auto-next.t/run.t @@ -6,4 +6,4 @@ There should be 3 steps: a, then b appears, then c and d appears. Also, check the toc! -$ cp auto-next.html /tmp/ \ No newline at end of file +$ cp auto-next.html /tmp/ From 0cc45422ffb73040e6ebfa345bf9064b1b29af62 Mon Sep 17 00:00:00 2001 From: Paul-Elliot Date: Sat, 30 May 2026 00:16:26 +0200 Subject: [PATCH 7/7] Rename auto-next to auto-continue --- CHANGELOG.md | 2 +- docs/actions-api.rst | 4 ++-- src/compiler/special_attrs.ml | 4 ++-- src/engine/runtime/step/action_scheduler.ml | 2 +- .../table_of_content/table_of_content.ml | 17 +++++++++-------- test/compiler/auto-next.t/auto-next.md | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8496407..2978883c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Added -- `auto-next` attribute to automatically continue to the next action (#240) +- `auto-continue` attribute to automatically continue to the next action (#240) ## [v0.11.0] Brazlip (Sunday, the 24th of May, 2026) diff --git a/docs/actions-api.rst b/docs/actions-api.rst index cf8416a1..64989a51 100644 --- a/docs/actions-api.rst +++ b/docs/actions-api.rst @@ -77,12 +77,12 @@ presenter needs to press the "next" key to trigger the next action. {#three .unrevealed} Some more content. -When the ``auto-next`` attribute is included in the attribute set, the next +When the ``auto-continue`` attribute is included in the attribute set, the next action is executed without requiring the user pressing the "next" key. .. code-block:: - {reveal="two" auto-next} + {reveal="two" auto-continue} The action above is executed first. {#two .unrevealed center} diff --git a/src/compiler/special_attrs.ml b/src/compiler/special_attrs.ml index 491510f5..9087bee9 100644 --- a/src/compiler/special_attrs.ml +++ b/src/compiler/special_attrs.ml @@ -12,7 +12,7 @@ let svg = "svg" let pdf_resolution = "pdf-resolution" let pause_block = "pause-block" let as_html = "as-html" -let auto_next = "auto-next" +let auto_continue = "auto-continue" let all_attrs = [ @@ -30,5 +30,5 @@ let all_attrs = pdf_resolution; pause_block; as_html; - auto_next + auto_continue ] diff --git a/src/engine/runtime/step/action_scheduler.ml b/src/engine/runtime/step/action_scheduler.ml index 2a77b47a..3ab23eaa 100644 --- a/src/engine/runtime/step/action_scheduler.ml +++ b/src/engine/runtime/step/action_scheduler.ml @@ -85,7 +85,7 @@ let rec next ~mode window () = let res = let> () = Actions.exit ~mode window pause in let> () = AttributeActions.do_ ~mode window pause in - match Brr.El.at !!"auto-next" pause with + match Brr.El.at !!"auto-continue" pause with | None -> Undoable.return () | Some _ -> let n = next ~mode window () in diff --git a/src/engine/runtime/table_of_content/table_of_content.ml b/src/engine/runtime/table_of_content/table_of_content.ml index 489e7678..b2fc1c97 100644 --- a/src/engine/runtime/table_of_content/table_of_content.ml +++ b/src/engine/runtime/table_of_content/table_of_content.ml @@ -60,11 +60,11 @@ let generate window root = [] |> List.rev |> List.concat in - let rec loop ~auto_next undo entries step categorized_els = + let rec loop ~auto_continue undo entries step categorized_els = match categorized_els with | `Title t :: res -> let entries = entry_title t :: entries in - loop ~auto_next undo entries step res + loop ~auto_continue undo entries step res | `Action a :: res -> if Step.Action_scheduler.is_action a then let* res = @@ -74,17 +74,18 @@ let generate window root = let> () = undo in Fut.return res in - let step = if auto_next then step else step + 1 in + let step = if auto_continue then step else step + 1 in let entries = - if auto_next then entries else entry_action window step :: entries + if auto_continue then entries + else entry_action window step :: entries in - let auto_next = Brr.El.at !!"auto-next" a |> Option.is_some in - loop ~auto_next undo entries step categorized_els - else loop ~auto_next undo entries step res + let auto_continue = Brr.El.at !!"auto-continue" a |> Option.is_some in + loop ~auto_continue undo entries step categorized_els + else loop ~auto_continue undo entries step res | [] -> Fut.return (undo, List.rev entries) in let* undo, entries = - loop ~auto_next:false (Undoable.return ()) [] 0 categorized_els + loop ~auto_continue:false (Undoable.return ()) [] 0 categorized_els in let* (), undo = undo in let+ () = undo () in diff --git a/test/compiler/auto-next.t/auto-next.md b/test/compiler/auto-next.t/auto-next.md index fdef8298..15c23cdb 100644 --- a/test/compiler/auto-next.t/auto-next.md +++ b/test/compiler/auto-next.t/auto-next.md @@ -4,7 +4,7 @@ a b -{pause auto-next} +{pause auto-continue} c