@drghaliasri/butex 8.1.3 → 8.1.5

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.
@@ -11187,6 +11187,11 @@ function remapSelectionAfterRangeMove(selection, direction) {
11187
11187
  function mathTex(token, equationSide, digitForm) {
11188
11188
  return mathTokenSourceForSide(token, equationSide, digitForm, true);
11189
11189
  }
11190
+ function projectedBookTarget(options, ownerId, kind) {
11191
+ if (options.mode !== "book-content") return void 0;
11192
+ const book = options.bookContext;
11193
+ return book?.targets?.find((target) => target.unitId === book.unitId && target.ownerId === ownerId && target.kind === kind);
11194
+ }
11190
11195
  function previewInlines(field, islands, output, equationSide, document2, previewOptions) {
11191
11196
  return field.tokens.map((token) => {
11192
11197
  if (token.kind === "text") {
@@ -11218,7 +11223,8 @@ function previewInlines(field, islands, output, equationSide, document2, preview
11218
11223
  })
11219
11224
  };
11220
11225
  }
11221
- const number = collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
11226
+ const projected = projectedBookTarget(previewOptions, token.id, "eq");
11227
+ const number = projected ? void 0 : collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
11222
11228
  const island = {
11223
11229
  id: token.id,
11224
11230
  tex: mathTex(token, equationSide, previewOptions.digitForm),
@@ -11226,7 +11232,7 @@ function previewInlines(field, islands, output, equationSide, document2, preview
11226
11232
  output,
11227
11233
  editable: token.editable
11228
11234
  };
11229
- const numberLabel = number == null ? void 0 : formatBibliographyNumber(number, {
11235
+ const numberLabel = projected ? projected.ordinal : number == null ? void 0 : formatBibliographyNumber(number, {
11230
11236
  documentDirection: previewOptions.documentDirection,
11231
11237
  digitForm: previewOptions.digitForm
11232
11238
  });
@@ -11255,6 +11261,8 @@ function textBlockPreview(block, islands, output, equationSide, document2, previ
11255
11261
  };
11256
11262
  }
11257
11263
  function floatNumberLabel(document2, ownerId, previewOptions) {
11264
+ const projected = projectedBookTarget(previewOptions, ownerId, "fig") ?? projectedBookTarget(previewOptions, ownerId, "tab");
11265
+ if (projected) return projected.displayLabel;
11258
11266
  const hit = collectDocumentReferenceTargets(document2).find((target) => target.ownerId === ownerId);
11259
11267
  if (!hit || hit.number === null || hit.kind !== "fig" && hit.kind !== "tab") {
11260
11268
  return void 0;