diff --git a/.github/workflows/test_examples.yml b/.github/workflows/test_examples.yml index cef6e86..ec045fb 100644 --- a/.github/workflows/test_examples.yml +++ b/.github/workflows/test_examples.yml @@ -13,6 +13,7 @@ env: jobs: build-examples: strategy: + fail-fast: false matrix: manim: [manim, manimgl] os: [macos-latest, ubuntu-latest, windows-latest] @@ -27,7 +28,10 @@ jobs: # https://github.com/3b1b/manim/issues/1808 - manim: manimgl pyversion: '3.7' - # We only test Python 3.10 on Windows and MacOS + # manimgl seems to have problems with Python 3.11 + - manim: manimgl + pyversion: '3.11' + # We only test Python 3.11 on Windows and MacOS - os: windows-latest pyversion: '3.7' - os: windows-latest @@ -36,6 +40,7 @@ jobs: pyversion: '3.9' - os: windows-latest pyversion: '3.10' + manim: manim - os: macos-latest pyversion: '3.7' - os: macos-latest @@ -44,6 +49,7 @@ jobs: pyversion: '3.9' - os: macos-latest pyversion: '3.10' + manim: manim runs-on: ${{ matrix.os }} steps: - name: Checkout repository @@ -96,13 +102,16 @@ jobs: run: python -m manim -ql example.py Example ThreeDExample ConvertExample - name: Build slides with manimgl on Ubuntu if: matrix.manim == 'manimgl' && matrix.os == 'ubuntu-latest' - run: xvfb-run -a -s "-screen 0 1400x900x24" manim-render -l example.py Example ThreeDExample ConvertExample + run: xvfb-run -a -s "-screen 0 1400x900x24" manim-render -l example.py Example ThreeDExample - name: Build slides with manimgl on MacOS or Windows if: matrix.manim == 'manimgl' && (matrix.os == 'macos-latest' || matrix.os == 'windows-latest') - run: manimgl -l example.py Example ThreeDExample ConvertExample + run: manimgl -l example.py Example ThreeDExample - name: Test slides on Ubuntu if: matrix.os == 'ubuntu-latest' - run: xvfb-run -a -s "-screen 0 1400x900x24" manim-slides Example ThreeDExample ConvertExample --skip-all + run: xvfb-run -a -s "-screen 0 1400x900x24" manim-slides Example ThreeDExample --skip-all - name: Test slides on MacOS or Windows if: matrix.os == 'macos-latest' || matrix.os == 'windows-latest' - run: manim-slides Example ThreeDExample ConvertExample --skip-all + run: manim-slides Example ThreeDExample --skip-all + - name: Test convert on Ubuntu + if: matrix.os == 'ubuntu-latest' && matrix.manim == 'manim' + run: manim-slides convert --to=html ConvertExample index.html diff --git a/example.py b/example.py index a9a019f..deb4c87 100644 --- a/example.py +++ b/example.py @@ -43,6 +43,8 @@ class Example(Slide): class ConvertExample(Slide): + """WARNING: this example does not seem to work with ManimGL.""" + def tinywait(self): self.wait(0.1) diff --git a/manim_slides/convert.py b/manim_slides/convert.py index 1b15e50..2b2a29c 100644 --- a/manim_slides/convert.py +++ b/manim_slides/convert.py @@ -4,12 +4,12 @@ from enum import Enum from typing import Any, Callable, Dict, Generator, List, Type import click +import pkg_resources from click import Context, Parameter from pydantic import BaseModel from .commons import folder_path_option, verbosity_option from .config import PresentationConfig -from .defaults import REVEALJS_TEMPLATE from .present import get_scenes_presentation_config @@ -99,7 +99,14 @@ class RevealJS(Converter): else: yield f'' + def load_template(self) -> str: + """Returns the RevealJS HTML template as a string.""" + return pkg_resources.resource_string( + __name__, "data/revealjs_template.html" + ).decode() + def convert_to(self, dest: str): + """Converts this configuration into a RevealJS HTML presentation, saved to DEST.""" dirname = os.path.dirname(dest) basename, ext = os.path.splitext(os.path.basename(dest)) @@ -117,7 +124,8 @@ class RevealJS(Converter): sections = "".join(self.get_sections_iter()) - content = REVEALJS_TEMPLATE.format(sections=sections, **self.dict()) + revealjs_template = self.load_template() + content = revealjs_template.format(sections=sections, **self.dict()) f.write(content) diff --git a/manim_slides/data/revealjs_template.html b/manim_slides/data/revealjs_template.html new file mode 100644 index 0000000..b1c155e --- /dev/null +++ b/manim_slides/data/revealjs_template.html @@ -0,0 +1,185 @@ + + + +
+ + + +