File: theme.py

package info (click to toggle)
gpaw 25.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 18,888 kB
  • sloc: python: 174,804; ansic: 17,564; cpp: 5,668; sh: 972; csh: 139; makefile: 45
file content (24 lines) | stat: -rw-r--r-- 542 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# creates: theme.css
import re
import sphinx_rtd_theme


rtd_path = sphinx_rtd_theme.__path__[0]
with open(rtd_path + '/static/css/theme.css') as fd:
    css = fd.read()


def replace(match):
    s = match.group()
    if len(s) == 8:
        return s[0:3] + s[5:7] + s[3:5] + s[7]
    if len(s) == 5:
        return s[0:2] + s[3] + s[2] + s[4]
    1 / 0


new = re.sub('#[a-fA-F0-9]{3,6}[;}]', replace, css)
with open('theme.css', 'w') as fd:
    fd.write(new)
    # Equation numbers to the right:
    fd.write('span.eqno {float: right;}\n')