Beispiel #1
0
    def test_rst_quote_makes_quote_slide(self):
        document = make_document(
            'quoted',
            """\
.. slide:: Quotes
 :level: 2

   reStructuredText quotes are automatically converted

   -- The Sign Painter

""",
        )
        translator = SlideTranslator(
            self.builder,
            document,
        )

        document.walkabout(translator)

        self.assertEqual(
            translator.body,
            [
                u'\n<article class="admonition-quotes slide level-2">\n\n'
                '<h2>Quotes</h2>\n\n'
                '<q>\n'
                'reStructuredText quotes are automatically converted</q>\n'
                '<div class="author">\n'
                'The Sign Painter</div>'
                '\n\n\n\n\n</article>',
            ],
        )
    def test_rst_quote_processes_normally_with_extra_content(self):
        document = util.make_document(
            'quoted',
            """\
.. slide:: Indented RST
 :level: 2

   This text is over indented.

   As is this text.

   They look like quotes but they're not.

""",
        )
        translator = SlideTranslator(
            self.builder,
            document,
        )

        document.walkabout(translator)

        self.assertEqual(
            translator.body,
            [
                u'\n<article class="admonition-indented-rst slide level-2">\n\n'
                '<h2>Indented RST</h2>\n\n'
                '<blockquote>\n'
                '<div><p>This text is over indented.</p>\n'
                '<p>As is this text.</p>\n'
                '<p>They look like quotes but they\'re not.</p>\n'
                '</div></blockquote>\n'
                '\n\n\n\n</article>',
            ],
        )
Beispiel #3
0
    def test_slide_without_title(self):


        test_content = """
.. slide::

   Only Content Here

Another Paragraph
"""

        document = util.make_document(
            'slide_directive_test',
            test_content,
        )

        self.assertEqual(
            document[0].tagname,
            'slide',
        )
        self.assertEqual(len(document[0]), 1)

        self.assertEqual(
            document[1].tagname,
            'paragraph',
        )
Beispiel #4
0
    def test_filter_doctree(self, sphinx_app, status, warning):
        """Only slide related elements will be retained when filtering."""

        test_content = """

.. slideconf::
   :autoslides: False

Heading
=======

.. slide:: Heading

   Blarf

Second Level
------------

* Point 1
* Point 2

"""

        document = util.make_document(
            'slideconf_test',
            test_content,
        )

        directives.filter_doctree_for_slides(document)

        # only two elements remain -- the slideconf and slide element
        self.assertEqual(len(document.children), 2)
Beispiel #5
0
    def setUp(self):

        self.app = TestApp(
            buildername='slides',
            copy_srcdir_to_tmpdir=True,
            srcdir=util.test_root,
        )
        self.builder = SlideBuilder(self.app)
        self.document = util.make_document(
            'testing',
            """\
Slide Title
-----------

* Bullet 1
* Bullet 2

.. nextslide:: **Title**
   :classes: extra-class

Additional Text

""",
        )
        self.builder.init_templates()
Beispiel #6
0
    def test_slide_titles(self):
        document = make_document(
            'testing',
            """\
.. slide:: Slide Title

   Slide Content

""",
        )
        translator = SlideTranslator(
            self.builder,
            document,
        )

        document.walkabout(translator)

        self.assertEqual(
            translator.body,
            [
                u'\n<article class="admonition-slide-title slide level-1">\n\n'
                '<h1>Slide Title</h1>\n\n'
                '<p>Slide Content</p>\n\n\n\n\n</article>',
            ],
        )
    def test_rst_quote_processes_normally_with_extra_content(self):
        document = util.make_document(
            'quoted',
            """\
.. slide:: Indented RST
 :level: 2

   This text is over indented.

   As is this text.

   They look like quotes but they're not.

""",
        )
        translator = SlideTranslator(
            self.builder,
            document,
        )

        document.walkabout(translator)

        self.assertEqual(
            translator.body,
            [
                u'\n<article class="admonition-indented-rst slide level-2">\n\n'
                '<h2>Indented RST</h2>\n\n'
                '<blockquote>\n'
                '<div><p>This text is over indented.</p>\n'
                '<p>As is this text.</p>\n'
                '<p>They look like quotes but they\'re not.</p>\n'
                '</div></blockquote>\n'
                '\n\n\n\n</article>',
            ],
        )
Beispiel #8
0
    def setUp(self):

        self.app = TestApp(buildername='slides')
        self.builder = SlideBuilder(self.app)
        self.document = make_document(
            'testing',
            """\
Title
-----

.. image:: %s/_static/image.png

""" % (self.builder.outdir,),
        )

        self.image_node = self.document.traverse(nodes.image)[0]
        self.image_node.attributes['candidates'] = {
            '*': None,
        }
