18 lines
813 B
Python
18 lines
813 B
Python
import io, collections, re
|
|
import xml.etree.ElementTree as ET
|
|
|
|
t = io.open('assets/readme/architecture.svg', encoding='utf-8').read()
|
|
ET.fromstring(t)
|
|
for bad in ('<script', 'foreignObject', '@import', 'http://fonts', 'https://fonts'):
|
|
assert bad not in t, 'sanitizer risk: ' + bad
|
|
print('SVG well-formed:', len(t), 'bytes; no script/foreignObject/remote fonts')
|
|
|
|
sizes = collections.Counter(re.findall(r'font-size="(\d+)"', t))
|
|
print('font sizes:', dict(sorted(sizes.items(), key=lambda kv: -int(kv[0]))))
|
|
|
|
r = io.open('README.md', encoding='utf-8').read()
|
|
assert 'mermaid' not in r, 'mermaid still present'
|
|
assert './assets/readme/architecture.svg' in r, 'embed missing'
|
|
assert 'Текстовая версия схемы' in r, 'fallback missing'
|
|
print('README ok: embed + text fallback, mermaid removed')
|