当前位置: 首页>>代码示例>>Python>>正文


Python Builder.write方法代码示例

本文整理汇总了Python中builder.Builder.write方法的典型用法代码示例。如果您正苦于以下问题:Python Builder.write方法的具体用法?Python Builder.write怎么用?Python Builder.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在builder.Builder的用法示例。


在下文中一共展示了Builder.write方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1:

# 需要导入模块: from builder import Builder [as 别名]
# 或者: from builder.Builder import write [as 别名]
builder.write(
    [
        {
            "template": "header.html",
            "options": {
                "intro": "This is the introduction which will appear first thing after the subject line",
                "logo_image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/4/2015/10/29033923/skio-logo-white.png",
                "logo_alt": "Skio Music",
                "tagline": "Discover Music, Build Contracts and Find Collaborators",
            },
        },
        {
            "template": "hero.html",
            "options": {
                "image": "http://s13.postimg.org/onrn1n72f/big_hero1.png",
                "title": "The best product ever made",
                "button": "Go",
            },
        },
        {
            "template": "news.html",
            "options": {
                "articles": [
                    {
                        "image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/3/2015/09/29200035/SKIO-Music_Biking_Burning_Man_edited.jpg",
                        "button": "button",
                        "title": "Test",
                        "content": "If the application enables the Loop Controls, its possible to use break and continue in loops. When break is reached, the loop is terminated; if continue is reached, the processing is stopped and continues with the next iteration.",
                    },
                    {
                        "image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/3/2015/09/29200035/SKIO-Music_Biking_Burning_Man_edited.jpg",
                        "button": "button",
                        "title": "Test",
                        "content": "If the application enables the Loop Controls, its possible to use break and continue in loops. When break is reached, the loop is terminated; if continue is reached, the processing is stopped and continues with the next iteration.",
                    },
                    {
                        "image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/3/2015/09/29200035/SKIO-Music_Biking_Burning_Man_edited.jpg",
                        "button": "button",
                        "title": "Test",
                        "content": "If the application enables the Loop Controls, its possible to use break and continue in loops. When break is reached, the loop is terminated; if continue is reached, the processing is stopped and continues with the next iteration.",
                    },
                ]
            },
        },
        {
            "template": "notifications.html",
            "options": {
                "notifications": [
                    {
                        "image": "http://www.myiconfinder.com/uploads/iconsets/256-256-64273d52c282e3b26d2d0968d08b9d8d.png",
                        "subtitle": "Jan 4 2015",
                        "title": "Event Name",
                        "content": "This is a notification about something happening at a certain time.",
                    },
                    {
                        "image": "http://www.myiconfinder.com/uploads/iconsets/256-256-64273d52c282e3b26d2d0968d08b9d8d.png",
                        "subtitle": "Jan 4 2015",
                        "title": "Event Name",
                        "content": "This is a notification about something happening at a certain time.",
                    },
                    {
                        "image": "http://www.myiconfinder.com/uploads/iconsets/256-256-64273d52c282e3b26d2d0968d08b9d8d.png",
                        "subtitle": "Jan 4 2015",
                        "title": "Event Name",
                        "content": "This is a notification about something happening at a certain time.",
                    },
                ]
            },
        },
        {
            "template": "footer.html",
            "options": {
                "links": [
                    {
                        "url": "#",
                        "image": "http://icons.iconarchive.com/icons/brainleaf/round-social/128/youtube-icon.png",
                    },
                    {
                        "url": "#",
                        "image": "http://icons.iconarchive.com/icons/brainleaf/round-social/128/facebook-icon.png",
                    },
                ]
            },
        },
    ]
)
开发者ID:ColDog,项目名称:email-templates,代码行数:88,代码来源:newsletter.py

示例2:

# 需要导入模块: from builder import Builder [as 别名]
# 或者: from builder.Builder import write [as 别名]
builder.write([
    {
        'template': 'header.html',
        'options': {
            'intro': 'This is the introduction which will appear first thing after the subject line',
            'logo_image': 'https://cms-media.skiomusic.com/wp-content/uploads/sites/4/2015/10/29033923/skio-logo-white.png',
            'logo_alt': 'Skio Music',
            'tagline': 'Discover Music, Build Contracts and Find Collaborators'
        }
    },
    {
        'template': 'panel.html',
        'options': {
            'title': 'Thank You For Signing Up!',
            'content': """
            Hello Person,
            This is an announcement made inside a panel.
            Here is where you would tell people about what you can do for them.
            """,
            'button': 'Check it out',
        }
    },
    {
        'template': 'panel.html',
        'options': {
            'title': 'Need Help?',
            'content': """
            Our help section can help you with anything and everything.
            """,
            'button': 'Get Help',
        }
    },
    {
        'template': 'footer.html',
        'options': {
            'links': [
                {'url': '#', 'image': 'http://icons.iconarchive.com/icons/brainleaf/round-social/128/youtube-icon.png'},
                {'url': '#', 'image': 'http://icons.iconarchive.com/icons/brainleaf/round-social/128/facebook-icon.png'},
            ]
        }
    },
])
开发者ID:ColDog,项目名称:email-templates,代码行数:44,代码来源:panel.py

