Пример #1
0
    def _walk(self):
        # Walk through /drafts to check for published posts and add its context
        listing = os.listdir('drafts')
        for infile in listing:
            with open(os.path.join('drafts', infile), 'r') as f:
                raw_header, raw_content = f.read().split('---')

            header = util.parse_header(raw_header)
            if util.isdraft(header['publish']):
                self.entries.append(header)
Пример #2
0
    def __init__(self, filename):
        self.root = os.path.abspath(os.path.dirname(__file__))
        self.name = filename
        self._load()

        if not util.isdraft(self.header['publish']):
            exit

        self.new_header = {}
        myLookup = TemplateLookup(directories=['.'],
                                  output_encoding='utf-8', encoding_errors='replace')

        self.template = Template(filename=os.path.join("design", 'single.html'), lookup=myLookup)
        self.update_header()
        self.write_header()
        self._render()

        self.logger.info("Done")
Пример #3
0
    def __init__(self, filename):
        self.root = os.path.abspath(os.path.dirname(__file__))
        self.name = filename
        self._load()

        if not util.isdraft(self.header['publish']):
            exit

        self.new_header = {}
        myLookup = TemplateLookup(directories=['.'],
                                  output_encoding='utf-8',
                                  encoding_errors='replace')

        self.template = Template(filename=os.path.join("design",
                                                       'single.html'),
                                 lookup=myLookup)
        self.update_header()
        self.write_header()
        self._render()

        self.logger.info("Done")