@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.
@@ -4589,6 +4589,11 @@ function mathTokenSourceForSide(token, side, digitForm, presentation = false) {
4589
4589
  function mathTex(token, equationSide, digitForm) {
4590
4590
  return mathTokenSourceForSide(token, equationSide, digitForm, true);
4591
4591
  }
4592
+ function projectedBookTarget(options, ownerId, kind) {
4593
+ if (options.mode !== "book-content") return void 0;
4594
+ const book = options.bookContext;
4595
+ return book?.targets?.find((target) => target.unitId === book.unitId && target.ownerId === ownerId && target.kind === kind);
4596
+ }
4592
4597
  function previewInlines(field, islands, output, equationSide, document2, previewOptions) {
4593
4598
  return field.tokens.map((token) => {
4594
4599
  if (token.kind === "text") {
@@ -4620,7 +4625,8 @@ function previewInlines(field, islands, output, equationSide, document2, preview
4620
4625
  })
4621
4626
  };
4622
4627
  }
4623
- const number = collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
4628
+ const projected = projectedBookTarget(previewOptions, token.id, "eq");
4629
+ const number = projected ? void 0 : collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
4624
4630
  const island = {
4625
4631
  id: token.id,
4626
4632
  tex: mathTex(token, equationSide, previewOptions.digitForm),
@@ -4628,7 +4634,7 @@ function previewInlines(field, islands, output, equationSide, document2, preview
4628
4634
  output,
4629
4635
  editable: token.editable
4630
4636
  };
4631
- const numberLabel = number == null ? void 0 : formatBibliographyNumber(number, {
4637
+ const numberLabel = projected ? projected.ordinal : number == null ? void 0 : formatBibliographyNumber(number, {
4632
4638
  documentDirection: previewOptions.documentDirection,
4633
4639
  digitForm: previewOptions.digitForm
4634
4640
  });
@@ -4657,6 +4663,8 @@ function textBlockPreview(block, islands, output, equationSide, document2, previ
4657
4663
  };
4658
4664
  }
4659
4665
  function floatNumberLabel(document2, ownerId, previewOptions) {
4666
+ const projected = projectedBookTarget(previewOptions, ownerId, "fig") ?? projectedBookTarget(previewOptions, ownerId, "tab");
4667
+ if (projected) return projected.displayLabel;
4660
4668
  const hit = collectDocumentReferenceTargets(document2).find((target) => target.ownerId === ownerId);
4661
4669
  if (!hit || hit.number === null || hit.kind !== "fig" && hit.kind !== "tab") {
4662
4670
  return void 0;