/usr/lib/python3/dist-packages/sphinx/util/texescape.py is in python3-sphinx 1.3.6-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | # -*- coding: utf-8 -*-
"""
sphinx.util.texescape
~~~~~~~~~~~~~~~~~~~~~
TeX escaping helper.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
tex_replacements = [
# map TeX special chars
('$', r'\$'),
('%', r'\%'),
('&', r'\&'),
('#', r'\#'),
('_', r'\_'),
('{', r'\{'),
('}', r'\}'),
('[', r'{[}'),
(']', r'{]}'),
('`', r'{}`'),
('\\', r'\textbackslash{}'),
('~', r'\textasciitilde{}'),
('<', r'\textless{}'),
('>', r'\textgreater{}'),
('^', r'\textasciicircum{}'),
# map special Unicode characters to TeX commands
('¶', r'\P{}'),
('§', r'\S{}'),
('€', r'\texteuro{}'),
('∞', r'\(\infty\)'),
('±', r'\(\pm\)'),
('→', r'\(\rightarrow\)'),
('‣', r'\(\rightarrow\)'),
# used to separate -- in options
('', r'{}'),
# map some special Unicode characters to similar ASCII ones
('─', r'-'),
('⎽', r'\_'),
('╲', r'\textbackslash{}'),
('|', r'\textbar{}'),
('│', r'\textbar{}'),
('ℯ', r'e'),
('ⅈ', r'i'),
('₁', r'1'),
('₂', r'2'),
# map Greek alphabet
('α', r'\(\alpha\)'),
('β', r'\(\beta\)'),
('γ', r'\(\gamma\)'),
('δ', r'\(\delta\)'),
('ε', r'\(\epsilon\)'),
('ζ', r'\(\zeta\)'),
('η', r'\(\eta\)'),
('θ', r'\(\theta\)'),
('ι', r'\(\iota\)'),
('κ', r'\(\kappa\)'),
('λ', r'\(\lambda\)'),
('μ', r'\(\mu\)'),
('ν', r'\(\nu\)'),
('ξ', r'\(\xi\)'),
('ο', r'o'),
('π', r'\(\pi\)'),
('ρ', r'\(\rho\)'),
('σ', r'\(\sigma\)'),
('τ', r'\(\tau\)'),
('υ', '\\(\\upsilon\\)'),
('φ', r'\(\phi\)'),
('χ', r'\(\chi\)'),
('ψ', r'\(\psi\)'),
('ω', r'\(\omega\)'),
('Α', r'A'),
('Β', r'B'),
('Γ', r'\(\Gamma\)'),
('Δ', r'\(\Delta\)'),
('Ε', r'E'),
('Ζ', r'Z'),
('Η', r'H'),
('Θ', r'\(\Theta\)'),
('Ι', r'I'),
('Κ', r'K'),
('Λ', r'\(\Lambda\)'),
('Μ', r'M'),
('Ν', r'N'),
('Ξ', r'\(\Xi\)'),
('Ο', r'O'),
('Π', r'\(\Pi\)'),
('Ρ', r'P'),
('Σ', r'\(\Sigma\)'),
('Τ', r'T'),
('Υ', '\\(\\Upsilon\\)'),
('Φ', r'\(\Phi\)'),
('Χ', r'X'),
('Ψ', r'\(\Psi\)'),
('Ω', r'\(\Omega\)'),
('Ω', r'\(\Omega\)'),
]
tex_escape_map = {}
tex_replace_map = {}
tex_hl_escape_map_new = {}
def init():
for a, b in tex_replacements:
tex_escape_map[ord(a)] = b
tex_replace_map[ord(a)] = '_'
for a, b in tex_replacements:
if a in '[]{}\\':
continue
tex_hl_escape_map_new[ord(a)] = b
|