Beispiel #9
0
    def setUp(self):

        self.app = TestApp(buildername='slides')
        self.builder = SlideBuilder(self.app)
        self.document = make_document(
            'testing',
            """\
Slide ``Title``
---------------

* Bullet 1
* Bullet 2

""",
        )
        self.translator = BaseSlideTranslator(
            self.builder,
            self.document,
        )
        self.builder.init_templates()
    def setUp(self):

        self.app = TestApp(buildername='slides')
        self.builder = SlideBuilder(self.app)
        self.document = make_document(
            'testing',
            """\
Slide Title
-----------

* Bullet 1
* Bullet 2

.. nextslide:: **Title**
   :classes: extra-class

Additional Text

""",
        )
        self.builder.init_templates()
    def setUp(self):

        self.app = TestApp(buildername='slides')
        self.builder = SlideBuilder(self.app)
        self.document = make_document(
            'testing',
            """\
Slide Title
-----------

* Bullet 1
* Bullet 2

.. nextslide:: **Title**
   :classes: extra-class

Additional Text

""",
        )
        self.builder.init_templates()
Beispiel #12
0
    def test_slide(self):

        test_content = """
.. slide:: Heading

   Blarf
"""

        document = util.make_document(
            'slide_directive_test',
            test_content,
        )

        self.assertEqual(
            document[0][0][0].title(),
            u'Heading',
        )

        self.assertEqual(
            document[0][1][0].title(),
            u'Blarf',
        )
    def test_slide_without_content(self):

        test_content = """
.. slide:: Heading

Another Paragraph
"""

        document = make_document(
            'slide_directive_test',
            test_content,
        )

        self.assertEqual(
            document[0].tagname,
            'slide',
        )
        self.assertEqual(len(document[0]), 1)

        self.assertEqual(
            document[1].tagname,
            'paragraph',
        )
Beispiel #14
0
    def setUp(self):

        self.app = TestApp(
            buildername='slides',
            copy_srcdir_to_tmpdir=True,
            srcdir=util.test_root,
        )
        self.builder = self.app.builder
        self.document = util.make_document(
            'testing',
            """\
Slide ``Title``
---------------

* Bullet 1
* Bullet 2

""",
        )
        self.translator = BaseSlideTranslator(
            self.builder,
            self.document,
        )
Beispiel #15
0
    def setUp(self):

        self.app = TestApp(
            buildername='slides',
            copy_srcdir_to_tmpdir=True,
            srcdir=util.test_root,
        )
        self.builder = self.app.builder
        self.document = util.make_document(
            'testing',
            """\
Title
-----

.. image:: %s/_static/image.png

""" % (self.builder.outdir, ),
        )

        self.image_node = self.document.traverse(nodes.image)[0]
        self.image_node.attributes['candidates'] = {
            '*': None,
        }
Beispiel #16
0
    def setUp(self):

        self.app = TestApp(
            buildername='slides',
            copy_srcdir_to_tmpdir=True,
            srcdir=util.test_root,
        )
        self.builder = self.app.builder
        self.document = util.make_document(
            'testing',
            """\
Slide ``Title``
---------------

* Bullet 1
* Bullet 2

""",
        )
        self.translator = BaseSlideTranslator(
            self.builder,
            self.document,
        )
    def test_slide_without_content(self):

        test_content = """
.. slide:: Heading

Another Paragraph
"""

        document = make_document(
            'slide_directive_test',
            test_content,
        )

        self.assertEqual(
            document[0].tagname,
            'slide',
        )
        self.assertEqual(len(document[0]), 1)

        self.assertEqual(
            document[1].tagname,
            'paragraph',
        )
Beispiel #18
0
    def test_non_section_titles_rendered_normally(self):
        document = make_document(
            'testing',
            """\
Section Title
-------------

Some Text

.. note:: Take note!

Another paragraph

""",
        )
        translator = SlideTranslator(
            self.builder,
            document,
        )

        document.walkabout(translator)

        self.assertEqual(
            translator.body,
            [
                u'\n<article class="slide level-1" id="section-title">\n\n'
                '<h1>Section Title</h1>\n\n'
                '<p>Some Text</p>\n'
                '<div class="admonition note">\n'
                '<p class="first admonition-title">Note</p>\n'
                '<p class="last">Take note!</p>\n'
                '</div>\n'
                '<p>Another paragraph</p>'
                '\n\n\n\n\n</article>',
            ],
        )