From 5b58b0b16e228931ff002e7823342c48f22af0cb Mon Sep 17 00:00:00 2001 From: rajames Date: Fri, 6 Nov 2026 02:21:21 +0000 Subject: [PATCH] docs(formal): make doxygen builds -- the Unicode fix-up keeps newunicodechar's characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix-doxygen-unicode.py protected the first argument of each \doxynewunicodechar{...} from its replacements, then turned every non-ASCII character left in the file -- the protected ones too -- into "?" and wrote the file as ASCII. refman.tex's \doxynewunicodechar{⁻}, {²} and {³} became \doxynewunicodechar{?}, and newunicodechar stopped the build: "ASCII character requested". The "?" fallback now applies to the unprotected parts of each line only, and the file is written as UTF-8. make -C docs/formal doxygen, from clean, with doxygen 1.9.8: exit 0, build/doxygen/StarForth-API-Reference.pdf, 3561 pages. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2 --- docs/formal/fix-doxygen-unicode.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/formal/fix-doxygen-unicode.py b/docs/formal/fix-doxygen-unicode.py index 9b77b47c..90ec455d 100644 --- a/docs/formal/fix-doxygen-unicode.py +++ b/docs/formal/fix-doxygen-unicode.py @@ -115,6 +115,11 @@ def fix_line(line): else: for char, replacement in REPLACEMENTS: part = part.replace(char, replacement) + # Replace any remaining non-ASCII with ? placeholder -- here, and + # not over the whole file, so that the protected tokens keep their + # Unicode: a \doxynewunicodechar{?} is an ASCII character, which + # newunicodechar refuses ("ASCII character requested"). + part = part.encode('ascii', errors='replace').decode('ascii') result.append(part) return ''.join(result) @@ -124,10 +129,8 @@ def fix_file(path): original = ''.join(lines) fixed_lines = [fix_line(l) for l in lines] content = ''.join(fixed_lines) - # Replace any remaining non-ASCII with ? placeholder - content = content.encode('ascii', errors='replace').decode('ascii') if content != original: - with open(path, 'w', encoding='ascii') as f: + with open(path, 'w', encoding='utf-8') as f: f.write(content) return True return False