def go(myname, opts): dinfo = DiaryInfo(myname, opts) #dinfo.parseOptions() #dinfo.readDotCalendar() #sys.stderr.write("%s\n" % dinfo.events) d = Diary(dinfo) d.diary() if dinfo.pdf: # If we don't close the pipe to the pdf2ps process, it waits forever for more input. dinfo.pdfProcess.stdin.close() dinfo.pdfProcess.wait()
epsfilepathname = self.findEPSFile(self.epsfilename) if epsfilepathname is None: print >> sys.stderr, "cannot find %s" % self.epsfilename return "%% %s: cannot find %s\n" % (self.__class__.__name__, self.epsfilename) s = s + "%% %s: found %s at %s\n" % (self.__class__.__name__, self.epsfilename, epsfilepathname) title1 = self.title1 if title1 is not None and (self.title2 is None or self.title2 == ''): # This single space is a bit of a hack to get a line across underneath where the # title would go, without putting a title there. title2 = ' ' else: title2 = self.title2 s = s + HalfEPSFilePage(self.dinfo, epsfilepathname, title1, HalfEPSFilePage.LEFT).page() \ + HalfEPSFilePage(self.dinfo, epsfilepathname, title2, HalfEPSFilePage.RIGHT).page() return s if __name__ == '__main__': di = DiaryInfo(sys.argv[0], sys.argv[1:]) #di.epsFilePageOption('eps/units/units.eps|EPS file units.eps', 1) #di.epsFilePageOption('eps/units/units.eps', 2) print preamble(di) print EPSFilePage(di, 'makediary-qrcode.eps').page() print TwoEPSFilePages(di, 'makediary-qrcode.eps').page() print postamble(di)
# Check to see if the page was extracted, or if psselect just gave us an empty # page, which is what it does when we ask for a page after the end of the document. if not re.search('''^%%Page:''', pss_stdout, re.MULTILINE): return s # Make up a name for the embedded document. if self.manPageInfo[1] is None: documentname = "man %s # page %d" % (self.manPageInfo[0], pageNumber) else: documentname = "man %s %s # page %d" % \ (self.manPageInfo[1], self.manPageInfo[0], pageNumber) # Get our diary page, with the EPS page embedded. epsString = NamedStringIO(pss_stdout, documentname) s += EPSFilePage(self.dinfo, epsString).page() pageNumber += 1 return "%% -- man %s(%s)\n" % self.manPageInfo if __name__ == '__main__': di = DiaryInfo(sys.argv[0], sys.argv[1:]) di.manPageOption('ls(1)') di.manPageOption('mkdir') di.manPageOption('umount,8') print preamble(di) for manPageInfo in di.manPages: print ManPagePages(di, manPageInfo).page() print postamble(di)