示例3:

# 需要导入模块: from builder import Builder [as 别名]
# 或者: from builder.Builder import write [as 别名]
builder.write([
    {
        'template': 'header.html',
        'options': {
            'intro': 'This is the introduction which will appear first thing after the subject line',
            'logo_image': 'https://cms-media.skiomusic.com/wp-content/uploads/sites/4/2015/10/29033923/skio-logo-white.png',
            'logo_alt': 'Skio Music',
            'tagline': 'Discover Music, Build Contracts and Find Collaborators'
        }
    },
    {
        'template': 'articles.html',
        'options': {
            'articles': [
                {'image': 'https://cdn0.iconfinder.com/data/icons/superuser-web-kit/512/686909-user_people_man_human_head_person-512.png', 'title': 'Test', 'content': 'Someone has done something.'},
                {'image': 'https://cdn0.iconfinder.com/data/icons/superuser-web-kit/512/686909-user_people_man_human_head_person-512.png', 'title': 'Test', 'content': 'Someone has done something.'},
                {'image': 'https://cdn0.iconfinder.com/data/icons/superuser-web-kit/512/686909-user_people_man_human_head_person-512.png', 'title': 'Test', 'content': 'Someone has done something.'},
                {'image': 'https://cdn0.iconfinder.com/data/icons/superuser-web-kit/512/686909-user_people_man_human_head_person-512.png', 'title': 'Test', 'content': 'Someone has done something.'},
                {'image': 'https://cdn0.iconfinder.com/data/icons/superuser-web-kit/512/686909-user_people_man_human_head_person-512.png', 'title': 'Test', 'content': 'Someone has done something.'},
                {'image': 'https://cdn0.iconfinder.com/data/icons/superuser-web-kit/512/686909-user_people_man_human_head_person-512.png', 'title': 'Test', 'content': 'Someone has done something.'},
            ]
        }
    },
    {
        'template': 'footer.html',
        'options': {
            'links': [
                {'url': '#', 'image': 'http://icons.iconarchive.com/icons/brainleaf/round-social/128/youtube-icon.png'},
                {'url': '#', 'image': 'http://icons.iconarchive.com/icons/brainleaf/round-social/128/facebook-icon.png'},
            ]
        }
    },
])
开发者ID:ColDog,项目名称:email-templates,代码行数:35,代码来源:articles.py

示例4: Builder

# 需要导入模块: from builder import Builder [as 别名]
# 或者: from builder.Builder import write [as 别名]
from builder import Builder

builder = Builder('dark-hero.html')

builder.write([
    {
        'template': 'dark-hero.html',
        'options': {
            'image': 'http://s30.postimg.org/4h73cnl7l/hero.png',
            'title': 'Freedom to Create',
            'content': """
                Dear customer,
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed varius, leo a ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a est.
                Sed varius, leo a ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a est. Aenean at mollis ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed varius, leo a ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a est.
                Sincerely,<br>Colin Walker
            """
        }
    }
])
开发者ID:ColDog,项目名称:email-templates,代码行数:21,代码来源:dark-hero.py

示例5:

