ochre-sdk 1.0.34 → 1.0.36

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.
@@ -47,7 +47,7 @@ function transformPermanentIdentificationUrl(url) {
47
47
  function parseRenderOptions(contentString, renderString, rendering) {
48
48
  const { success, output } = v.safeParse(renderOptionsSchema, renderString);
49
49
  if (!success) return contentString;
50
- if (rendering !== "rich") return contentString.replaceAll("'", "'");
50
+ if (rendering === "plain") return contentString.replaceAll("'", "'");
51
51
  return applyRichRenderOptions(contentString, output).replaceAll("'", "'");
52
52
  }
53
53
  function applyRichRenderOptions(contentString, options) {
@@ -263,14 +263,15 @@ function parseNestedStringItems(items, contentItem, options) {
263
263
  continue;
264
264
  }
265
265
  let rawMDXBlock = "";
266
+ const rawMDXBlockRendering = options.rendering === "plain" ? "plain" : "rawMDX";
266
267
  for (let rawIndex = rawMDXBlockStartIndex + 1; rawIndex < index; rawIndex += 1) {
267
268
  const rawItem = items[rawIndex];
268
269
  if (rawItem != null) rawMDXBlock += parseXMLStringItem(rawItem, contentItem, {
269
270
  languages: options.languages,
270
- rendering: "plain"
271
+ rendering: rawMDXBlockRendering,
272
+ rawMDXBlocks: options.rawMDXBlocks
271
273
  });
272
274
  }
273
- if (item.whitespace?.split(" ").includes("newline") === true) rawMDXBlock += "\n";
274
275
  if (options.rendering === "rich" && options.rawMDXBlocks != null) {
275
276
  const placeholder = `${RAW_MDX_BLOCK_PLACEHOLDER_PREFIX}${options.rawMDXBlocks.length}${RAW_MDX_BLOCK_PLACEHOLDER_SUFFIX}`;
276
277
  options.rawMDXBlocks.push(rawMDXBlock);
@@ -335,7 +336,7 @@ function renderRichTextItem(item, linkString, contentItem, options) {
335
336
  let result = "";
336
337
  for (const link of links) {
337
338
  const linkContent = link.identification != null ? "content" in link.identification.label ? parseXMLContent(link.identification.label, { languages }) : MultilingualString.create(contentItem.lang, parseXMLString(link.identification.label), languages) : MultilingualString.create(contentItem.lang, "", languages);
338
- const contentText = (rendering === "rich" ? linkContent.getExactRichText(contentItem.lang) : linkContent.getExactText(contentItem.lang)) ?? "";
339
+ const contentText = (rendering === "plain" ? linkContent.getExactText(contentItem.lang) : linkContent.getExactRichText(contentItem.lang)) ?? "";
339
340
  if ("type" in link && link.type != null) switch (link.type) {
340
341
  case "IIIF":
341
342
  case "image":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",