Exemplo n.º 1
0
    def parse( self, filename ):
        ItemParser.parse( self, PageParser.MANDATORY_FIELDS, filename, PageParser.OPTIONAL_FIELDS )

        page = Page( self.info['title'], "%s.tpl" % self.info['template'] if 'template' in self.info else None )

        if 'static' in self.info:
            page.static = self.info['static']

        author = AuthorManager.getInstance().get( self.info['author'] )
        author.items.append(page)
        
        categories = []
        for title in self.info['categories']:
            category = CategoryManager.getInstance().get(title)
            category.items.append(page)
            categories.append( category )

        tags = []
        for title in self.info['tags']:
            tag = TagManager.getInstance().get(title)
            tag.items.append(page)
            tags.append( tag )

        page.datetime   = self.info['date']
        page.author     = author
        page.categories = categories
        page.tags       = tags
        page.abstract   = self.abstract
        page.content    = self.body

        # reset the state
        ItemParser.__init__(self)

        return page
Exemplo n.º 2
0
    def parse( self, filename ):
        ItemParser.parse( self, AuthorParser.MANDATORY_FIELDS, filename )
        
        object = Author( self.info['username'] )
        object.avatar   = self.info['avatar']
        object.email    = self.info['email']
        object.website  = self.info['website']
        object.content  = self.body
        object.abstract = self.abstract

        return object
Exemplo n.º 3
0
    def parse(self, filename):
        ItemParser.parse(self, AuthorParser.MANDATORY_FIELDS, filename)

        object = Author(self.info['username'])
        object.avatar = self.info['avatar']
        object.email = self.info['email']
        object.website = self.info['website']
        object.content = self.body
        object.abstract = self.abstract

        return object
Exemplo n.º 4
0
    def parse(self, filename):
        ItemParser.parse(self, PageParser.MANDATORY_FIELDS, filename,
                         PageParser.OPTIONAL_FIELDS)

        page = Page(
            self.info['title'], "%s.tpl" %
            self.info['template'] if 'template' in self.info else None)

        if 'static' in self.info:
            page.static = self.info['static']

        author = AuthorManager.getInstance().get(self.info['author'])
        author.items.append(page)

        categories = []
        for title in self.info['categories']:
            category = CategoryManager.getInstance().get(title)
            category.items.append(page)
            categories.append(category)

        tags = []
        for title in self.info['tags']:
            tag = TagManager.getInstance().get(title)
            tag.items.append(page)
            tags.append(tag)

        page.datetime = self.info['date']
        page.author = author
        page.categories = categories
        page.tags = tags
        page.abstract = self.abstract
        page.content = self.body

        # reset the state
        ItemParser.__init__(self)

        return page
Exemplo n.º 5
0
 def __init__(self):
     ItemParser.__init__(self)
Exemplo n.º 6
0
 def __init__(self):
     ItemParser.__init__(self)