@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.
@@ -324,6 +324,7 @@ type DocumentBookTarget = {
324
324
  kind: DocumentLabelKind | 'section' | 'subsection' | 'subsubsection' | 'chapter' | 'appendix';
325
325
  caption?: string;
326
326
  displayLabel?: string;
327
+ ordinal?: string;
327
328
  manualKey?: string;
328
329
  };
329
330
  type DocumentBookContext = {
@@ -324,6 +324,7 @@ type DocumentBookTarget = {
324
324
  kind: DocumentLabelKind | 'section' | 'subsection' | 'subsubsection' | 'chapter' | 'appendix';
325
325
  caption?: string;
326
326
  displayLabel?: string;
327
+ ordinal?: string;
327
328
  manualKey?: string;
328
329
  };
329
330
  type DocumentBookContext = {
@@ -11213,6 +11213,11 @@ function remapSelectionAfterRangeMove(selection, direction) {
11213
11213
  function mathTex(token, equationSide, digitForm) {
11214
11214
  return mathTokenSourceForSide(token, equationSide, digitForm, true);
11215
11215
  }
11216
+ function projectedBookTarget(options, ownerId, kind) {
11217
+ if (options.mode !== "book-content") return void 0;
11218
+ const book = options.bookContext;
11219
+ return book?.targets?.find((target) => target.unitId === book.unitId && target.ownerId === ownerId && target.kind === kind);
11220
+ }
11216
11221
  function previewInlines(field, islands, output, equationSide, document2, previewOptions) {
11217
11222
  return field.tokens.map((token) => {
11218
11223
  if (token.kind === "text") {
@@ -11244,7 +11249,8 @@ function previewInlines(field, islands, output, equationSide, document2, preview
11244
11249
  })
11245
11250
  };
11246
11251
  }
11247
- const number = collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
11252
+ const projected = projectedBookTarget(previewOptions, token.id, "eq");
11253
+ const number = projected ? void 0 : collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
11248
11254
  const island = {
11249
11255
  id: token.id,
11250
11256
  tex: mathTex(token, equationSide, previewOptions.digitForm),
@@ -11252,7 +11258,7 @@ function previewInlines(field, islands, output, equationSide, document2, preview
11252
11258
  output,
11253
11259
  editable: token.editable
11254
11260
  };
11255
- const numberLabel = number == null ? void 0 : formatBibliographyNumber(number, {
11261
+ const numberLabel = projected ? projected.ordinal : number == null ? void 0 : formatBibliographyNumber(number, {
11256
11262
  documentDirection: previewOptions.documentDirection,
11257
11263
  digitForm: previewOptions.digitForm
11258
11264
  });
@@ -11281,6 +11287,8 @@ function textBlockPreview(block, islands, output, equationSide, document2, previ
11281
11287
  };
11282
11288
  }
11283
11289
  function floatNumberLabel(document2, ownerId, previewOptions) {
11290
+ const projected = projectedBookTarget(previewOptions, ownerId, "fig") ?? projectedBookTarget(previewOptions, ownerId, "tab");
11291
+ if (projected) return projected.displayLabel;
11284
11292
  const hit = collectDocumentReferenceTargets(document2).find((target) => target.ownerId === ownerId);
11285
11293
  if (!hit || hit.number === null || hit.kind !== "fig" && hit.kind !== "tab") {
11286
11294
  return void 0;