# 需要导入模块: from builder import Builder [as 别名]
# 或者: from builder.Builder import write [as 别名]
builder.write(
    {
        "title": "Title",
        "intro": "This is the introduction which will appear first thing after the subject line",
        "elements": [
            {
                "template": "header.html",
                "options": {
                    "intro": "This is the introduction which will appear first thing after the subject line",
                    "logo_image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/4/2015/10/29033923/skio-logo-white.png",
                    "logo_alt": "Skio Music",
                    "tagline": "Discover Music, Build Contracts and Find Collaborators",
                },
            },
            {
                "template": "panel.html",
                "options": {
                    "title": "This is a cool panel",
                    "content": """
                Hello Everyone,

                This is an announcement made inside a panel.
                """,
                    "button": "Check it out",
                },
            },
            {
                "template": "header.html",
                "options": {
                    "intro": "This is the first line that will show up right after the subject.",
                    "logo_image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/4/2015/10/29033923/skio-logo-white.png",
                    "logo_alt": "Skio Music",
                },
            },
            {
                "template": "dark-hero.html",
                "options": {
                    "image": "http://s30.postimg.org/4h73cnl7l/hero.png",
                    "title": "Freedom to Create",
                    "content": """
                    Dear customer,
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed varius, leo a ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a est.
                    Sed varius, leo a ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a est. Aenean at mollis ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed varius, leo a ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a est.
                    Sincerely,<br>Colin Walker
                """,
                },
            },
            {
                "template": "full-hero.html",
                "options": {
                    "image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/3/2015/09/29200035/SKIO-Music_Biking_Burning_Man_edited.jpg"
                },
            },
            {
                "template": "announcement.html",
                "options": {
                    "image": "https://cdn.tutsplus.com/webdesign/uploads/legacy/tuts/341_wf/tool-balsamiq.png",
                    "title": "The best product ever made",
                },
            },
            {
                "template": "letter.html",
                "options": {
                    "content": """
                        Dear customer,
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed varius, leo a ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a est.
                        Sed varius, leo a ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a est. Aenean at mollis ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed varius, leo a ullamcorper feugiat, ante purus sodales justo, a faucibus libero lacus a est.
                        Sincerely,<br>Colin Walker
                    """
                },
            },
            {
                "template": "notifications.html",
                "options": {
                    "notifications": [
                        {
                            "image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/3/2015/09/29200035/SKIO-Music_Biking_Burning_Man_edited.jpg",
                            "title": "Test",
                            "content": "If the application enables the Loop Controls, its possible to use break and continue in loops. When break is reached, the loop is terminated.",
                        },
                        {
                            "image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/3/2015/09/29200035/SKIO-Music_Biking_Burning_Man_edited.jpg",
                            "title": "Test",
                            "content": "If the application enables the Loop Controls, its possible to use break and continue in loops. When break is reached, the loop is terminated.",
                        },
                        {
                            "image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/3/2015/09/29200035/SKIO-Music_Biking_Burning_Man_edited.jpg",
                            "title": "Test",
                            "content": "If the application enables the Loop Controls, its possible to use break and continue in loops. When break is reached, the loop is terminated.",
                        },
                    ]
                },
            },
            {
                "template": "hero.html",
                "options": {
                    "image": "https://cms-media.skiomusic.com/wp-content/uploads/sites/3/2015/09/29200035/SKIO-Music_Biking_Burning_Man_edited.jpg",
                    "alt": "hero-image",
                    "title": "This is a really cool title",
                    "caption": "This is a caption",
#.........这里部分代码省略.........
开发者ID:ColDog,项目名称:email-templates,代码行数:103,代码来源:kitchen-sink.py

示例6:

# 需要导入模块: from builder import Builder [as 别名]
# 或者: from builder.Builder import write [as 别名]
builder.write([
    {
        'template': 'header.html',
        'options': {
            'intro': 'This is the introduction which will appear first thing after the subject line',
            'logo_image': 'https://cms-media.skiomusic.com/wp-content/uploads/sites/4/2015/10/29033923/skio-logo-white.png',
            'logo_alt': 'Skio Music',
            'tagline': 'Discover Music, Build Contracts and Find Collaborators'
        }
    },
    {
        'template': 'receipt.html',
        'options': {
            'title': 'Thank You For Your Purchase',
            'description': 'This is an official reciept from SKIO Music',
            'total': '$ 1,000,000',
            'order': [
                {'name': 'Milk', 'price': '$ 11.00'},
                {'name': 'Milk', 'price': '$ 11.00'},
                {'name': 'Milk', 'price': '$ 11.00'},
                {'name': 'Milk', 'price': '$ 11.00'},
            ]
        }
    },
    {
        'template': 'footer.html',
        'options': {
            'links': [
                {'url': '#', 'image': 'http://icons.iconarchive.com/icons/brainleaf/round-social/128/youtube-icon.png'},
                {'url': '#', 'image': 'http://icons.iconarchive.com/icons/brainleaf/round-social/128/facebook-icon.png'},
            ]
        }
    },
])
开发者ID:ColDog,项目名称:email-templates,代码行数:36,代码来源:receipt.py


注:本文中的builder.Builder.write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。