E5XML/HighlightingStylesWriter.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 2992
dbdf27746da5
child 3060
5883ce99ee12
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
2 2
3 # Copyright (c) 2008 - 2013 Detlev Offenbach <detlev@die-offenbachs.de> 3 # Copyright (c) 2008 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the writer class for writing a highlighting styles XML file. 7 Module implementing the writer class for writing a highlighting styles XML
8 file.
8 """ 9 """
9 10
10 from __future__ import unicode_literals # __IGNORE_WARNING__ 11 from __future__ import unicode_literals # __IGNORE_WARNING__
11 12
12 import time 13 import time
17 import Preferences 18 import Preferences
18 19
19 20
20 class HighlightingStylesWriter(XMLStreamWriterBase): 21 class HighlightingStylesWriter(XMLStreamWriterBase):
21 """ 22 """
22 Class implementing the writer class for writing a highlighting styles XML file. 23 Class implementing the writer class for writing a highlighting styles XML
24 file.
23 """ 25 """
24 def __init__(self, device, lexers): 26 def __init__(self, device, lexers):
25 """ 27 """
26 Constructor 28 Constructor
27 29
37 """ 39 """
38 Public method to write the XML to the file. 40 Public method to write the XML to the file.
39 """ 41 """
40 XMLStreamWriterBase.writeXML(self) 42 XMLStreamWriterBase.writeXML(self)
41 43
42 self.writeDTD('<!DOCTYPE HighlightingStyles SYSTEM "HighlightingStyles-{0}.dtd">'\ 44 self.writeDTD(
43 .format(highlightingStylesFileFormatVersion)) 45 '<!DOCTYPE HighlightingStyles SYSTEM'
46 ' "HighlightingStyles-{0}.dtd">'.format(
47 highlightingStylesFileFormatVersion))
44 48
45 # add some generation comments 49 # add some generation comments
46 self.writeComment(" Eric5 highlighting styles ") 50 self.writeComment(" Eric5 highlighting styles ")
47 self.writeComment(" Saved: {0}".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) 51 self.writeComment(
52 " Saved: {0}".format(time.strftime('%Y-%m-%d, %H:%M:%S')))
48 self.writeComment(" Author: {0} ".format(self.email)) 53 self.writeComment(" Author: {0} ".format(self.email))
49 54
50 # add the main tag 55 # add the main tag
51 self.writeStartElement("HighlightingStyles") 56 self.writeStartElement("HighlightingStyles")
52 self.writeAttribute("version", highlightingStylesFileFormatVersion) 57 self.writeAttribute("version", highlightingStylesFileFormatVersion)

eric ide

mercurial