How to use the feincms3.incubator.subrenderer.Subrenderer function in feincms3

To help you get started, we’ve selected a few feincms3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matthiask / feincms3 / tests / testapp / test_subrenderer.py View on Github external
subrenderer = ""


class File(SimpleNamespace):
    pass


class TeaserRenderer(Subrenderer):
    def enter(self, **kwargs):
        yield '<div class="teasers">'

    def exit(self, **kwargs):
        yield "</div>"


class FAQRenderer(Subrenderer):
    def enter(self, **kwargs):
        yield '<div class="faq">'

    def exit(self, **kwargs):
        yield "</div>"


teaser_renderer = TeaserRenderer()
teaser_renderer.register_string_renderer(Teaser, lambda plugin: plugin.text)
teaser_renderer.register_string_renderer(Command, "")

faq_renderer = FAQRenderer()
faq_renderer.register_string_renderer(FAQ, lambda plugin: plugin.text)
faq_renderer.register_string_renderer(Command, "")
faq_renderer.register_string_renderer(File, lambda plugin: plugin.text)
github matthiask / feincms3 / tests / testapp / test_subrenderer.py View on Github external
def test_continue_subrenderer(self):
        class ContinueSubrenderer(Subrenderer):
            def enter(self, **kwargs):
                yield '<div class="stuff">'

            def exit(self, **kwargs):
                yield "</div>"

            def reenter(self, **kwargs):
                yield from self.exit(**kwargs)
                yield from self.enter(**kwargs)

        continue_subrenderer = ContinueSubrenderer()
        continue_subrenderer.register_string_renderer(Text, lambda plugin: plugin.text)
        continue_subrenderer.register_string_renderer(Command, "")

        class RegionsWithContinue(SubrendererRegions):
            subrenderers = {"continue": continue_subrenderer}
github matthiask / feincms3 / tests / testapp / test_subrenderer.py View on Github external
subrenderer = "teasers"


class FAQ(SimpleNamespace):
    subrenderer = "faq"


class Command(SimpleNamespace):
    subrenderer = ""


class File(SimpleNamespace):
    pass


class TeaserRenderer(Subrenderer):
    def enter(self, **kwargs):
        yield '<div class="teasers">'

    def exit(self, **kwargs):
        yield "</div>"


class FAQRenderer(Subrenderer):
    def enter(self, **kwargs):
        yield '<div class="faq">'

    def exit(self, **kwargs):
        yield "</div>"


teaser_renderer = TeaserRenderer()