コード例 #1
0
ファイル: xml.py プロジェクト: BlackEarth/bxml
 def write(
     self,
     fn=None,
     root=None,
     encoding='UTF-8',
     doctype=None,
     canonicalized=False,
     xml_declaration=True,
     pretty_print=True,
     with_comments=True,
 ):
     data = self.tobytes(
         root=root or self.root,
         xml_declaration=xml_declaration,
         pretty_print=pretty_print,
         encoding=encoding or self.info.encoding,
         doctype=doctype or self.info.doctype,
         canonicalized=canonicalized,
         with_comments=with_comments,
     )
     if canonicalized == True and xml_declaration == True:  # add the xml declaration
         data = ("<?xml version='1.0' encoding='%s'?>\n" % encoding).encode(encoding) + data
     File.write(self, fn=fn or self.fn, data=data)
コード例 #2
0
ファイル: text.py プロジェクト: BlackEarth/bl
 def write(self, fn=None, text=None, encoding='UTF-8', **args):
     try:
         data = (text or self.text or '').encode(encoding)
     except:
         data = (text or self.text or '').encode()
     File.write(self, fn=fn, data=data, **args)
コード例 #3
0
 def write(self, fn=None, encoding='UTF-8', **args):
     text = self.render_styles()
     File.write(self, fn=fn, data=text.encode(encoding))
コード例 #4
0
ファイル: text.py プロジェクト: dabomb2654/google-zuka
 def write(self, fn=None, text=None, encoding='UTF-8', **args):
     try:
         data = (text or self.text or '').encode(encoding)
     except:
         data = (text or self.text or '').encode()
     File.write(self, fn=fn, data=data, **args)
コード例 #5
0
ファイル: css.py プロジェクト: BlackEarth/bf
 def write(self, fn=None, encoding='UTF-8', **args):
     text = self.render_styles()
     File.write(self, fn=fn, data=text.encode(encoding))