Header sentence, line 13 wrap, bidi escapes in three files, inertCheck U+200E/U+200F. Patch and evidence only; the change is not applied to the tree. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
12 lines
638 B
JavaScript
12 lines
638 B
JavaScript
// Row 102 (#1596) N3: replace each literal bidi control character on the named line of the
|
||
// named file with its \u escape. Usage: node escape-bidi.mjs <file> <line>
|
||
import { readFileSync, writeFileSync } from 'node:fs';
|
||
const [file, lineNo] = process.argv.slice(2);
|
||
const BIDI = /[--]/gu;
|
||
const lines = readFileSync(file, 'utf8').split('\n');
|
||
const i = Number(lineNo) - 1;
|
||
const before = lines[i];
|
||
lines[i] = before.replace(BIDI, (c) => '\\u' + c.codePointAt(0).toString(16).padStart(4, '0'));
|
||
if (lines[i] === before) throw new Error(`${file}:${lineNo}: no bidi character`);
|
||
writeFileSync(file, lines.join('\n'));
|