def start(self):
        """Start HTML output."""
        today = time.time()
        yesterday = today - 86400
        tomorrow = today + 86400
        today = time.localtime(today)
        yesterday = time.localtime(yesterday)
        tomorrow = time.localtime(tomorrow)

        fn = self.fnFromDate(today)
        if os.path.exists(fn):
            out.warn('HTML output file %r already exists' % fn)
            out.warn('the page link of previous run will skip this file')
            out.warn('try to generate HTML output only once per day')
            fn = util.getNonexistingFile(fn)

        d = os.path.dirname(fn)
        if not os.path.isdir(d):
            os.makedirs(d)

        try:
            fn_yesterday = self.fnFromDate(yesterday)
            fn_yesterday = util.getExistingFile(fn_yesterday)
            self.yesterdayUrl = self.getUrlFromFilename(fn_yesterday)
        except ValueError:
            self.yesterdayUrl = None
        self.tomorrowUrl = self.getUrlFromFilename(self.fnFromDate(tomorrow))

        self.html = codecs.open(fn, 'w', self.encoding)
        self.html.write(u'''<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=%s"/>
<meta name="generator" content="%s"/>
<title>Comics for %s</title>
</head>
<body>
'''  % (self.encoding, configuration.App, time.strftime('%Y/%m/%d', today)))
        self.addNavLinks()
        self.html.write(u'<ul>\n')
        # last comic name (eg. CalvinAndHobbes)
        self.lastComic = None
        # last comic strip URL (eg. http://example.com/page42)
        self.lastUrl = None
def start ( self ) : today = time . time ( ) yesterday = today - 86400 tomorrow = today + 86400 today = time . localtime ( today ) yesterday = time . localtime ( yesterday ) tomorrow = time . localtime ( tomorrow ) fn = self . fnFromDate ( today ) if os . path . exists ( fn ) : out . warn ( 'HTML output file %r already exists' % fn ) out . warn ( 'the page link of previous run will skip this file' ) out . warn ( 'try to generate HTML output only once per day' ) fn = util . getNonexistingFile ( fn ) d = os . path . dirname ( fn ) if not os . path . isdir ( d ) : os . makedirs ( d ) try : fn_yesterday = self . fnFromDate ( yesterday ) fn_yesterday = util . getExistingFile ( fn_yesterday ) self . yesterdayUrl = self . getUrlFromFilename ( fn_yesterday ) except ValueError : self . yesterdayUrl = None self . tomorrowUrl = self . getUrlFromFilename ( self . fnFromDate ( tomorrow ) ) self . html = codecs . open ( fn , 'w' , self . encoding ) self . html . write ( u'''<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=%s"/>
<meta name="generator" content="%s"/>
<title>Comics for %s</title>
</head>
<body>
''' % ( self . encoding , configuration . App , time . strftime ( '%Y/%m/%d' , today ) ) ) self . addNavLinks ( ) self . html . write ( u'<ul>\n' ) self . lastComic = None self . lastUrl = None
Start HTML output.