E5XML/TemplatesWriter.py

changeset 586
9dbffeed66a9
parent 584
b5d4c116952a
child 791
9ec2ac20e54e
equal deleted inserted replaced
585:f40889943c0a 586:9dbffeed66a9
37 templatesFileFormatVersion)) 37 templatesFileFormatVersion))
38 38
39 # add some generation comments 39 # add some generation comments
40 self.writeComment(" eric5 templates file ") 40 self.writeComment(" eric5 templates file ")
41 self.writeComment(" Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) 41 self.writeComment(" Saved: {0} ".format(time.strftime('%Y-%m-%d, %H:%M:%S')))
42 ## self._write("<!-- eric5 templates file -->")
43 ## self._write("<!-- Saved: {0} -->".format(time.strftime('%Y-%m-%d, %H:%M:%S')))
44 42
45 # add the main tag 43 # add the main tag
46 self.writeStartElement("Templates") 44 self.writeStartElement("Templates")
47 self.writeAttribute("version", templatesFileFormatVersion) 45 self.writeAttribute("version", templatesFileFormatVersion)
48 ## self._write('<Templates version="{0}">'.format(templatesFileFormatVersion))
49 46
50 # do the template groups 47 # do the template groups
51 groups = self.templatesViewer.getAllGroups() 48 groups = self.templatesViewer.getAllGroups()
52 for group in groups: 49 for group in groups:
53 self.writeStartElement("TemplateGroup") 50 self.writeStartElement("TemplateGroup")
54 self.writeAttribute("name", group.getName()) 51 self.writeAttribute("name", group.getName())
55 self.writeAttribute("language", group.getLanguage()) 52 self.writeAttribute("language", group.getLanguage())
56 ## self._write(' <TemplateGroup name="{0}" language="{1}">'.format(
57 ## group.getName(), group.getLanguage()))
58 # do the templates 53 # do the templates
59 templates = group.getAllEntries() 54 templates = group.getAllEntries()
60 for template in templates: 55 for template in templates:
61 self.writeStartElement("Template") 56 self.writeStartElement("Template")
62 self.writeAttribute("name", template.getName()) 57 self.writeAttribute("name", template.getName())
65 self.writeEndElement() 60 self.writeEndElement()
66 self.writeEndElement() 61 self.writeEndElement()
67 62
68 self.writeEndElement() 63 self.writeEndElement()
69 self.writeEndDocument() 64 self.writeEndDocument()
70 ## self._write(' <Template name="{0}">'.format(
71 ## self.escape(template.getName(), True)))
72 ## self._write(' <TemplateDescription>{0}</TemplateDescription>'.format(
73 ## self.escape("{0}".format(template.getDescription()))))
74 ## self._write(' <TemplateText>{0}</TemplateText>'.format(
75 ## self.escape("{0}".format(template.getTemplateText()))))
76 ## self._write(' </Template>')
77 ## self._write(' </TemplateGroup>')
78 ##
79 ## self._write('</Templates>', newline = False)

eric ide

mercurial