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
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
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
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