Merge curated fork work: 12 new diagram types, icons, export, onboarding v2
Imports the substantive work from the aristide/diagram-design fork (PR #9) as a curated set: - 12 new diagram types with reference docs: radar, bar, line, gantt, scatter, it-state, high-level, process, medallion, data-flow, dp-integration, dp-security-matrix (26 types total) - 86-icon monochrome IT/cloud primitive, build script, and gallery - /diagram-design:export command with PNG/SVG export reference - Onboarding v2: URL, skill, and folder design-token sources - Mandatory connector rules (orthogonal elbows, label gaps, fanned attach points, bridge crossings) + architecture/ER connector upgrades - Series palette tokens for multi-series chart types - THIRD_PARTY_LICENSES.md covering Tabler, Simple Icons, log-z, Devicon Not taken from the fork: plugin-manifest identity changes, the client-brand takeover of style-guide.md, and client-branded example files. The six affected type examples were regenerated in the neutral editorial skin with generic content, and their README screenshots recaptured. Reference docs for those types were rewritten to semantic tokens and typography roles. Version: 1.0.0 -> 2.0.0. Co-authored-by: Aristide <mendoo.aristide@gmail.com>
This commit is contained in:
co-authored by
Aristide
parent
0ab077f229
commit
2e9cefb9f3
@@ -0,0 +1,61 @@
|
||||
"""Replace mojibake sequences in UTF-8 files with their original characters.
|
||||
|
||||
The repo had a few files saved by a tool that interpreted UTF-8 as cp1252 and
|
||||
re-saved as UTF-8, producing classic mojibake (em-dash --> 'â€"', section sign
|
||||
--> '§', right arrow --> 'â†'', etc.). This script rewrites those sequences
|
||||
in-place without touching legitimately-encoded UTF-8 elsewhere in the file.
|
||||
"""
|
||||
import sys
|
||||
|
||||
PAIRS = [
|
||||
('—', '—'), # em-dash
|
||||
('–', '–'), # en-dash
|
||||
('’', '’'), # right single quote
|
||||
('‘', '‘'), # left single quote
|
||||
('“', '“'), # left double quote
|
||||
('â€', '”'), # right double quote
|
||||
('…', '…'), # horizontal ellipsis
|
||||
('•', '•'), # bullet
|
||||
('→', '→'), # right arrow
|
||||
('↑', '←'), # left arrow
|
||||
('↑', '↑'), # up arrow (same prefix collision - rare)
|
||||
('↓', '↓'), # down arrow
|
||||
('≤', '≤'), # less-than-or-equal
|
||||
('≥', '≥'), # greater-than-or-equal
|
||||
('×', '×'), # multiplication sign
|
||||
('÷', '÷'), # division sign
|
||||
('§', '§'), # section sign
|
||||
('°', '°'), # degree
|
||||
('½', '½'), # one-half
|
||||
('«', '«'), # «
|
||||
('»', '»'), # »
|
||||
('©', '©'), # ©
|
||||
('®', '®'), # ®
|
||||
]
|
||||
|
||||
|
||||
def fix(path: str) -> int:
|
||||
with open(path, 'rb') as f:
|
||||
raw = f.read()
|
||||
had_bom = raw.startswith(b'\xef\xbb\xbf')
|
||||
if had_bom:
|
||||
raw = raw[3:]
|
||||
text = raw.decode('utf-8')
|
||||
n = 0
|
||||
for bad, good in PAIRS:
|
||||
if bad in text:
|
||||
n += text.count(bad)
|
||||
text = text.replace(bad, good)
|
||||
if n == 0 and not had_bom:
|
||||
print(f'{path}: no mojibake found')
|
||||
return 0
|
||||
with open(path, 'w', encoding='utf-8', newline='\n') as f:
|
||||
f.write(text)
|
||||
note = f' (also stripped BOM)' if had_bom else ''
|
||||
print(f'{path}: replaced {n} sequence(s){note}')
|
||||
return n
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for p in sys.argv[1:]:
|
||||
fix(p)
|
||||
Reference in New Issue
Block a user