예제 #1
0
 def save_template_once (self, dselector, fname):
   "Save partial template for later editing; don't overwrite!"
   if os.path.exists (templates_path + fname):
     if trace: print 'Not overwritten:', fname
     return
   ext = fname.lower().split ('.') [-1]
   s = dselector.outerHtml()
   if ext == 'minaml':
     s = convert_to_shpaml (s)
   else:
     print 'NYI'
   self._save (s, fname)
예제 #2
0
 def save_template_once (self, dselector, fname):
   "Save partial template for later editing; don't overwrite!"
   if os.path.exists (os.path.join (templates_path, fname)):
     if trace: print 'Not overwritten:', fname
     return
   ext = fname.lower().split ('.') [-1]
   s = dselector.outerHtml()
   if ext == 'minaml':
     s = convert_to_shpaml (s)
   else:
     print 'NYI'
   self._save (s, fname)
예제 #3
0
파일: engine.py 프로젝트: jowolf/tlg
 def save_template_once (self, dselector, fname):
   "Save partial template for later editing; don't overwrite!"
   from html5lib import serialize
   ext = fname.lower().split ('.') [-1]
   #s = dselector.outerHtml()
   s = serialize (dselector, tree="lxml")
   if ext == 'minaml':
     s = convert_to_shpaml (s)
   elif ext == 'html':
     pass # s = s
   else:
     print 'NYI'  # TODO: compiled html template, yaml for obdject / declaration
   if trace: print 'SAVING ONCE:', fname
   self.write (s, fname, overwrite=False)
예제 #4
0
 def save_template_once(self, dselector, fname):
     "Save partial template for later editing; don't overwrite!"
     from html5lib import serialize
     ext = fname.lower().split('.')[-1]
     #s = dselector.outerHtml()
     s = serialize(dselector, tree="lxml")
     if ext == 'minaml':
         s = convert_to_shpaml(s)
     elif ext == 'html':
         pass  # s = s
     else:
         print 'NYI'  # TODO: compiled html template, yaml for obdject / declaration
     if trace: print 'SAVING ONCE:', fname
     self.write(s, fname, overwrite=False)