@drghaliasri/butex 8.1.3 → 8.2.0

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.
@@ -1089,6 +1089,7 @@ type DocumentBookTarget = {
1089
1089
  kind: DocumentLabelKind | 'section' | 'subsection' | 'subsubsection' | 'chapter' | 'appendix';
1090
1090
  caption?: string;
1091
1091
  displayLabel?: string;
1092
+ ordinal?: string;
1092
1093
  manualKey?: string;
1093
1094
  };
1094
1095
  type DocumentBookContext = {
@@ -1089,6 +1089,7 @@ type DocumentBookTarget = {
1089
1089
  kind: DocumentLabelKind | 'section' | 'subsection' | 'subsubsection' | 'chapter' | 'appendix';
1090
1090
  caption?: string;
1091
1091
  displayLabel?: string;
1092
+ ordinal?: string;
1092
1093
  manualKey?: string;
1093
1094
  };
1094
1095
  type DocumentBookContext = {
package/dist/document.js CHANGED
@@ -9107,6 +9107,11 @@ function remapSelectionAfterRangeMove(selection, direction) {
9107
9107
  function mathTex(token, equationSide, digitForm) {
9108
9108
  return mathTokenSourceForSide(token, equationSide, digitForm, true);
9109
9109
  }
9110
+ function projectedBookTarget(options, ownerId, kind) {
9111
+ if (options.mode !== "book-content") return void 0;
9112
+ const book = options.bookContext;
9113
+ return book?.targets?.find((target) => target.unitId === book.unitId && target.ownerId === ownerId && target.kind === kind);
9114
+ }
9110
9115
  function previewInlines(field, islands, output, equationSide, document2, previewOptions) {
9111
9116
  return field.tokens.map((token) => {
9112
9117
  if (token.kind === "text") {
@@ -9138,7 +9143,8 @@ function previewInlines(field, islands, output, equationSide, document2, preview
9138
9143
  })
9139
9144
  };
9140
9145
  }
9141
- const number = collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
9146
+ const projected = projectedBookTarget(previewOptions, token.id, "eq");
9147
+ const number = projected ? void 0 : collectDocumentReferenceTargets(document2).find((target) => target.kind === "eq" && target.ownerId === token.id)?.number;
9142
9148
  const island = {
9143
9149
  id: token.id,
9144
9150
  tex: mathTex(token, equationSide, previewOptions.digitForm),
@@ -9146,7 +9152,7 @@ function previewInlines(field, islands, output, equationSide, document2, preview
9146
9152
  output,
9147
9153
  editable: token.editable
9148
9154
  };
9149
- const numberLabel = number == null ? void 0 : formatBibliographyNumber(number, {
9155
+ const numberLabel = projected ? projected.ordinal : number == null ? void 0 : formatBibliographyNumber(number, {
9150
9156
  documentDirection: previewOptions.documentDirection,
9151
9157
  digitForm: previewOptions.digitForm
9152
9158
  });
@@ -9175,6 +9181,8 @@ function textBlockPreview(block, islands, output, equationSide, document2, previ
9175
9181
  };
9176
9182
  }
9177
9183
  function floatNumberLabel(document2, ownerId, previewOptions) {
9184
+ const projected = projectedBookTarget(previewOptions, ownerId, "fig") ?? projectedBookTarget(previewOptions, ownerId, "tab");
9185
+ if (projected) return projected.displayLabel;
9178
9186
  const hit = collectDocumentReferenceTargets(document2).find((target) => target.ownerId === ownerId);
9179
9187
  if (!hit || hit.number === null || hit.kind !== "fig" && hit.kind !== "tab") {
9180
9188
  return void 0;