@digitalculture/ochre-sdk 0.4.10 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +15 -11
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +15 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -226,7 +226,7 @@ function parseFakeString(string) {
|
|
|
226
226
|
} else if (typeof string === "boolean") {
|
|
227
227
|
returnString = string ? "Yes" : "No";
|
|
228
228
|
}
|
|
229
|
-
return returnString.replaceAll("'", "'");
|
|
229
|
+
return returnString.replaceAll("'", "'").replaceAll(/^(\d+)\./gm, String.raw`$1\.`);
|
|
230
230
|
}
|
|
231
231
|
function parseStringItem(item) {
|
|
232
232
|
let returnString = "";
|
|
@@ -243,12 +243,16 @@ function parseStringItem(item) {
|
|
|
243
243
|
case "object": {
|
|
244
244
|
const stringItems = Array.isArray(item.string) ? item.string : [item.string];
|
|
245
245
|
for (const stringItem of stringItems) {
|
|
246
|
-
|
|
247
|
-
parseFakeString(stringItem
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
246
|
+
if (typeof stringItem === "string" || typeof stringItem === "number" || typeof stringItem === "boolean") {
|
|
247
|
+
returnString += parseFakeString(stringItem);
|
|
248
|
+
} else {
|
|
249
|
+
const renderedText = stringItem.rend != null ? parseRenderOptions(
|
|
250
|
+
parseFakeString(stringItem.content),
|
|
251
|
+
stringItem.rend
|
|
252
|
+
) : parseFakeString(stringItem.content);
|
|
253
|
+
const whitespacedText = stringItem.whitespace != null ? parseWhitespace(renderedText, stringItem.whitespace) : renderedText;
|
|
254
|
+
returnString += whitespacedText;
|
|
255
|
+
}
|
|
252
256
|
}
|
|
253
257
|
break;
|
|
254
258
|
}
|
|
@@ -257,7 +261,7 @@ function parseStringItem(item) {
|
|
|
257
261
|
break;
|
|
258
262
|
}
|
|
259
263
|
}
|
|
260
|
-
return returnString;
|
|
264
|
+
return returnString.replaceAll(/^(\d+)\./gm, String.raw`$1\.`);
|
|
261
265
|
}
|
|
262
266
|
function parseStringDocumentItem(item, footnotes) {
|
|
263
267
|
if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
|
|
@@ -364,7 +368,7 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
364
368
|
item.whitespace
|
|
365
369
|
);
|
|
366
370
|
}
|
|
367
|
-
return returnString.replaceAll("'", "'");
|
|
371
|
+
return returnString.replaceAll("'", "'").replaceAll(/^(\d+)\./gm, String.raw`$1\.`);
|
|
368
372
|
} else {
|
|
369
373
|
returnString = parseFakeString(item.content);
|
|
370
374
|
if (item.rend != null) {
|
|
@@ -380,7 +384,7 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
380
384
|
);
|
|
381
385
|
}
|
|
382
386
|
}
|
|
383
|
-
return returnString;
|
|
387
|
+
return returnString.replaceAll(/^(\d+)\./gm, String.raw`$1\.`);
|
|
384
388
|
}
|
|
385
389
|
function parseStringContent(content, language = "eng") {
|
|
386
390
|
switch (typeof content.content) {
|
|
@@ -411,7 +415,7 @@ ${JSON.stringify(
|
|
|
411
415
|
}
|
|
412
416
|
}
|
|
413
417
|
default: {
|
|
414
|
-
return String(content.content);
|
|
418
|
+
return String(content.content).replaceAll(/^(\d+)\./gm, String.raw`$1\.`);
|
|
415
419
|
}
|
|
416
420
|
}
|
|
417
421
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -715,7 +715,10 @@ type OchreStringItemContent = {
|
|
|
715
715
|
* Raw string item with language metadata
|
|
716
716
|
*/
|
|
717
717
|
type OchreStringItem = {
|
|
718
|
-
string:
|
|
718
|
+
string:
|
|
719
|
+
| FakeString
|
|
720
|
+
| OchreStringItemContent
|
|
721
|
+
| Array<FakeString | OchreStringItemContent>;
|
|
719
722
|
lang?: Language["iso6393"]; // 3 character code (zxx = "a.k.a.")
|
|
720
723
|
languages?: string; // 3 character codes, semicolon separated
|
|
721
724
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -715,7 +715,10 @@ type OchreStringItemContent = {
|
|
|
715
715
|
* Raw string item with language metadata
|
|
716
716
|
*/
|
|
717
717
|
type OchreStringItem = {
|
|
718
|
-
string:
|
|
718
|
+
string:
|
|
719
|
+
| FakeString
|
|
720
|
+
| OchreStringItemContent
|
|
721
|
+
| Array<FakeString | OchreStringItemContent>;
|
|
719
722
|
lang?: Language["iso6393"]; // 3 character code (zxx = "a.k.a.")
|
|
720
723
|
languages?: string; // 3 character codes, semicolon separated
|
|
721
724
|
};
|
package/dist/index.js
CHANGED
|
@@ -149,7 +149,7 @@ function parseFakeString(string) {
|
|
|
149
149
|
} else if (typeof string === "boolean") {
|
|
150
150
|
returnString = string ? "Yes" : "No";
|
|
151
151
|
}
|
|
152
|
-
return returnString.replaceAll("'", "'");
|
|
152
|
+
return returnString.replaceAll("'", "'").replaceAll(/^(\d+)\./gm, String.raw`$1\.`);
|
|
153
153
|
}
|
|
154
154
|
function parseStringItem(item) {
|
|
155
155
|
let returnString = "";
|
|
@@ -166,12 +166,16 @@ function parseStringItem(item) {
|
|
|
166
166
|
case "object": {
|
|
167
167
|
const stringItems = Array.isArray(item.string) ? item.string : [item.string];
|
|
168
168
|
for (const stringItem of stringItems) {
|
|
169
|
-
|
|
170
|
-
parseFakeString(stringItem
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
if (typeof stringItem === "string" || typeof stringItem === "number" || typeof stringItem === "boolean") {
|
|
170
|
+
returnString += parseFakeString(stringItem);
|
|
171
|
+
} else {
|
|
172
|
+
const renderedText = stringItem.rend != null ? parseRenderOptions(
|
|
173
|
+
parseFakeString(stringItem.content),
|
|
174
|
+
stringItem.rend
|
|
175
|
+
) : parseFakeString(stringItem.content);
|
|
176
|
+
const whitespacedText = stringItem.whitespace != null ? parseWhitespace(renderedText, stringItem.whitespace) : renderedText;
|
|
177
|
+
returnString += whitespacedText;
|
|
178
|
+
}
|
|
175
179
|
}
|
|
176
180
|
break;
|
|
177
181
|
}
|
|
@@ -180,7 +184,7 @@ function parseStringItem(item) {
|
|
|
180
184
|
break;
|
|
181
185
|
}
|
|
182
186
|
}
|
|
183
|
-
return returnString;
|
|
187
|
+
return returnString.replaceAll(/^(\d+)\./gm, String.raw`$1\.`);
|
|
184
188
|
}
|
|
185
189
|
function parseStringDocumentItem(item, footnotes) {
|
|
186
190
|
if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
|
|
@@ -287,7 +291,7 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
287
291
|
item.whitespace
|
|
288
292
|
);
|
|
289
293
|
}
|
|
290
|
-
return returnString.replaceAll("'", "'");
|
|
294
|
+
return returnString.replaceAll("'", "'").replaceAll(/^(\d+)\./gm, String.raw`$1\.`);
|
|
291
295
|
} else {
|
|
292
296
|
returnString = parseFakeString(item.content);
|
|
293
297
|
if (item.rend != null) {
|
|
@@ -303,7 +307,7 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
303
307
|
);
|
|
304
308
|
}
|
|
305
309
|
}
|
|
306
|
-
return returnString;
|
|
310
|
+
return returnString.replaceAll(/^(\d+)\./gm, String.raw`$1\.`);
|
|
307
311
|
}
|
|
308
312
|
function parseStringContent(content, language = "eng") {
|
|
309
313
|
switch (typeof content.content) {
|
|
@@ -334,7 +338,7 @@ ${JSON.stringify(
|
|
|
334
338
|
}
|
|
335
339
|
}
|
|
336
340
|
default: {
|
|
337
|
-
return String(content.content);
|
|
341
|
+
return String(content.content).replaceAll(/^(\d+)\./gm, String.raw`$1\.`);
|
|
338
342
|
}
|
|
339
343
|
}
|
|
340
344
|
}
|
package/package.json
CHANGED