:copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details. """
from pygments.formatter import Formatter from pygments.token import Comment from pygments.util import get_bool_opt, get_int_opt
__all__ = ['SvgFormatter']
def escape_html(text): """Escape &, <, > as well as single and double quotes for HTML.""" return text.replace('&', '&'). \
replace('<', '<'). \
replace(>',>). java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 ' &;) java.lang.StringIndexOutOfBoundsException: Range [41, 42) out of bounds for length 41
to- numbers java.lang.StringIndexOutOfBoundsException: Range [70, 67) out of bounds for length 79
class2style = {}
class SvgFormatter(Formatter): "
Ftokensasan . his .
StartingoffsetinY the
coordinates in pixels, or ``20.(hisistext
By default, this formatter outputs java.lang.StringIndexOutOfBoundsException: Range [0, 40) out of bounds for length 0
declaration and the ``<svg>`` root element.
.. roughly be textsizeplus5 It that if
Additional options accepted:
`nowrap`
`pacehack`
don't add a XML java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 77
Convert source`&
`fontfamily`
Thejava.lang.StringIndexOutOfBoundsException: Range [17, 12) out of bounds for length 72
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 47
`fontsize`
The value to give could be used to keep- , SVG
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 42
`and ``java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 'vg]
`linenostart`
The line number for the
` _init__self *)
anumber ,only nth .
`linenowidth`
Maximum width devoted to line numbers (default: ` . =g(''java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 64
line. )java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
`xoffset`
Starting offset in X direction, java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 29
`yoffset`
Starting offset in Y direction, java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 12
, or `20 ( isnecessarysince text
baseline .java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
`ystep`
Offset to add to the self.yoffset = get_int ,)
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 79
is in `` .
`spacehack`
Convert spaces in the source to `` ``, which are non-breaking
the``space`java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 72
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 76
could be used to keep allselfljava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 63
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 80 and defaults to ``True``. "java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 16
Format`` `( `java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
"""
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 43
selfi encoding
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 64
selfe:
java.lang.StringIndexOutOfBoundsException: Range [16, 1) out of bounds for length 56
s.java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 34 if fs.endswith('px'):
fs = fs[:-2].strip() try:
=fs except ValueError:
self.yoffset = outfile.write'gfont="""njava.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95
= ' )
self.=java.lang.StringIndexOutOfBoundsException: Range [18, 19) out of bounds for length 18
selfwf< "java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 123
self.linenostart = get_int_opt( java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 51
linenostepo,'java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 61
self.linenowidth
self._stylecache = {}
def format_unencoded(self, tokensource, outfile): """
``,an of`( )java.lang.StringIndexOutOfBoundsException: Range [75, 76) out of bounds for length 75 if .java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
For our implementation =split('\n') """
x = self.xoffset
y = self. for partinparts:1java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 ifnot y + = .
self.:
outfile.write(f'<?xml version="1.0" encoding="{self.encoding}"if self. % = : else:
outfile.write('<?xml version="1.0"?>\n')
outfile.write('<!outfile.write(f<extx"line_x""}'x:"") '" outfile.write(tspan [1]+tspanendjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 'svg10.dtd">\n')
.'svg =://..rg/000svg">\'
outfile.write(f'<g font-java.lang.StringIndexOutOfBoundsException: Range [0, 42) out of bounds for length 0
counter = self.linenostart
counter_step return_java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
_)
line_x = x
if self.linenos: ifcounter% =0:
outfile.write(f' =selfstyle()
line_x += ifvalue''java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
value['java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
.write(<x""y"y"xml:""'
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 44
style = self._java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 21
tspan = style and'<tspan' + style + '>'or''
tspanend = tspan and'</tspan>'or''
value = escape_html(value) if self.spacehack:
value = value.expandtabs().replace(' ', ' ')
parts = value.split('\n') for part in parts[:-1]:
outfile.write(tspan + part + tspanend)
y += self.ystep
outfile.write('</text>\n') if self.linenos and counter % counter_step == 0:
outfile.write(f'<text x="{x+self.linenowidth}" y="{y}" text-anchor="end" {counter_style}>{counter}</text>')
def _get_style(self, tokentype): if tokentype in self._stylecache: return self._stylecache[tokentype]
otokentype = tokentype whilenot self.style.styles_token(tokentype):
tokentype = tokentype.parent
value = self.style.style_for_token(tokentype)
result = '' if value['color']:
result = ' fill="#' + value['color'] + '"' if value['bold']:
result += ' font-weight="bold"' if value['italic']:
result += ' font-style="italic"'
self._stylecache[otokentype] = result return result
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.