diff --git a/README.md b/README.md index 907028a..3ac8840 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Where * **data** is a translation object either got from parsing a PO/MO file or composed by other means * **options** is a configuration object with possible values - * **foldLength** is the length at which to fold message strings into newlines (default: 76). Set to 0 or false to disable folding. + * **foldLength** is the page width at which to fold message strings into newlines (default: 79). Set to 0 or false to disable folding. * **sort** (boolean|Function) - (default `false`) if `true`, entries will be sorted by msgid in the resulting .po(.pot) file. If a comparator function is provided, that function will be used to sort entries in the output. The function is called with two arguments, each of which is a single message entry with the structure described below. The function should follow the standard rules for functions passed to `Array.sort()`: return `0` if the entries are interchangeable in sort order; return a number less than 0 if the first entry should come before the second one; and return a number greater than 0 if the second entry should come before the first one. * **escapeCharacters** (boolean) - (default `true`) if `false`, will skip escape newlines and quotes characters functionality. diff --git a/lib/pocompiler.js b/lib/pocompiler.js index d0803ac..464495f 100644 --- a/lib/pocompiler.js +++ b/lib/pocompiler.js @@ -45,7 +45,7 @@ function Compiler (table = {}, options = {}) { this._table.headers = headers; if (!('foldLength' in this._options)) { - this._options.foldLength = 76; + this._options.foldLength = 79; } if (!('escapeCharacters' in this._options)) { @@ -154,7 +154,8 @@ Compiler.prototype._drawBlock = function (block, override = {}, obsolete = false * @return {String} Joined and escaped key-value pair */ Compiler.prototype._addPOString = function (key = '', value = '', obsolete = false) { - key = key.toString(); + const name = key.toString(); + key = name; if (obsolete) { key = '#~ ' + key; } @@ -172,32 +173,17 @@ Compiler.prototype._addPOString = function (key = '', value = '', obsolete = fal value = value.replace(/\n/g, '\\n'); // need to escape new line characters regardless - let lines = [value]; + const lines = foldLength > 0 || escapeCharacters ? foldLine(value, foldLength, { name, obsolete }) : [value]; if (obsolete) { eol = eol + '#~ '; } - if (foldLength > 0) { - lines = foldLine(value, foldLength); - } else { - // split only on new lines - if (escapeCharacters) { - lines = value.split(/\\n/g); - for (let i = 0; i < lines.length - 1; i++) { - lines[i] = `${lines[i]}\\n`; - } - if (lines.length && lines[lines.length - 1] === '') { - lines.splice(-1, 1); - } - } - } - if (lines.length < 2) { - return `${key} "${lines.shift() || ''}"`; + return `${key} "${lines[0] || ''}"`; } - return `${key} ""${eol}"${lines.join(`"${eol}"`)}"`; + return `${key} "${lines[0]}"${eol}"${lines.slice(1).join(`"${eol}"`)}"`; }; /** diff --git a/lib/shared.js b/lib/shared.js index 2151c42..62d2e3a 100644 --- a/lib/shared.js +++ b/lib/shared.js @@ -1,3 +1,5 @@ +import { LBP, LBP_TABLE, LBP_CLASS_DATA, LBP_WIDE_DATA, LBP_NONSPACING_DATA } from './unicode-data.js'; + // see https://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html const PLURAL_FORMS = 'Plural-Forms'; export const HEADERS = new Map([ @@ -96,51 +98,358 @@ export function formatCharset (charset = 'iso-8859-1', defaultCharset = 'iso-885 .trim(); } -/** - * Folds long lines according to PO format - * - * @param {String} str PO formatted string to be folded - * @param {Number} [maxLen=76] Maximum allowed length for folded lines - * @return {Array} An array of lines - */ -export function foldLine (str, maxLen = 76) { - const lines = []; - const len = str.length; - let curLine = ''; - let pos = 0; - let match; - - while (pos < len) { - curLine = str.substr(pos, maxLen); - - // ensure that the line never ends with a partial escaping - // make longer lines if needed - while (curLine.substr(-1) === '\\' && pos + curLine.length < len) { - curLine += str.charAt(pos + curLine.length); +// JavaScript port of the line wrapping the GNU gettext tools use for PO +// output: wrap() in gettext-tools/src/write-po.c, plus the unilbrk +// (UAX #14) and uniwidth code it relies on, as of gettext 1.0. + +const BREAK_PROHIBITED = 0; +const BREAK_POSSIBLE = 1; +const BREAK_MANDATORY = 2; + +const LBP_CLASSES = decodeRanges(LBP_CLASS_DATA, true); +const LBP_WIDE = decodeRanges(LBP_WIDE_DATA, false); +const LBP_NONSPACING = decodeRanges(LBP_NONSPACING_DATA, false); + +// Decodes the range data in lib/unicode-data.js. The format is a +// comma-separated list of `gap:length` or `gap:length:value` hex tuples, +// where `gap` is the distance from the end of the previous range. +function decodeRanges (data, withClass) { + const ranges = []; + let prevEnd = -1; + + for (const part of data.split(',')) { + const [gap, len, cls] = part.split(':').map(n => parseInt(n, 16)); + const start = prevEnd + gap; + + ranges.push(withClass ? [start, start + len, cls] : [start, start + len]); + prevEnd = start + len; + } + + return ranges; +} + +// (class << 1) | east-asian-wide of a single code point, like +// unilbrkprop_lookup() in unilbrk/lbrktables.h +function lbpEntry (cp) { + let lo = 0; + let hi = LBP_CLASSES.length - 1; + + while (lo <= hi) { + const mid = (lo + hi) >> 1; + const range = LBP_CLASSES[mid]; + + if (cp < range[0]) { + hi = mid - 1; + } else if (cp > range[1]) { + lo = mid + 1; + } else { + return range[2]; + } + } + + return LBP.XX << 1; +} + +function inRanges (ranges, cp) { + let lo = 0; + let hi = ranges.length - 1; + + while (lo <= hi) { + const mid = (lo + hi) >> 1; + const range = ranges[mid]; + + if (cp < range[0]) { + hi = mid - 1; + } else if (cp > range[1]) { + lo = mid + 1; + } else { + return true; + } + } + + return false; +} + +// Display width of a code point, like uc_width() in uniwidth/width.c +function charWidth (cp) { + if (inRanges(LBP_NONSPACING, cp)) { + return cp > 0 && cp < 0xa0 ? -1 : 0; + } + + return inRanges(LBP_WIDE, cp) ? 2 : 1; +} + +const isQuote = prop => prop === LBP.QU1 || prop === LBP.QU2 || prop === LBP.QU3; +const isAkAl2As = prop => prop === LBP.AK || prop === LBP.AL2 || prop === LBP.AS; +const isLineStart = prop => prop === LBP.BK || prop === LBP.CR || prop === LBP.LF || + prop === LBP.SP || prop === LBP.ZW; + +// (LB15b) a final quotation mark stays QU3 only before one of these classes +const QU3_FOLLOWERS = new Set([LBP.BK, LBP.CR, LBP.LF, LBP.SP, LBP.GL, LBP.WJ, LBP.CL, + LBP.QU1, LBP.QU2, LBP.QU3, LBP.CP1, LBP.CP2, LBP.EX, LBP.IS, LBP.SY, LBP.ZW]); +// (LB15a) an initial quotation mark stays QU2 only after one of these classes +const QU2_PRECEDERS = new Set([LBP.BK, LBP.CR, LBP.LF, LBP.OP1, LBP.OP2, + LBP.QU1, LBP.QU2, LBP.QU3, LBP.GL, LBP.SP, LBP.ZW]); + +// Marks candidate break positions in a portion, a port of +// u8_possible_linebreaks_loop() from unilbrk for a non-CJK encoding. +// `chars` is an array of code points and `prohibited` a set of indices that +// must never break. +function possibleLinebreaks (chars, prohibited) { + const n = chars.length; + const entries = chars.map(lbpEntry); + const marks = new Array(n).fill(BREAK_PROHIBITED); + + let precedingProp = LBP.BK; // class of the preceding character + let prevProp = LBP.BK; // class of the previous character, ignoring CM and ZWJ + let prevEa = 0; // east-asian-wide bit of the previous character + let prev2Ea = 0; // east-asian-wide bit of the character before that + let prevInitialHyphen = false; // the previous character was a word-initial hyphen + let prevNus = false; // NU (SY | IS)* ended before the previous character + let lastProp = LBP.BK; // class of the last character, ignoring SP, CM and ZWJ + let seenSpace = false; // a space came after the last non-space character + let riCount = 0; + + for (let i = 0; i < n; i++) { + let prop = entries[i] >> 1; + const ea = entries[i] & 1; + const next1 = i + 1 < n ? entries[i + 1] >> 1 : LBP.BK; + const next1Ea = i + 1 < n ? entries[i + 1] & 1 : 0; + const next2 = i + 2 < n ? entries[i + 2] >> 1 : LBP.BK; + const nus = prevProp === LBP.NU || (prevNus && (prevProp === LBP.SY || prevProp === LBP.IS)); + + if (prop === LBP.BK || prop === LBP.LF || prop === LBP.CR) { + // (LB4, LB5, LB6) Mandatory break + marks[i] = BREAK_MANDATORY; + lastProp = LBP.BK; + seenSpace = false; + } else { + // Resolve classes whose behaviour is not fixed + if (prop === LBP.AI || prop === LBP.SA1 || prop === LBP.XX) { + prop = LBP.AL1; + } else if (prop === LBP.CB) { + prop = LBP.ID; + } + + if (prop === LBP.SP) { + // (LB7) Don't break just before a space + seenSpace = true; + } else if (prop === LBP.ZW) { + // (LB7) Don't break just before a zero-width space + lastProp = LBP.ZW; + seenSpace = false; + } else if (prop === LBP.CM || prop === LBP.SA2 || prop === LBP.ZWJ) { + // (LB9) Don't break just before a combining character or zero-width + // joiner, except after a mandatory break, space or zero-width space + if (lastProp === LBP.BK) { + // (LB10) Treat CM or ZWJ as AL + lastProp = LBP.AL1; + seenSpace = false; + } else if (lastProp === LBP.ZW || + (seenSpace && lastProp !== LBP.OP1 && lastProp !== LBP.OP2 && lastProp !== LBP.QU2)) { + // (LB8, LB18) Break after zero-width space or spaces, unless + // (LB14) or (LB15a) apply + marks[i] = BREAK_POSSIBLE; + lastProp = LBP.AL1; + seenSpace = false; + } + } else { + if (lastProp === LBP.BK) { + // (LB4, LB5, LB6) Don't break at the beginning of a line + } else if (lastProp === LBP.ZW) { + // (LB8) Break after zero-width space + marks[i] = BREAK_POSSIBLE; + } else if (precedingProp === LBP.ZWJ) { + // (LB8a) Don't break right after a zero-width joiner + } else if (prop === LBP.IS && prevProp === LBP.SP && next1 === LBP.NU) { + // (LB15c) Break before a decimal mark that follows a space + marks[i] = BREAK_POSSIBLE; + } else if ((isQuote(prop) && (!prevEa || !next1Ea) && prevProp !== LBP.SP) || + (isQuote(prevProp) && (!prev2Ea || !ea))) { + // (LB19a) Don't break on either side of ambiguous quotation marks, + // except next to an east asian character + } else if (prevInitialHyphen && (prop === LBP.AL1 || prop === LBP.AL2 || prop === LBP.HL)) { + // (LB20a) Don't break after a word-initial hyphen + } else if (prevProp === LBP.HL_HY && prop !== LBP.HL) { + // (LB21a) Don't break after Hebrew + hyphen, before non-Hebrew + } else if ((prevNus && (prevProp === LBP.CL || prevProp === LBP.CP1 || prevProp === LBP.CP2) && + (prop === LBP.PO || prop === LBP.PR)) || + (nus && (prop === LBP.PO || prop === LBP.PR || prop === LBP.NU))) { + // (LB25) Don't break numbers + } else if ((prevProp === LBP.PO || prevProp === LBP.PR) && + (prop === LBP.OP1 || prop === LBP.OP2) && + (next1 === LBP.NU || (next1 === LBP.IS && next2 === LBP.NU))) { + // (LB25) Don't break numbers + } else if (prevProp === LBP.AKLS_VI && (prop === LBP.AK || prop === LBP.AL2)) { + // (LB28a) Don't break inside orthographic syllables of Brahmic scripts + } else if (next1 === LBP.VF && isAkAl2As(prop) && isAkAl2As(prevProp)) { + // (LB28a) Don't break inside orthographic syllables of Brahmic scripts + } else if (lastProp === LBP.IS && chars[i] === 0x3c) { + // GNU partially disables (LB29) to allow a break before an HTML + // tag in strings like "

Some sentence.

" + marks[i] = BREAK_POSSIBLE; + } else if (lastProp === LBP.RI && prop === LBP.RI) { + // (LB30a) Break between regional indicators only after an even count + if (seenSpace || riCount % 2 === 0) { + marks[i] = BREAK_POSSIBLE; + } + } else { + // (LB15b) Treat QU3 as QU1 unless a closing class follows + const thisProp = prop === LBP.QU3 && !QU3_FOLLOWERS.has(next1) ? LBP.QU1 : prop; + const t = LBP_TABLE[lastProp][thisProp]; + + if (t === 'D' || (t === 'I' && seenSpace)) { + marks[i] = BREAK_POSSIBLE; + } + } + + // (LB15a) Treat QU2 as QU1 unless an opening class precedes + if (prop === LBP.QU2 && !QU2_PRECEDERS.has(prevProp)) { + prop = LBP.QU1; + } + + lastProp = prop; + seenSpace = false; + } } - // ensure that if possible, line breaks are done at reasonable places - if ((match = /.*?\\n/.exec(curLine))) { - // use everything before and including the first line break - curLine = match[0]; - } else if (pos + curLine.length < len) { - // if we're not at the end - if ((match = /.*\s+/.exec(curLine)) && /[^\s]/.test(match[0])) { - // use everything before and including the last white space character (if anything) - curLine = match[0]; - } else if ((match = /.*[\x21-\x2f0-9\x5b-\x60\x7b-\x7e]+/.exec(curLine)) && /[^\x21-\x2f0-9\x5b-\x60\x7b-\x7e]/.test(match[0])) { - // use everything before and including the last "special" character (if anything) - curLine = match[0]; + // (LB9) Treat X (CM | ZWJ)* as if it were X + if (!((prop === LBP.CM || prop === LBP.ZWJ) && !isLineStart(prevProp))) { + prevInitialHyphen = (prop === LBP.HY || prop === LBP.HH) && + (isLineStart(prevProp) || prevProp === LBP.CB || prevProp === LBP.GL); + if (prop === LBP.VI && isAkAl2As(prevProp)) { + prevProp = LBP.AKLS_VI; + } else if (prevProp === LBP.HL && (prop === LBP.HY || prop === LBP.HH)) { + prevProp = LBP.HL_HY; + } else { + prevProp = prop; } + prev2Ea = prevEa; + prevEa = ea; + prevNus = nus; } - lines.push(curLine); - pos += curLine.length; + precedingProp = prop; + riCount = prop === LBP.RI ? riCount + 1 : 0; } - return lines; + for (const i of prohibited) { + marks[i] = BREAK_PROHIBITED; + } + + return marks; +} + +// Greedy packing of a portion into lines of at most `width` columns, a port +// of u8_width_linebreaks_internal() from unilbrk. Returns the indices of the +// characters that start a new line. +function widthLinebreaks (chars, prohibited, width, startColumn) { + const marks = possibleLinebreaks(chars, prohibited); + const breakAt = []; + let lastP = -1; + let lastColumn = startColumn; + let pieceWidth = 0; + + for (let i = 0; i < chars.length; i++) { + const mark = marks[i]; + + if (mark === BREAK_POSSIBLE || mark === BREAK_MANDATORY) { + if (lastP !== -1 && lastColumn + pieceWidth > width) { + breakAt.push(lastP); + lastColumn = 0; + } + } + + if (mark === BREAK_MANDATORY) { + lastP = -1; + lastColumn = 0; + pieceWidth = 0; + } else { + if (mark === BREAK_POSSIBLE) { + lastP = i; + lastColumn += pieceWidth; + pieceWidth = 0; + } + const w = charWidth(chars[i]); + if (w >= 0) { + pieceWidth += w; + } + } + } + + if (lastP !== -1 && lastColumn + pieceWidth > width) { + breakAt.push(lastP); + } + + return breakAt; } +export function foldLine (str, maxLen = 79, { name = 'msgid', obsolete = false } = {}) { + const startColAfterBreak = (obsolete ? 3 : 0) + 1; + const width = maxLen > 0 ? maxLen - 1 - startColAfterBreak : Number.MAX_SAFE_INTEGER; + + // Split the escaped value into portions, like wrap() does on '\n' + // characters before escaping. Every `\n` escape ends a portion, and the + // characters inside escape sequences are never break positions. + const portions = []; + let chars = []; + let prohibited = new Set(); + const it = str[Symbol.iterator](); + let prev = it.next(); + + while (!prev.done) { + const ch = prev.value; + chars.push(ch.codePointAt(0)); + + if (ch === '\\') { + const next = it.next(); + + if (!next.done) { + chars.push(next.value.codePointAt(0)); + prohibited.add(chars.length - 1); + + if (next.value === 'n') { + prohibited.add(chars.length - 2); + portions.push({ chars, prohibited }); + chars = []; + prohibited = new Set(); + } + } + } + prev = it.next(); + } + // GNU only looks at non-empty text after the last portion separator + if (chars.length || !portions.length) { + portions.push({ chars, prohibited }); + } + + const lines = []; + let firstLine = true; + + for (let pi = 0; pi < portions.length; pi++) { + const { chars, prohibited } = portions[pi]; + const startCol = firstLine ? name.length + 1 : 0; + let breakAt = widthLinebreaks(chars, prohibited, width, startCol); + + if (firstLine && chars.length && + (pi < portions.length - 1 || startCol > width || breakAt.length)) { + // GNU emits an empty string after the keyword when the value wraps + lines.push(''); + breakAt = widthLinebreaks(chars, prohibited, width, 0); + } + firstLine = false; + + let pos = 0; + const strChars = chars.map(cp => String.fromCodePoint(cp)); + for (const at of breakAt) { + lines.push(strChars.slice(pos, at).join('')); + pos = at; + } + lines.push(strChars.slice(pos).join('')); + } + + return lines; +} /** * Comparator function for comparing msgid * diff --git a/lib/unicode-data.js b/lib/unicode-data.js new file mode 100644 index 0000000..c9b7166 --- /dev/null +++ b/lib/unicode-data.js @@ -0,0 +1,117 @@ +// Generated by scripts/generate-unicode-data.js. Do not edit. +// Source: GNU gettext 1.0 (gnulib unilbrk and uniwidth tables, Unicode 17.0.0) + +// Line break classes, as in gnulib unilbrk/lbrktables.h +export const LBP = { + BK: 43, + CR: 44, + LF: 45, + CM: 46, + WJ: 0, + ZW: 47, + GL: 1, + SP: 48, + B2: 2, + BA: 3, + BB: 4, + HH: 5, + HY: 6, + CB: 49, + CL: 7, + CP1: 8, + CP2: 9, + EX: 10, + IN: 11, + NS: 12, + OP1: 13, + OP2: 14, + QU1: 15, + QU2: 16, + QU3: 17, + IS: 18, + NU: 19, + PO: 20, + PR: 21, + SY: 22, + AI: 50, + AL1: 23, + AL2: 24, + H2: 25, + H3: 26, + HL: 32, + ID: 27, + EBF: 28, + JL: 29, + JV: 30, + JT: 31, + AP: 33, + AK: 34, + AS: 35, + VI: 36, + VF: 37, + RI: 38, + SA1: 51, + SA2: 39, + ZWJ: 40, + EB: 41, + EM: 42, + XX: 52, + AKLS_VI: 100, + HL_HY: 101 +}; + +// Pair table indexed by [before][after] class: P(rohibited), I(ndirect) or D(irect) break +export const LBP_TABLE = [ + 'PIIIIIIPPPPIIIIIIPPIIIPIIIIIIIIIIIIIIIIIIII', + 'PIIIIIIPPPPIIIIIIPPIIIPIIIIIIIIIIIIIIIIIIII', + 'PIPIDIIPPPPIIDDIDPPDDDPDDDDDDDDDDDDDDDDDDDD', + 'PDDIDIIPPPPIIDDIDPPDDDPDDDDDDDDDDDDDDDDDDDD', + 'PIIIIIIPPPPIIIIIIPPIIIPIIIIIIIIIIIIIIIIIIII', + 'PDDIDIIPPPPIIDDIDPPDDDPDDDDDDDDDDDDDDDDDDDD', + 'PDDIDIIPPPPIIDDIDPPIDDPDDDDDDDDDDDDDDDDDDDD', + 'PIDIDIIPPPPIPDDIDPPDDDPDDDDDDDDDDDDDDDDDDDD', + 'PIDIDIIPPPPIPDDIDPPIDDPIIDDDDDDDIDDDDDDDIDD', + 'PIDIDIIPPPPIPDDIDPPDDDPDDDDDDDDDDDDDDDDDDDD', + 'PIDIDIIPPPPIIDDIDPPDDDPDDDDDDDDDDDDDDDDDDDD', + 'PIDIDIIPPPPIIDDIDPPDDDPDDDDDDDDDDDDDDDDDDDD', + 'PIDIDIIPPPPIIDDIDPPDDDPDDDDDDDDDDDDDDDDDDDD', + 'PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP', + 'PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP', + 'PIIIIIIPPPPIIIIIIPPIIIPIIIIIIIIIIIIIIIIIIII', + 'PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP', + 'PIDIDIIPPPPIIDDIDPPDDDPDDDDDDDDDDDDDDDDDDDD', + 'PIDIDIIPPPPIIDDIDPPIDDPIIDDDDDDDIDDDDDDDIDD', + 'PIDIDIIPPPPIIIDIDPPDDDPIIDDDDDDDIDDDDDDDIDD', + 'PIDIDIIPPPPIIDDI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PPPIIDDIDPPDIDPDDDDDDDDDDDDDDDDDDDD' +]; + +// Code point ranges with their (class << 1) | east-asian-wide value; others are XX +export const LBP_CLASS_DATA = '1:8:5c,1:0:6,1:0:5a,1:1:56,1:0:58,1:11:5c,1:0:60,1:0:14,1:0:1e,1:0:2e,1:0:2a,1:0:28,1:0:2e,1:0:1e,1:0:1a,1:0:10,1:0:2e,1:0:2a,1:0:24,1:0:c,1:0:24,1:0:2c,1:9:26,1:1:24,1:2:2e,1:0:14,1:1a:2e,1:0:1a,1:0:2a,1:0:10,1:1c:2e,1:0:1a,1:0:6,1:0:e,1:0:2e,1:5:5c,1:0:56,1:19:5c,1:0:2,1:0:1a,1:0:28,1:2:2a,1:0:2e,1:1:64,1:0:2e,1:0:64,1:0:20,1:0:2e,1:0:6,1:1:2e,1:0:28,1:0:2a,1:1:64,1:0:8,1:0:2e,1:4:64,1:0:22,1:2:64,1:0:1a,1:16:2e,1:0:64,1:1e:2e,1:0:64,1:1ce:2e,1:0:64,1:0:8,1:2:64,1:0:8,1:0:64,1:1:2e,1:0:64,1:6:2e,1:3:64,1:0:2e,1:0:64,1:0:2e,1:0:8,1:1f:2e,1:5b:5c,1:6:2,1:c:5c,1:7:2e,3:3:2e,1:0:24,1:0:2e,5:6:2e,2:0:2e,2:13:2e,2:df:2e,1:6:5c,1:a5:2e,2:25:2e,3:2f:2e,1:0:24,1:0:a,3:1:2e,1:0:2a,2:2c:5c,1:0:a,1:0:5c,1:0:2e,1:1:5c,1:0:2e,1:1:5c,1:0:14,1:0:5c,9:1a:40,5:3:40,1:1:2e,c:5:26,1:2:2e,1:2:28,1:1:24,1:1:2e,1:a:5c,1:0:14,1:0:5c,1:2:14,1:2a:2e,1:14:5c,1:9:26,1:0:28,1:1:26,1:2:2e,1:0:5c,1:62:2e,1:0:14,1:0:2e,1:6:5c,1:0:26,1:0:2e,1:5:5c,1:1:2e,1:1:5c,1:0:2e,1:3:5c,1:1:2e,1:9:26,1:13:2e,2:1:2e,1:0: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,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,1:0:33,1:1a:35,d:16:3c,5:30:3e,2105:1ff:37,1:6:2e,d:4:2e,6:0:40,1:0:5c,1:9:40,1:0:2e,1:c:40,2:4:40,2:0:40,2:1:40,2:1:40,2:9:40,1:1ed:2e,1:0:e,1:0:1a,1:8f:2e,21:b:2e,1:0:28,1:2:2e,1:f:5c,1:2:f,1:1:19,1:1:15,1:0:1d,1:0:f,1:0:17,7:0:2,1:0:5c,1:0:2,1:0:5c,1:0:2,1:0:5c,1:1:2,1:0:5c,1:0:2,1:0:5c,1:0:2,1:0:5c,1:1:2,1:0:5c,1:4:37,1:0:1d,1:0:f,1:0:1d,1:0:f,1:0:1d,1:0:f,1:0:1d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1:b:36,1:8:37,1:0:36,1:45:37,1:0:36,1:6:37,1:0:53,1:d:37,1:7:36,1:1:2e,1:1:36,1:14:37,1:1:2f,1:4:37,1:0:2f,1:4:37,1:2:53,1:1:37,1:0:53,1:1:37,1:0:53,1:1:52,1:1:36,1:4:37,1:b:36,1:10:37,1:2:36,1:0:37,1:2:36,1:2:37,1:4:55,1:3e:37,1:0:36,1:0:37,1:0:36,1:1:53,1:1:37,1:a:53,1:14:37,1:12:53,1:2:37,1:0:53,1:3:37,1:2:53,1:0:37,1:2:53,1:6:37,1:0:53,1:0:37,1:0:53,1:d:37,1:0:2f,1:0:37,1:0:2f,1:0:37,1:0:2f,1:4:37,1:0:53,1:3:37,1:0:2f,1:0:37,1:1:2f,1:49:37,1:1:36,1:0:37,1:6:2f,1:f:37,1:d:2f,1:c:37,1:b:2f,1:b:2e,1:0:36,1:3:37,1:0:36,1:17:37,1:b:36,1:1:52,1:3:36,1:0:53,1:14:36,1:0:52,1:3:36,1:1:53,1:c:36,1:0:37,1:2e:36,1:7:2e,1:17:36,1:5:2e,1:0:36,1:49:37,1:2:53,1:2:37,1:4:53,1:25:2e,1:2:1e,1:2:18,1:3:2e,1:22:37,1:0:53,1:f:37,1:2:53,1:8:37,1:0:53,1:4:37,1:5:36,1:0:53,1:2:36,1:2:37,1:1:36,1:3:37,1:2:38,1:3:37,1:a:36,1:1:37,1:2:38,1:3:36,1:8:37,1:2:38,1:73:2e,1:2:36,1:3:2e,1:4:36,1:54:2e,1:4:36,1:5:38,1:b:37,1:3:38,1:0:37,1:e:38,1:b:2e,1:3:38,1:37:2e,1:7:38,1:9:2e,1:5:38,1:27:2e,1:7:38,1:1d:2e,1:1:38,1:b:2e,1:3:38,1:1:2e,1:d:38,1:8:2e,1:26:38,1:b:2e,1:0:53,1:1:37,1:0:53,1:7:37,1:7:53,1:5:37,1:0:53,1:8:37,1:9:53,1:0:37,1:0:36,1:2:53,1:6:37,1:0:36,1:2f:37,1:0:53,1:3c:37,1:1:53,1:0:37,1:1:53,1:0:37,1:0:53,1:10:37,1:2:53,1:0:37,1:c:53,1:21:37,1:57:2e,1:7:38,1:d:36,1:1:38,1:c:37,1:2:38,1:a:37,1:2:38,1:34:37,1:2:53,1:0:37,1:0:38,1:0:37,1:3:38,1:f:37,1:1:38,1:b:37,1:3:38,1:0:37,1:8:53,1:6:38,1:92:2e,2:5b:2e,1:9:26,1:0:2e,6:3fd:38,3:fffd:37,3:fffd:37,a0004:0:5c,1f:5f:5c,81:ef:5c'; + +// Code point ranges that are 2 columns wide +export const LBP_WIDE_DATA = '1101:5f,11bb:1,e:1,bf:3,4:0,3:0,20a:1,16:1,33:b,2c:0,14:0,e:0,9:1,12:1,6:1,9:0,6:0,16:0,8:1,2:0,5:0,3:0,8:0,5:1,1d:0,24:0,2:0,5:2,2:0,3e:2,19:0,f:0,35c:1,34:0,5:0,32b:1a9,5:10,2:58,3:1ac,9:1b6f,41:56cf,491:1c,284:2ba3,215d:1ff,311:f,11:3f,91:60,80:6,6ffa:3,d:1,f:17f7,9:4d5,2b:8,22e8:3,2:6,2:1,2:122,2e:2,12:3,9:18b,3d09:0,cb:0,bf:0,3:9,66:120,d:8,2:45,2:15,d:2a,5:4,d:10,4:0,4:46,2:0,2:ba,3:3e,e:3,2:17,13:0,1b:1,e:0,57:54,31:45,7:0,4:2,3:2,6:2,c:1,8:8,e4:b,5:0,11c:2e,2:9,2:b8,71:4,4:4,4:6,a:1c,4:a,6:5,b:9,7:7,9:6,50a:1ffff'; + +// Code point ranges that are non-spacing or control characters +export const LBP_NONSPACING_DATA = '1:1f,60:20,e:0,253:6f,114:6,108:2c,2:0,2:1,2:1,2:0,49:a,2:0,2f:14,11:0,66:6,3:5,3:1,2:3,24:0,1f:1a,5c:a,3b:8,a:0,19:3,2:8,2:2,2:4,2c:2,3c:8,2b:17,2:1f,38:0,2:0,5:7,5:0,4:6,b:1,1e:0,3b:0,5:3,9:0,15:1,1b:0,3:1,3a:0,5:1,5:1,3:2,4:0,1f:1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3,2:4,104:8,2:1,101:1,2:0,5:0,91:3,3:1,5:0,21:5,3:1,29:5,3:3,9:0,a:5,3:2,2f:c,2:1,c7:0,2:2,2:0,ca:6,2:5,55:15,3:6,2:1,2:1,7b:5,4:0,2:1,2:6,2:0,49:1,4:0,2:0,15c:1,c:1,35:4,6:0,2:0,18:0,14d6:10,7:e,2cc9:b,4:2,9c1:4,3c:6,419:0,40:3,52:0,4cb9:1,2:3,125d:2d,3:16,221:2,a:f,3:6,1f:3,95:2,7bc:36,5:31,9:0,f:0,17:4,2:e,551:6,2:10,3:6,2:1,2:4,65:0,a1:6,178:0,3e:3,1fd:3,ff:1,f4:0,3:0,8:1,6:0,1db:6,6e:6,c16b7:0,1f:5f,81:ef'; diff --git a/package.json b/package.json index 8166824..1e64ac2 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,10 @@ "node": ">=20" }, "scripts": { - "lint": "eslint lib/*.js test/*.js index.js", + "lint": "eslint lib/*.js test/*.js scripts/*.js index.js", "test-generate-mo": "msgfmt test/fixtures/latin13.po -o test/fixtures/latin13.mo & msgfmt test/fixtures/utf8.po -o test/fixtures/utf8.mo & msgfmt test/fixtures/obsolete.po -o test/fixtures/obsolete.mo", + "test-generate-po": "msgcat test/fixtures/wrapping.po -o test/fixtures/wrapping-msgcat.po", + "generate-unicode-data": "node scripts/generate-unicode-data.js", "test": "node --test", "preversion": "npm run lint && npm test", "postversion": "git push && git push --tags" diff --git a/scripts/generate-unicode-data.js b/scripts/generate-unicode-data.js new file mode 100644 index 0000000..6b5c282 --- /dev/null +++ b/scripts/generate-unicode-data.js @@ -0,0 +1,228 @@ +// Generates lib/unicode-data.js from the line breaking and character width +// tables bundled with a GNU gettext source release. +// +// Usage: npm run generate-unicode-data -- + +import { readFileSync, writeFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const srcDir = process.argv[2]; + +if (!srcDir) { + console.error('Usage: node scripts/generate-unicode-data.js '); + process.exit(1); +} + +const gnulib = path.join(srcDir, 'gettext-tools/gnulib-lib'); +const read = file => readFileSync(path.join(gnulib, file), 'utf8'); +const outFile = path.join(path.dirname(fileURLToPath(import.meta.url)), '../lib/unicode-data.js'); + +const gettextVersion = readFileSync(path.join(srcDir, '.tarball-version'), 'utf8').trim(); +const unicodeVersion = /for Unicode ([\d.]+)\./.exec(read('unilbrk/lbrkprop1.h'))[1]; + +// Line break classes, e.g. LBP_AL1 = 23 +const LBP = {}; +for (const [, name, value] of read('unilbrk/lbrktables.h').matchAll(/^\s*LBP_(\w+)\s*=\s*(\d+)/gm)) { + LBP[name] = Number(value); +} + +// Evaluates a C initializer element such as `(LBP_AL1<<1)|0` or +// `5 * sizeof (int) / sizeof (short) + 128` +function evaluate (expr) { + const js = expr + .replace(/sizeof \(int\)/g, '4') + .replace(/sizeof \(short\)/g, '2') + .replace(/LBP_(\w+)/g, (_, name) => LBP[name]) + .replace(/(0x[\da-f]+)U/gi, '$1'); + + if (!/^[\s\dxa-f()+\-*/<|]+$/i.test(js)) { + throw new Error(`Unexpected initializer: ${expr}`); + } + + const value = Function(`return (${js});`)(); + + if (!Number.isInteger(value)) { + throw new Error(`Non-integer initializer: ${expr}`); + } + + return value; +} + +// Returns the elements of the brace initializer starting at `from`, in order +function initializer (text, from = 0) { + const start = text.indexOf('{', text.indexOf('=', from)); + const end = text.indexOf('};', start); + + return text.slice(start, end) + .replace(/\/\*[\s\S]*?\*\//g, '') + .replace(/[{}]/g, ',') + .split(',') + .map(s => s.trim()) + .filter(Boolean) + .map(evaluate); +} + +// Splits a flat struct initializer into its array fields +function fields (declaration, values) { + const result = {}; + let offset = 0; + + for (const [, name, size] of declaration.matchAll(/(\w+)\[([^\]]+)\];/g)) { + const length = evaluate(size); + result[name] = values.slice(offset, offset + length); + offset += length; + } + + if (offset !== values.length) { + throw new Error('Initializer does not match the struct declaration'); + } + + return result; +} + +// unilbrkprop_lookup() in unilbrk/lbrktables.h +const header = {}; +for (const [, n, value] of read('unilbrk/lbrkprop1.h').matchAll(/#define lbrkprop_header_(\d) (\d+)/g)) { + header[n] = Number(value); +} +const lbrkprop = fields(read('unilbrk/lbrkprop1.h').match(/typedef struct\s*{([^}]*)}/)[1], + initializer(read('unilbrk/lbrkprop2.h'))); +const XX_ENTRY = LBP.XX << 1; + +function lbrkpropLookup (uc) { + const index1 = uc >> header[0]; + + if (index1 < header[1]) { + const lookup1 = lbrkprop.level1[index1]; + + if (lookup1 >= 0) { + const lookup2 = lbrkprop.level2[lookup1 + ((uc >> header[2]) & header[3])]; + + if (lookup2 >= 0) { + return lbrkprop.level3[lookup2 + (uc & header[4])]; + } + } + } + + return XX_ENTRY; +} + +// uc_width() in uniwidth/width.c, for a non-CJK encoding +const width0 = read('uniwidth/width0.h'); +const nonspacingData = initializer(width0, width0.indexOf('nonspacing_table_data')); +const nonspacingInd = initializer(width0, width0.indexOf('nonspacing_table_ind')); +const width2Text = read('uniwidth/width2.h'); +const width2 = fields(width2Text.match(/struct\s*{([^}]*)}/)[1], initializer(width2Text)); +// level1 holds offsets in shorts and level2 offsets in ints, both counted +// from the start of the struct +const level2Start = 2 * (width2.header.length + width2.level1.length); +const level3Start = width2.header.length + width2.level1.length + width2.level2.length / 2; + +function isNonspacing (uc) { + if ((uc >> 9) < nonspacingInd.length) { + const ind = nonspacingInd[uc >> 9]; + + return ind >= 0 && ((nonspacingData[64 * ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1) === 1; + } + + if ((uc >> 9) === (0xe0000 >> 9)) { + return uc >= 0xe0100 ? uc <= 0xe01ef : (uc >= 0xe0020 ? uc <= 0xe007f : uc === 0xe0001); + } + + return false; +} + +function isWide (uc) { + const index1 = uc >> 16; + + if (index1 < width2.header[0]) { + const lookup1 = width2.level1[index1]; + + if (lookup1 >= 0) { + const lookup2 = width2.level2[lookup1 - level2Start + ((uc >> 9) & 127)]; + + if (lookup2 >= 0) { + return ((width2.level3[lookup2 - level3Start + ((uc >> 5) & 15)] >>> (uc & 31)) & 1) === 1; + } + } + } + + return false; +} + +// Encodes code point ranges as `gap:length[:value]` hex tuples, where `gap` +// is the distance from the end of the previous range. This is the format +// decodeRanges() in lib/shared.js reads. +function encodeRanges (valueOf, withValue) { + const parts = []; + let prevEnd = -1; + let start = -1; + let current = null; + + for (let uc = 0; uc <= 0x110000; uc++) { + const value = uc < 0x110000 ? valueOf(uc) : null; + + if (value !== current) { + if (current !== null) { + const tuple = [start - prevEnd, uc - 1 - start]; + if (withValue) { + tuple.push(current); + } + parts.push(tuple.map(n => n.toString(16)).join(':')); + prevEnd = uc - 1; + } + start = uc; + current = value; + } + } + + return parts.join(','); +} + +const classData = encodeRanges(uc => { + const entry = lbrkpropLookup(uc); + return entry === XX_ENTRY ? null : entry; +}, true); +const wideData = encodeRanges(uc => !isNonspacing(uc) && isWide(uc) ? true : null, false); +const nonspacingRanges = encodeRanges(uc => isNonspacing(uc) ? true : null, false); + +// unilbrk_table in unilbrk/lbrktables.c, one string of P/I/D per row +const tableText = read('unilbrk/lbrktables.c'); +const table = [...tableText.slice(tableText.indexOf('unilbrk_table')) + .matchAll(/^\/\*\s*\w+\s*\*\/\s*{([^}]*)}/gm)] + .map(([, row]) => row.replace(/[\s,]/g, '')); + +if (table.length !== 43 || table.some(row => row.length !== table.length)) { + throw new Error('Unexpected unilbrk_table shape'); +} + +const names = Object.keys(LBP); +const lines = [ + '// Generated by scripts/generate-unicode-data.js. Do not edit.', + `// Source: GNU gettext ${gettextVersion} (gnulib unilbrk and uniwidth tables, Unicode ${unicodeVersion})`, + '', + '// Line break classes, as in gnulib unilbrk/lbrktables.h', + 'export const LBP = {', + ...names.map((name, i) => ` ${name}: ${LBP[name]}${i < names.length - 1 ? ',' : ''}`), + '};', + '', + '// Pair table indexed by [before][after] class: P(rohibited), I(ndirect) or D(irect) break', + 'export const LBP_TABLE = [', + ...table.map((row, i) => ` '${row}'${i < table.length - 1 ? ',' : ''}`), + '];', + '', + '// Code point ranges with their (class << 1) | east-asian-wide value; others are XX', + `export const LBP_CLASS_DATA = '${classData}';`, + '', + '// Code point ranges that are 2 columns wide', + `export const LBP_WIDE_DATA = '${wideData}';`, + '', + '// Code point ranges that are non-spacing or control characters', + `export const LBP_NONSPACING_DATA = '${nonspacingRanges}';`, + '' +]; + +writeFileSync(outFile, lines.join('\n')); +console.log(`Wrote ${path.relative(process.cwd(), outFile)} from gettext ${gettextVersion}, Unicode ${unicodeVersion}`); diff --git a/test/fixtures/utf8-folding-100.po b/test/fixtures/utf8-folding-100.po index 6735298..68b3207 100644 --- a/test/fixtures/utf8-folding-100.po +++ b/test/fixtures/utf8-folding-100.po @@ -40,8 +40,8 @@ msgstr "t3-žš" # Long message msgid "o4" msgstr "" -"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore " -"et dolore magna aliqua." +"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut " +"labore et dolore magna aliqua." # Normal comment line 1 # Normal comment line 2 diff --git a/test/fixtures/wrapping-msgcat.po b/test/fixtures/wrapping-msgcat.po new file mode 100644 index 0000000..1d2033f --- /dev/null +++ b/test/fixtures/wrapping-msgcat.po @@ -0,0 +1,129 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "short" +msgstr "A short translation that fits on a single line." + +msgid "ascii" +msgstr "" +"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " +"tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, " +"quis nostrud exercitation ullamco laboris." + +msgid "exact-fit" +msgstr "" +"This translation is padded so that the whole line is just about 79 cols" + +msgid "newlines" +msgstr "" +"First line of a multi-line message.\n" +"Second line, which is a bit longer than the first one and therefore needs to " +"be wrapped by the compiler.\n" +"Third line.\n" + +msgid "escapes" +msgstr "" +"Press \"Save\" to store C:\\Users\\name\\Documents\\file.txt, or " +"press\t\"Cancel\" to discard all of the changes made so far." + +msgid "url" +msgstr "" +"See https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html#PO-" +"Files-for-more-information-about-the-format." + +msgid "punctuation" +msgstr "" +"Values (one/two/three), [four|five] and {six-seven-eight} -- plus 100% of " +"$5.00 -- should break at sensible places..." + +msgid "html" +msgstr "" +"@count Members are selected, manage them here." + +msgid "latin" +msgstr "" +"Ça été une très belle journée à Zürich, où les émigrés ont dégusté des " +"crêpes, des smørrebrød et des Käsespätzle." + +msgid "combining" +msgstr "" +"Decomposed accents such as é should not count as extra width: résumé café " +"naïve résumé café naïve." + +msgid "cjk-ja" +msgstr "" +"これは日本語のテキストです。全角文字は半角文字の二倍の幅を持つため、行の折り" +"返し位置が変わります。句読点の前では改行しないでください。" + +msgid "cjk-zh" +msgstr "" +"这是一段中文文本,用于测试换行算法。中文字符占用两个字符宽度,因此每行能容纳" +"的字符数量大约是英文的一半左右。" + +msgid "cjk-ko" +msgstr "" +"이것은 한국어 텍스트입니다. 한글 음절은 전각 문자로 표시되며 줄 바꿈 위치를 " +"결정할 때 너비가 두 배로 계산되어야 합니다." + +msgid "mixed" +msgstr "" +"Mixed content: English text, 日本語のテキスト, 中文文本 and some emoji 😀🎉" +"👍 combined in one long message string." + +msgid "emoji" +msgstr "" +"😀😃😄😁😆😅😂🤣😊😇🙂🙃😉😌😍🥰😘😗😙😚😋😛😝😜🤪🤨🧐🤓😎🥸🤩🥳😏😒😞😔😟😕" +"🙁" + +msgid "no-breaks" +msgstr "Averyveryverylongwordwithoutanyspacesoranypunctuationthatcannotbebrokenanywhereatallreally" + +msgid "singular" +msgid_plural "" +"@count Members are selected" +msgstr[0] "" +"One member is selected, and this sentence is long enough to be wrapped by " +"the compiler." +msgstr[1] "" +"Several members are selected, and this sentence is long enough to be wrapped " +"as well." + +msgid "" +"A long msgid that is also wrapped by the compiler because it does not fit " +"within the page width." +msgstr "" +"Een lange msgid die ook door de compiler wordt afgebroken omdat hij niet " +"binnen de paginabreedte past." + +# Examples from https://github.com/smhg/gettext-parser/issues/51 +msgid "issue-51-books" +msgstr "" +"Books have a built-in hierarchical navigation. Use for handbooks or " +"tutorials." + +msgid "issue-51-branding" +msgstr "" +"Open Social Branding will be replaced by site name (and slogan if " +"available). Upload a logo below." + +msgid "issue-51-mention" +msgstr "" +"You were mentioned in a post by [social_mentions:mentioned_user] in the community." + +msgctxt "" +"a fairly long context string that explains where this message is used in the " +"application" +msgid "context" +msgstr "" +"A translation with a long context, which also needs to be wrapped across " +"several lines." + +#~ msgid "obsolete" +#~ msgstr "" +#~ "An obsolete translation, which keeps the #~ prefix on every line and is " +#~ "long enough to be wrapped." diff --git a/test/fixtures/wrapping.po b/test/fixtures/wrapping.po new file mode 100644 index 0000000..542d0bf --- /dev/null +++ b/test/fixtures/wrapping.po @@ -0,0 +1,78 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "short" +msgstr "A short translation that fits on a single line." + +msgid "ascii" +msgstr "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris." + +msgid "exact-fit" +msgstr "This translation is padded so that the whole line is just about 79 cols" + +msgid "newlines" +msgstr "First line of a multi-line message.\nSecond line, which is a bit longer than the first one and therefore needs to be wrapped by the compiler.\nThird line.\n" + +msgid "escapes" +msgstr "Press \"Save\" to store C:\\Users\\name\\Documents\\file.txt, or press\t\"Cancel\" to discard all of the changes made so far." + +msgid "url" +msgstr "See https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html#PO-Files-for-more-information-about-the-format." + +msgid "punctuation" +msgstr "Values (one/two/three), [four|five] and {six-seven-eight} -- plus 100% of $5.00 -- should break at sensible places..." + +msgid "html" +msgstr "@count Members are selected, manage them here." + +msgid "latin" +msgstr "Ça été une très belle journée à Zürich, où les émigrés ont dégusté des crêpes, des smørrebrød et des Käsespätzle." + +msgid "combining" +msgstr "Decomposed accents such as é should not count as extra width: résumé café naïve résumé café naïve." + +msgid "cjk-ja" +msgstr "これは日本語のテキストです。全角文字は半角文字の二倍の幅を持つため、行の折り返し位置が変わります。句読点の前では改行しないでください。" + +msgid "cjk-zh" +msgstr "这是一段中文文本,用于测试换行算法。中文字符占用两个字符宽度,因此每行能容纳的字符数量大约是英文的一半左右。" + +msgid "cjk-ko" +msgstr "이것은 한국어 텍스트입니다. 한글 음절은 전각 문자로 표시되며 줄 바꿈 위치를 결정할 때 너비가 두 배로 계산되어야 합니다." + +msgid "mixed" +msgstr "Mixed content: English text, 日本語のテキスト, 中文文本 and some emoji 😀🎉👍 combined in one long message string." + +msgid "emoji" +msgstr "😀😃😄😁😆😅😂🤣😊😇🙂🙃😉😌😍🥰😘😗😙😚😋😛😝😜🤪🤨🧐🤓😎🥸🤩🥳😏😒😞😔😟😕🙁" + +msgid "no-breaks" +msgstr "Averyveryverylongwordwithoutanyspacesoranypunctuationthatcannotbebrokenanywhereatallreally" + +msgid "singular" +msgid_plural "@count Members are selected" +msgstr[0] "One member is selected, and this sentence is long enough to be wrapped by the compiler." +msgstr[1] "Several members are selected, and this sentence is long enough to be wrapped as well." + +msgid "A long msgid that is also wrapped by the compiler because it does not fit within the page width." +msgstr "Een lange msgid die ook door de compiler wordt afgebroken omdat hij niet binnen de paginabreedte past." + +# Examples from https://github.com/smhg/gettext-parser/issues/51 +msgid "issue-51-books" +msgstr "Books have a built-in hierarchical navigation. Use for handbooks or tutorials." + +msgid "issue-51-branding" +msgstr "Open Social Branding will be replaced by site name (and slogan if available). Upload a logo below." + +msgid "issue-51-mention" +msgstr "You were mentioned in a post by [social_mentions:mentioned_user] in the community." + +msgctxt "a fairly long context string that explains where this message is used in the application" +msgid "context" +msgstr "A translation with a long context, which also needs to be wrapped across several lines." + +#~ msgid "obsolete" +#~ msgstr "An obsolete translation, which keeps the #~ prefix on every line and is long enough to be wrapped." diff --git a/test/po-compiler-test.js b/test/po-compiler-test.js index 078206d..57847c3 100644 --- a/test/po-compiler-test.js +++ b/test/po-compiler-test.js @@ -94,6 +94,41 @@ describe('PO Compiler', () => { assert.strictEqual(compiled, poData); }); + + // wrapping-msgcat.po is generated by GNU msgcat (npm run test-generate-po) + it('should fold like GNU gettext', async () => { + const [input, expected] = await Promise.all([ + readFile(path.join(__dirname, 'fixtures/wrapping.po')), + readFile(path.join(__dirname, 'fixtures/wrapping-msgcat.po'), 'utf8') + ]); + + const compiled = po.compile(po.parse(input), { eol: EOL }) + .toString('utf8'); + + assert.strictEqual(compiled, expected); + }); + + it('should account for the key prefix width like GNU gettext', () => { + const data = { + charset: 'utf-8', + headers: { 'content-type': 'text/plain; charset=utf-8' }, + translations: { + '': { + 'sing': { + msgid: 'sing', + msgid_plural: '@count Members are selected', + msgstr: ['x', 'y'] + } + } + } + }; + + const compiled = po.compile(data, { eol: EOL }).toString('utf8'); + + // the 65-character plural fits on one line alone, but the whole + // `msgid_plural "..."` line is 82 columns wide so GNU gettext wraps it + assert.ok(compiled.includes(`msgid_plural ""${EOL}"@count Members are selected"`)); + }); }); describe('Sorting', () => { diff --git a/test/shared.js b/test/shared.js index 11d30cd..9091512 100644 --- a/test/shared.js +++ b/test/shared.js @@ -90,22 +90,23 @@ X-Poedit-SourceCharset: UTF-8`; const folded = foldLine(line); assert.strictEqual(line, folded.join('')); - assert.deepStrictEqual(folded, ['abc \\n', 'def \\n', 'ghi']); - assert.strictEqual(folded.length, 3); + assert.deepStrictEqual(folded, ['', 'abc \\n', 'def \\n', 'ghi']); + assert.strictEqual(folded.length, 4); }); it('should fold at default length', () => { - const expected = ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pretium ', + const expected = ['', + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pretium ', 'a nunc ac fringilla. Nulla laoreet tincidunt tincidunt. Proin tristique ', 'vestibulum mauris non aliquam. Vivamus volutpat odio nisl, sed placerat ', 'turpis sodales a. Vestibulum quis lectus ac elit sagittis sodales ac a ', - 'felis. Nulla iaculis, nisl ut mattis fringilla, tortor quam tincidunt ', - 'lorem, quis feugiat purus felis ut velit. Donec euismod eros ut leo ', - 'lobortis tristique.' + 'felis. Nulla iaculis, nisl ut mattis fringilla, tortor quam tincidunt lorem, ', + 'quis feugiat purus felis ut velit. Donec euismod eros ut leo lobortis ', + 'tristique.' ]; const folded = foldLine(expected.join('')); assert.deepStrictEqual(folded, expected); - assert.strictEqual(folded.length, 7); + assert.strictEqual(folded.length, 8); }); it('should force fold white space', () => { @@ -113,8 +114,8 @@ X-Poedit-SourceCharset: UTF-8`; const folded = foldLine(line, 5); assert.strictEqual(line, folded.join('')); - assert.deepStrictEqual(folded, ['abc ', 'def ', 'ghi']); - assert.strictEqual(folded.length, 3); + assert.deepStrictEqual(folded, ['', 'abc ', 'def ', 'ghi']); + assert.strictEqual(folded.length, 4); }); it('should ignore leading spaces', () => { @@ -122,7 +123,7 @@ X-Poedit-SourceCharset: UTF-8`; const folded = foldLine(line, 5); assert.strictEqual(line, folded.join('')); - assert.deepStrictEqual(folded, [' a', 'bc ', 'def ', 'ghi']); + assert.deepStrictEqual(folded, ['', ' abc ', 'def ', 'ghi']); assert.strictEqual(folded.length, 4); }); @@ -131,7 +132,7 @@ X-Poedit-SourceCharset: UTF-8`; const folded = foldLine(line, 5); assert.strictEqual(line, folded.join('')); - assert.deepStrictEqual(folded, ['abcde', 'f--', 'ghi']); + assert.deepStrictEqual(folded, ['', 'abcdef--', 'ghi']); assert.strictEqual(folded.length, 3); }); @@ -140,8 +141,8 @@ X-Poedit-SourceCharset: UTF-8`; const folded = foldLine(line, 10); assert.strictEqual(line, folded.join('')); - assert.deepStrictEqual(folded, ['ab--cdef--', 'ghi']); - assert.strictEqual(folded.length, 2); + assert.deepStrictEqual(folded, ['', 'ab--', 'cdef--', 'ghi']); + assert.strictEqual(folded.length, 4); }); it('should force fold only if at least one non-special character', () => { @@ -149,7 +150,7 @@ X-Poedit-SourceCharset: UTF-8`; const folded = foldLine(line, 5); assert.strictEqual(line, folded.join('')); - assert.deepStrictEqual(folded, ['--abc', 'defgh', 'i']); + assert.deepStrictEqual(folded, ['', '--', 'abcdefghi']); assert.strictEqual(folded.length, 3); }); });