Exemplo n.º 1
0
 def make(self, root=None):
     u"""The instance of this class builds CSS and HTML files at the optional path *root*.
     If not defined, then @Builder.C.DEFAULT_ROOTPATH@ is used, as in general builders 
     are associated where output should go to. 
     E.g. the default @HtmlBuilder.C.DEFAULT_ROOTPATH@ is defined as to the user extended 
     path of @~/Desktop/Xierpa3Examples/[component.name]@.
     And for @CssBuilder@ it is @~/Desktop/Xierpa3Examples/[component.name]/css/style.css@."""
     if root is None:
         root = TX.asDir(self.C.PATH_EXAMPLES) # Expand user path to full directory path.
     # C S S
     # Create the main CSS builder instance to build the CSS part of the site.
     cssBuilder = CssBuilder()
     # Compile (=build) the SCSS to CSS.
     self.build(cssBuilder) 
     # Save the file in "css/style.css".
     cssBuilder.save(self, root=root) 
 
     # H T M L
     # Create the main HTML builder instance to build the HTML part of the site.
     htmlBuilder = HtmlBuilder()
     # Compile the site instance and its components into HTML code.
     self.build(htmlBuilder) 
     # Save the resulting HTML file in "helloWorld.html"
     # Answer the file path, so we can directly open the file with a browser.
     return htmlBuilder.save(self, root=root)  
Exemplo n.º 2
0
    def make(self, root=None):
        u"""The instance of this class builds CSS and HTML files at the optional path **root**.
        If not defined, then the default ~/Desktop/Xierpa3Examples/[component.name] is used as export path,
        as set by Builder.DEFAULT_ROOTPATH"""
        # Create an "instance" (=object) of type "HelloWorldLayout". The type (=class) defines
        # the behavior of the object that is made by calling the class.

        # C S S
        # Create the main CSS builder instance to build the SASS/CSS part of the site.
        cssBuilder = CssBuilder()
        # Compile (=build) the SCSS to CSS and save the file in "css/style.css".
        self.build(
            cssBuilder
        )  # Build from entire site theme, not just from template. Result is stream in builder.
        cssBuilder.save(self, root)

        # H T M L
        # Create the main HTML builder instance to build the HTML part of the site.
        htmlBuilder = HtmlBuilder()
        # Compile the HTML and save the resulting HTML file in "helloWorld.html".
        self.build(
            htmlBuilder
        )  # Build from entire site theme, not just from template. Result is stream in builder.
        # Answer the path, so we can directly open the file with a browser.
        return htmlBuilder.save(self, root)
Exemplo n.º 3
0
 def make(self, root=None):
     u"""The instance of this class builds CSS and HTML files at the optional path **root**.
     If not defined, then the default ~/Desktop/Xierpa3Examples/[component.name] is used as export path,
     as set by Builder.DEFAULT_ROOTPATH"""
     cssBuilder = CssBuilder()
     self.build(cssBuilder)
     cssBuilder.save(self, root)
     htmlBuilder = HtmlBuilder()
     self.build(htmlBuilder)
     return htmlBuilder.save(self, root)
Exemplo n.º 4
0
 def make(self, root=None):
     u"""The instance of this class builds CSS and HTML files at the optional path <b>root</b>.
     If not defined, then the default ~/Desktop/Xierpa3Examples/[component.name] is used as export path,
     as set by Builder.DEFAULT_ROOTPATH"""
     cssBuilder = CssBuilder()
     self.build(cssBuilder)
     cssBuilder.save(self, root)
     htmlBuilder = HtmlBuilder()
     self.build(htmlBuilder)
     return htmlBuilder.save(self, root)
