E5XML/HighlightingStylesWriter.py

changeset 2992
dbdf27746da5
parent 2302
f29e9405c851
child 3035
36e9f388958b
child 3057
10516539f238
equal deleted inserted replaced
2991:226481ff40d1 2992:dbdf27746da5
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 import time 11 import time
11 12
12 from .XMLStreamWriterBase import XMLStreamWriterBase 13 from .XMLStreamWriterBase import XMLStreamWriterBase
15 import Preferences 16 import Preferences
16 17
17 18
18 class HighlightingStylesWriter(XMLStreamWriterBase): 19 class HighlightingStylesWriter(XMLStreamWriterBase):
19 """ 20 """
20 Class implementing the writer class for writing a highlighting styles XML file. 21 Class implementing the writer class for writing a highlighting styles XML
22 file.
21 """ 23 """
22 def __init__(self, device, lexers): 24 def __init__(self, device, lexers):
23 """ 25 """
24 Constructor 26 Constructor
25 27
35 """ 37 """
36 Public method to write the XML to the file. 38 Public method to write the XML to the file.
37 """ 39 """
38 XMLStreamWriterBase.writeXML(self) 40 XMLStreamWriterBase.writeXML(self)
39 41
40 self.writeDTD('<!DOCTYPE HighlightingStyles SYSTEM "HighlightingStyles-{0}.dtd">'\ 42 self.writeDTD(
41 .format(highlightingStylesFileFormatVersion)) 43 '<!DOCTYPE HighlightingStyles SYSTEM'
44 ' "HighlightingStyles-{0}.dtd">'.format(
45 highlightingStylesFileFormatVersion))
42 46
43 # add some generation comments 47 # add some generation comments
44 self.writeComment(" Eric5 highlighting styles ") 48 self.writeComment(" Eric5 highlighting styles ")
45 self.writeComment(" Saved: {0}".format(time.strftime('%Y-%m-%d, %H:%M:%S'))) 49 self.writeComment(
50 " Saved: {0}".format(time.strftime('%Y-%m-%d, %H:%M:%S')))
46 self.writeComment(" Author: {0} ".format(self.email)) 51 self.writeComment(" Author: {0} ".format(self.email))
47 52
48 # add the main tag 53 # add the main tag
49 self.writeStartElement("HighlightingStyles") 54 self.writeStartElement("HighlightingStyles")
50 self.writeAttribute("version", highlightingStylesFileFormatVersion) 55 self.writeAttribute("version", highlightingStylesFileFormatVersion)

eric ide

mercurial