E5XML/HighlightingStylesWriter.py

changeset 411
99409cddaaa9
parent 96
9624a110667d
child 593
32c9b36eec53
equal deleted inserted replaced
410:e5d1addeb90c 411:99409cddaaa9
34 """ 34 """
35 Public method to write the XML to the file. 35 Public method to write the XML to the file.
36 """ 36 """
37 XMLWriterBase.writeXML(self) 37 XMLWriterBase.writeXML(self)
38 38
39 self._write('<!DOCTYPE HighlightingStyles SYSTEM "HighlightingStyles-%s.dtd">' % \ 39 self._write('<!DOCTYPE HighlightingStyles SYSTEM "HighlightingStyles-{0}.dtd">'\
40 highlightingStylesFileFormatVersion) 40 .format(highlightingStylesFileFormatVersion))
41 41
42 # add some generation comments 42 # add some generation comments
43 self._write("<!-- Eric5 highlighting styles -->") 43 self._write("<!-- Eric5 highlighting styles -->")
44 self._write("<!-- Saved: %s -->" % time.strftime('%Y-%m-%d, %H:%M:%S')) 44 self._write("<!-- Saved: {0} -->".format(time.strftime('%Y-%m-%d, %H:%M:%S')))
45 self._write("<!-- Author: %s -->" % self.escape("%s" % self.email)) 45 self._write("<!-- Author: {0} -->".format(self.escape("{0}".format(self.email))))
46 46
47 # add the main tag 47 # add the main tag
48 self._write('<HighlightingStyles version="%s">' % \ 48 self._write('<HighlightingStyles version="{0}">'.format(
49 highlightingStylesFileFormatVersion) 49 highlightingStylesFileFormatVersion))
50 50
51 for lexer in self.lexers: 51 for lexer in self.lexers:
52 self._write(' <Lexer name="%s">' % lexer.language()) 52 self._write(' <Lexer name="{0}">'.format(lexer.language()))
53 for style in lexer.descriptions: 53 for style in lexer.descriptions:
54 self._write(' <Style style="%d" ' 54 self._write(' <Style style="{0:d}" '
55 'color="%s" paper="%s" font="%s" eolfill="%d">%s</Style>' % \ 55 'color="{1}" paper="{2}" font="{3}" eolfill="{4:d}">{5}</Style>'\
56 (style, lexer.color(style).name(), lexer.paper(style).name(), 56 .format(style, lexer.color(style).name(), lexer.paper(style).name(),
57 lexer.font(style).toString(), lexer.eolFill(style), 57 lexer.font(style).toString(), lexer.eolFill(style),
58 self.escape(lexer.description(style))) 58 self.escape(lexer.description(style)))
59 ) 59 )
60 self._write(' </Lexer>') 60 self._write(' </Lexer>')
61 61
62 self._write("</HighlightingStyles>", newline = False) 62 self._write("</HighlightingStyles>", newline = False)

eric ide

mercurial