Exemplo n.º 5
0
 def make(self, root):
     u"""The instance of this class builds the HTML file at the optional path *root*.
     If not defined, then @Builder.C.DEFAULT_ROOTPATH@ is used, as in general builders 
     are associated where output should go to. 
     E.g. the default @HtmlBuilder.C.DEFAULT_ROOTPATH@ is defined as to the user extended 
     path of @~/Desktop/Xierpa3Examples/[component.name]@.
     And for @CssBuilder@ it is @~/Desktop/Xierpa3Examples/[component.name]/css/style.css@."""    
     # H T M L
     # Create the main HTML builder instance to build the HTML part of the site.
     htmlBuilder = HtmlBuilder()
     # Compile the site instance and its components into HTML code.
     self.build(htmlBuilder) 
     # Save the resulting HTML file in "index.html"
     # Answer the file path, so we can directly open the file with a browser.
     return htmlBuilder.save(self, path=root + 'index.html')  
Exemplo n.º 6
0
 def make(self, root):
     u"""The instance of this class builds the HTML file at the optional path *root*.
     If not defined, then @Builder.C.DEFAULT_ROOTPATH@ is used, as in general builders 
     are associated where output should go to. 
     E.g. the default @HtmlBuilder.C.DEFAULT_ROOTPATH@ is defined as to the user extended 
     path of @~/Desktop/Xierpa3Examples/[component.name]@.
     And for @CssBuilder@ it is @~/Desktop/Xierpa3Examples/[component.name]/css/style.css@."""    
     # H T M L
     # Create the main HTML builder instance to build the HTML part of the site.
     htmlBuilder = HtmlBuilder()
     # Compile the site instance and its components into HTML code.
     self.build(htmlBuilder) 
     # Save the resulting HTML file in "index.html"
     # Answer the file path, so we can directly open the file with a browser.
     return htmlBuilder.save(self, path=root + 'index.html')  
Exemplo n.º 7
0
    def make(self):
        u"""Make the instance of this class to build CSS and HTML."""
        # Create an "instance" (=object) of type "HelloWorld". The type (=class) defines
        # the behavior of the object that is made by calling the class.

        # C S S
        # Create the main CSS builder instance to build the CSS part of the site.
        cssBuilder = CssBuilder()
        # Compile (=build) the SCSS to CSS and save the file in "css/style.css".
        cssBuilder.save(self) 
    
        # H T M L
        # Create the main HTML builder instance to build the HTML part of the site.
        htmlBuilder = HtmlBuilder()
        # Compile the HTML and save the resulting HTML file in "helloWorld.html".
        # Answer the path, so we can open the file with a browser.
        return htmlBuilder.save(self)  
Exemplo n.º 8
0
    def make(self):
        u"""Make the instance of this class to build CSS and HTML."""
        # Create an "instance" (=object) of type "HelloWorldLayout". The type (=class) defines
        # the behavior of the object that is made by calling the class.

        # C S S
        # Create the main CSS builder instance to build the CSS part of the site.
        cssBuilder = CssBuilder()
        # Compile (=build) the SCSS to CSS and save the file in "css/style.css".
        cssBuilder.save(self) 
    
        # H T M L
        # Create the main HTML builder instance to build the HTML part of the site.
        htmlBuilder = HtmlBuilder()
        # Compile the HTML and save the resulting HTML file in "helloWorld.html".
        # Answer the path, so we can open the file with a browser.
        return htmlBuilder.save(self)  
Exemplo n.º 9
0
    def make(self, root=None):
        u"""The instance of this class builds CSS and HTML files at the optional path <b>root</b>.
        If not defined, then the default ~/Desktop/Xierpa3Examples/[component.name] is used as export path,
        as set by Builder.DEFAULT_ROOTPATH"""
        # Create an "instance" (=object) of type "HelloWorldLayout". The type (=class) defines
        # the behavior of the object that is made by calling the class.

        # C S S
        # Create the main CSS builder instance to build the SASS/CSS part of the site.
        cssBuilder = CssBuilder()
        # Compile (=build) the SCSS to CSS and save the file in "css/style.css".
        self.build(cssBuilder) # Build from entire site theme, not just from template. Result is stream in builder.
        cssBuilder.save(self, root) 
    
        # H T M L
        # Create the main HTML builder instance to build the HTML part of the site.
        htmlBuilder = HtmlBuilder()
        # Compile the HTML and save the resulting HTML file in "helloWorld.html".
        self.build(htmlBuilder) # Build from entire site theme, not just from template. Result is stream in builder.
        # Answer the path, so we can directly open the file with a browser.
        return htmlBuilder.save(self, root)  
