From dcc3de6b3f1f7af5439e9c4f26c5a4e06081279c Mon Sep 17 00:00:00 2001 From: franz haas Date: Mon, 5 Feb 2024 18:57:03 +0100 Subject: [PATCH 1/3] - made aspect ratio of reveal slides configureable.. --- nbconvert/exporters/slides.py | 18 ++++++++++++++++++ share/templates/reveal/index.html.j2 | 7 ++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/nbconvert/exporters/slides.py b/nbconvert/exporters/slides.py index dacc2aaba..65b466533 100644 --- a/nbconvert/exporters/slides.py +++ b/nbconvert/exporters/slides.py @@ -168,6 +168,24 @@ def _reveal_url_prefix_default(self): """, ).tag(config=True) + reveal_width = Unicode( + "", + help=""" + width used to determine the aspect ratio of your presentation. + Use the horizontal pixels available on your inteded presentation + equpment. + """, + ).tag(config=True) + + reveal_height = Unicode( + "", + help=""" + height used to determine the aspect ratio of your presentation. + Use the horizontal pixels available on your inteded presentation + equpment. + """, + ).tag(config=True) + font_awesome_url = Unicode( "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css", help=""" diff --git a/share/templates/reveal/index.html.j2 b/share/templates/reveal/index.html.j2 index 26fed48c4..b4f5ae6fc 100644 --- a/share/templates/reveal/index.html.j2 +++ b/share/templates/reveal/index.html.j2 @@ -6,6 +6,8 @@ {% set reveal_theme = resources.reveal.theme | default('white', true) %} {% set reveal_transition = resources.reveal.transition | default('slide', true) %} {% set reveal_number = resources.reveal.number | default('', true) %} +{% set reveal_width = resources.reveal.width | default('960', true) %} +{% set reveal_height = resources.reveal.height | default('700', true) %} {% set reveal_scroll = resources.reveal.scroll | default(false, true) | json_dumps %} {%- block header -%} @@ -154,7 +156,10 @@ require( history: true, transition: "{{reveal_transition}}", slideNumber: "{{reveal_number}}", - plugins: [RevealNotes] + plugins: [RevealNotes], + width: {{reveal_width}}, + height: {{reveal_height}}, + }); var update = function(event){ From 1bea74ee6f9d92251f3c1fd4abba2cc61188398f Mon Sep 17 00:00:00 2001 From: franz haas Date: Mon, 5 Feb 2024 19:30:36 +0100 Subject: [PATCH 2/3] missing assignment --- nbconvert/exporters/slides.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nbconvert/exporters/slides.py b/nbconvert/exporters/slides.py index 65b466533..cba2610d2 100644 --- a/nbconvert/exporters/slides.py +++ b/nbconvert/exporters/slides.py @@ -204,4 +204,6 @@ def _init_resources(self, resources): resources["reveal"]["transition"] = self.reveal_transition resources["reveal"]["scroll"] = self.reveal_scroll resources["reveal"]["number"] = self.reveal_number + resources["reveal"]["height"] = self.reveal_height + resources["reveal"]["width"] = self.reveal_width return resources From bae556a34070980f3238b7fd32379cc99986ed70 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 18:52:14 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CHANGELOG.md | 1 + nbconvert/exporters/slides.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb7ec57f0..c38a87d48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1483,6 +1483,7 @@ raw template {%- endblock in_prompt -%} """ + exporter_attr = AttrExporter() output_attr, _ = exporter_attr.from_notebook_node(nb) assert "raw template" in output_attr diff --git a/nbconvert/exporters/slides.py b/nbconvert/exporters/slides.py index cba2610d2..6ae538ce8 100644 --- a/nbconvert/exporters/slides.py +++ b/nbconvert/exporters/slides.py @@ -171,7 +171,7 @@ def _reveal_url_prefix_default(self): reveal_width = Unicode( "", help=""" - width used to determine the aspect ratio of your presentation. + width used to determine the aspect ratio of your presentation. Use the horizontal pixels available on your inteded presentation equpment. """, @@ -180,7 +180,7 @@ def _reveal_url_prefix_default(self): reveal_height = Unicode( "", help=""" - height used to determine the aspect ratio of your presentation. + height used to determine the aspect ratio of your presentation. Use the horizontal pixels available on your inteded presentation equpment. """,