Beispiel #1
0
    def writeBook(self, book, output, removedArticlesFile=None, coverimage=None):
        """
        bookParseTree must be advtree and sent through preprocess()
        """
        
        if self.env and self.env.metabook:
            self.doc.meta.addElement(dc.Title(text=self.env.metabook.get("title", "")))
        #licenseArticle = self.env.metabook['source'].get('defaultarticlelicense','') # FIXME

        for e in book.children:
            self.write(e, self.doc.text)
        doc = self.getDoc()
        #doc.toXml("%s.odf.xml"%fn)
        doc.save(output, addsuffix=False)
        log( "writing to %r" % output )
    usage()
    sys.exit(2)

doc=OpenDocumentText()
textdoc = doc.text

if creator != "":
    doc.meta.addElement(meta.InitialCreator(text=creator))
    doc.meta.addElement(dc.Creator(text=creator))
if creationdate is not None:
    doc.meta.addElement(meta.CreationDate(text=creationdate))
    doc.meta.addElement(dc.Date(text=creationdate))
if description is not None:
    doc.meta.addElement(dc.Description(text=description))
if title != "":
    doc.meta.addElement(dc.Title(text=title))
if language is not None:
    doc.meta.addElement(dc.Language(text=language))
if publisher is not None:
#   doc.meta.addElement(dc.Publisher(text=publisher))
    doc.meta.addElement(meta.UserDefined(name="Publisher", text=publisher))
if copyrights is not None:
#   doc.meta.addElement(dc.Rights(text=copyrights))
    doc.meta.addElement(meta.UserDefined(name="Rights", text=copyrights))
if ebooknum is not None:
    doc.meta.addElement(meta.UserDefined(name="EText", text=ebooknum))

arial =  style.FontFace(name="Arial", fontfamily="Arial", fontfamilygeneric="swiss", fontpitch="variable")
doc.fontfacedecls.addElement(arial)

# Paragraph styles
Beispiel #3
0
 def s_html_title(self, tag, attrs):
     e = dc.Title()
     self.doc.meta.addElement(e)
     self.curr = e