Exemplo n.º 10
0
    TITLE = 'Blog Petr van Blokland + Claudia Mens'
    SUBTITLE = 'Notes on design and education.'

    def baseComponents(self):
        logo = Logo()
        socialmedia = SocialMedia(twitterAccount='mymagazine', facebookAccount='mymagazine') 
        
        homePage = Page(components=(logo, socialmedia))
        return [homePage]
    
if __name__ == '__main__':
    magazine = DemoMagazine()
    # Create the main CSS builder
    cssBuilder = CssBuilder()
    # Create the main HTML builder
    htmlBuilder = HtmlBuilder()
    #bluePrintBuilder = BluePrintBuilder() 
    for template in magazine.getTemplates():
        # Build the SCSS/CSS of this theme template
        template.build(cssBuilder) 
        cssPath = template.getStylePath()
        cssBuilder.save(cssPath, makeDirectory=True) # Compile the SCSS to CSS and save the file.
        # Build the HTML of this theme template
        template.build(htmlBuilder) # Build the code for every page template in the theme
        exportPath = htmlBuilder.getTemplatePath(magazine)
        print 'Saving', exportPath
        htmlBuilder.save(exportPath, makeDirectory=True) # Save the exported template code into its file.
        
        

Exemplo n.º 11
0
    def baseComponents(self):
        logo = Logo()
        socialmedia = SocialMedia(twitterAccount='mymagazine',
                                  facebookAccount='mymagazine')

        homePage = Page(components=(logo, socialmedia))
        return [homePage]


if __name__ == '__main__':
    magazine = DemoMagazine()
    # Create the main CSS builder
    cssBuilder = CssBuilder()
    # Create the main HTML builder
    htmlBuilder = HtmlBuilder()
    #bluePrintBuilder = BluePrintBuilder()
    for template in magazine.getTemplates():
        # Build the SCSS/CSS of this theme template
        template.build(cssBuilder)
        cssPath = template.getStylePath()
        cssBuilder.save(
            cssPath,
            makeDirectory=True)  # Compile the SCSS to CSS and save the file.
        # Build the HTML of this theme template
        template.build(
            htmlBuilder)  # Build the code for every page template in the theme
        exportPath = htmlBuilder.getTemplatePath(magazine)
        print 'Saving', exportPath
        htmlBuilder.save(exportPath, makeDirectory=True
                         )  # Save the exported template code into its file.
Exemplo n.º 12
0
        ), id='sidebar', width='38%', float='left'
    )
    main = Group(components=(
        Header(Text('Header of the page', fontsize=50, color='red')),
        Article(Text('This is a text. ' * 40)),
        Header(Text('Another header')),
        Article(Text('This is another text. ' * 20)),
        ), id='main', width='60%', float='left'
    )
    contact = Group(components=(
        Header(Text('Contact', fontsize=50), name='Contact'))
    )
    components = (
        Page(name='index', components=(main, sidebar), style=style),
        Page(name='contact', components=(contact, sidebar), style=style)
    )
    t = Theme(components)
    hb = HtmlBuilder()
    for page in t.pages:
        page.build(hb) # Clear the builder and build the HTML for page
        hb.save('/Library/WebServer/Documents/xierpa3/%s.html' % page.name)
        print hb.getResult()
        print
        print

    sb = SassBuilder()
    t.build(sb)
    sb.save('/Library/WebServer/Documents/xierpa3/style.scss')
    print sb.getResult()