Beispiel #1
0
	def __init__(self, title):
		File.__init__(self, title, 'html')
		
		impl = xml.dom.minidom.getDOMImplementation()
		docType = impl.createDocumentType(
			'html', 
			'-//W3C//DTD XHTML 1.0 Transitional//EN', 
			'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'
		)
		self.document = impl.createDocument(None, 'html', docType)
		self.html = self.document.documentElement
		
		#hackish:
		self._declLength = len(impl.createDocument(None, None, None).toxml("utf-8")) 
		
		
		self.head = self.document.createElement('head')
		self.body = self.document.createElement('body')
		
		self.html.appendChild(self.head)
		self.html.appendChild(self.body)
		
		titleTag = self.document.createElement('title')
		titleTagText = self.document.createTextNode(title)
		titleTag.appendChild(titleTagText)
		self.head.appendChild(titleTag)
		
		metaEncoding = self.document.createElement('meta')
		metaEncoding.setAttribute('http-equiv', 'content-type')
		metaEncoding.setAttribute('content', 'text/html; charset=utf-8')
		self.head.appendChild(metaEncoding)
		
		self.htmlParser = HTMLParser.HTMLParser()
Beispiel #2
0
	def __init__(self, title):
		File.__init__(self, title, 'opf')
		self.html = None
		self.ncx = None
		self.metaInfos = {}
		
		self.setMetadata("title", title)
		self.setMetadata("language", "en")