File: fix-css.py

package info (click to toggle)
pyglossary 5.0.9-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,896 kB
  • sloc: python: 46,165; sh: 308; javascript: 100; xml: 42; makefile: 28
file content (19 lines) | stat: -rw-r--r-- 508 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import sys
from os.path import dirname, realpath, splitext

sys.path.insert(0, dirname(dirname(dirname(realpath(__file__)))))

from pyglossary.apple_utils import substituteAppleCSS

for fpath in sys.argv[1:]:
	if fpath.endswith("-fixed.css"):
		continue
	fpathNoExt, _ = splitext(fpath)
	fpathNew = fpathNoExt + "-fixed.css"
	with open(fpath, "rb") as _file:
		text = _file.read()
	text = substituteAppleCSS(text)
	with open(fpathNew, "wb") as _file:
		_file.write(text)
	print("Created", fpathNew)
	print()