OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python311
/
lib
/
python3.11
/
site-packages
/
pygments
/
formatters
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/08/2024 06:42:35 PM
rwxr-xr-x
📄
__init__.py
5.22 KB
05/08/2024 06:42:35 PM
rw-r--r--
📁
__pycache__
-
05/08/2024 06:42:35 PM
rwxr-xr-x
📄
_mapping.py
4.08 KB
05/08/2024 06:42:35 PM
rwxr-xr-x
📄
bbcode.py
3.22 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
groff.py
4.96 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
html.py
34.8 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
img.py
22.72 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
irc.py
4.83 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
latex.py
18.81 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
other.py
4.87 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
pangomarkup.py
2.15 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
rtf.py
11.64 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
svg.py
6.97 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
terminal.py
4.52 KB
05/08/2024 06:42:35 PM
rw-r--r--
📄
terminal256.py
11.44 KB
05/08/2024 06:42:35 PM
rw-r--r--
Editing: pangomarkup.py
Close
""" pygments.formatters.pangomarkup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Formatter for Pango markup output. :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.formatter import Formatter __all__ = ['PangoMarkupFormatter'] _escape_table = { ord('&'): '&', ord('<'): '<', } def escape_special_chars(text, table=_escape_table): """Escape & and < for Pango Markup.""" return text.translate(table) class PangoMarkupFormatter(Formatter): """ Format tokens as Pango Markup code. It can then be rendered to an SVG. .. versionadded:: 2.9 """ name = 'Pango Markup' aliases = ['pango', 'pangomarkup'] filenames = [] def __init__(self, **options): Formatter.__init__(self, **options) self.styles = {} for token, style in self.style: start = '' end = '' if style['color']: start += '<span fgcolor="#{}">'.format(style['color']) end = '</span>' + end if style['bold']: start += '<b>' end = '</b>' + end if style['italic']: start += '<i>' end = '</i>' + end if style['underline']: start += '<u>' end = '</u>' + end self.styles[token] = (start, end) def format_unencoded(self, tokensource, outfile): lastval = '' lasttype = None outfile.write('<tt>') for ttype, value in tokensource: while ttype not in self.styles: ttype = ttype.parent if ttype == lasttype: lastval += escape_special_chars(value) else: if lastval: stylebegin, styleend = self.styles[lasttype] outfile.write(stylebegin + lastval + styleend) lastval = escape_special_chars(value) lasttype = ttype if lastval: stylebegin, styleend = self.styles[lasttype] outfile.write(stylebegin + lastval + styleend) outfile.write('</tt>')