How to use the premailer.__main__.main function in premailer

To help you get started, we’ve selected a few premailer 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 peterbe / premailer / premailer / test_premailer.py View on Github external
def test_command_line_fileinput_from_argument(self):
        with captured_output() as (out, err):
            main([
                '-f',
                'premailer/test-apple-newsletter.html',
                '--disable-basic-attributes=bgcolor'
            ])

        result_html = out.getvalue().strip()

        ok_('' in result_html)
        ok_('<style media="only screen and (max-device-width: 480px)">\n'
            '* {line-height: normal !important; -webkit-text-size-adjust: 125%}\n'
            '</style>' in result_html)
github peterbe / premailer / premailer / test_premailer.py View on Github external
def test_command_line_fileinput_from_stdin(self):
        html = '<style>h1 { color:red; }</style><h1>Title</h1>'
        expect_html = """
        
        
        <h1 style="color:red">Title</h1>
        
        """

        with provide_input(html) as (out, err):
            main([])
        result_html = out.getvalue().strip()

        compare_html(expect_html, result_html)
github peterbe / premailer / premailer / test_premailer.py View on Github external
<style type="text/css">
        p {font-size:12px;}
        </style>
        
        
        <p style="font-size:12px">html</p>
        
        
        """

        compare_html(expect_html, result_html)

        # for completeness, test it once without
        with captured_output() as (out, err):
            main([
                '-f',
                'premailer/test-issue78.html',
            ])

        result_html = out.getvalue().strip()
        expect_html = """
        
        
        
        
        <p style="font-size:12px">html</p>
        
        
        """

        compare_html(expect_html, result_html)