Skip to content

Add the "sbase mkpres" console script for making HTML presentations #798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 29, 2021

Conversation

mdmintz
Copy link
Member

@mdmintz mdmintz commented Jan 29, 2021

Add the sbase mkpres FILE.py console script for making HTML presentations.


mkpres

  • Usage:
    sbase mkpres [FILE.py] [LANGUAGE OPTIONS]

  • Example:
    sbase mkpres new_presentation.py

  • Language Options:
    --en / --English | --zh / --Chinese
    --nl / --Dutch | --fr / --French
    --it / --Italian | --ja / --Japanese
    --ko / --Korean | --pt / --Portuguese
    --ru / --Russian | --es / --Spanish

  • Output:
    Creates a new presentation with 3 example slides.
    If the file already exists, an error is raised.
    By default, the slides are written in English.
    Slides use "serif" theme & "fade" transition.
    This code can be used as a base boilerplate.


💠 Here's an example of a presentation that was created by that:

from seleniumbase import BaseCase


class MyTestClass(BaseCase):

    def test_presentation(self):
        self.create_presentation(theme="serif", transition="fade")
        self.add_slide(
            '<h1>Hello</h1><br />'
            '<img src="https://seleniumbase.io/cdn/img/sb6.png">')
        self.add_slide("<h2><b>*</b>  Update Text  <b>*</b></h2>")
        self.add_slide("<h2>Goodbye</h2><p>Use SeleniumBase!</p>")
        self.begin_presentation(filename="my_presentation_1.html")

💠 When run with pytest, the above Python code translates to the following HTML:

<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html, charset=utf-8;">
<meta name="viewport" content="shrink-to-fit=no">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.8.0/css/reveal.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.8.0/css/theme/serif.min.css">
<style>
pre{background-color:#fbe8d4;border-radius:8px;}
div[flex_div]{height:68vh;margin:0;align-items:center;justify-content:center;}
img[rounded]{border-radius:16px;max-width:64%;}
</style>
</head>

<body>
<!-- Generated by SeleniumBase - https://seleniumbase.io -->
<div class="reveal">
<div class="slides">

<section data-transition="fade">
<h1>Hello</h1><br /><img src="https://seleniumbase.io/cdn/img/sb6.png">
<aside class="notes"></aside>
</section>

<section data-transition="fade">
<h2><b>*</b>  Update Text  <b>*</b></h2>
<aside class="notes"></aside>
</section>

<section data-transition="fade">
<h2>Goodbye</h2><p>Use SeleniumBase!</p>
<aside class="notes"></aside>
</section>

<section data-transition="none">
<p class="End_Presentation_Now"> </p>
</section>

</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.8.0/js/reveal.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
<script>Reveal.initialize({showNotes: false, slideNumber: true, hash: false, autoSlide: 0.0,});</script>
</body>
</html>

  • Also refresh Python dependencies:
    -- rich==9.10.0;python_version>="3.6"

@mdmintz mdmintz merged commit 4d3d43e into master Jan 29, 2021
@mdmintz mdmintz deleted the add-sbase-mkpres-script branch January 29, 2021 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant